IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Forms.FadingMessage Class Reference

Manages a fading message window. Windows containing a message are launched in separate threads, closing after a specified time. More...

+ Inheritance diagram for IG.Forms.FadingMessage:
+ Collaboration diagram for IG.Forms.FadingMessage:

Public Member Functions

 FadingMessage (bool doLaunch=true)
 Argument-less constructor, does not launch the window in a parallel thread. More...
 
 FadingMessage (string msgtext, bool doLaunch=true)
 Shows a fading message in a new thread, with message text equal to mshtext and without a title;. More...
 
 FadingMessage (string msgtext, int showtime, bool doLaunch=true)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms. More...
 
 FadingMessage (string msgtext, int showtime, double fadeportion, bool doLaunch=true)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion. More...
 
 FadingMessage (string title, string msgtext, bool doLaunch=true)
 Shows the consform in a new thread, with a title and with message text equal to msgtext. More...
 
 FadingMessage (string title, string msgtext, int showtime, bool doLaunch=true)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms. More...
 
 FadingMessage (string title, string msgtext, int showtime, double fadeportion, bool doLaunch=true)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion. More...
 
void SetScreenPosition (int left=-1, int top=-1)
 Sets position of the message window on the screen. More...
 
virtual FadingMessage Launch (bool inParallelThread)
 Launches the fading messsage as specified by parameters. More...
 
void LaunchInNewThread ()
 Shows a fading message in a new thread. More...
 
void CloseForm ()
 Closes the fading message control by properly (i.e. thread-safe) calling the Close() and Dispose(). More...
 
void CopyMessageToClipboard ()
 
 FadingMessage ()
 Argument-less constructor, does not launch the window in a parallel thread. More...
 
 FadingMessage (string msgtext)
 Shows a fading message in a new thread, with message text equal to mshtext and without a title;. More...
 
 FadingMessage (string msgtext, int showtime)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms. More...
 
 FadingMessage (string msgtext, int showtime, double fadeportion)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion. More...
 
 FadingMessage (string title, string msgtext)
 Shows the consform in a new thread, with a title and with message text equal to msgtext. More...
 
 FadingMessage (string title, string msgtext, int showtime)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms. More...
 
 FadingMessage (string title, string msgtext, int showtime, double fadeportion)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion. More...
 
void CloseForm ()
 Closes the FadeMessage by properly (i.e. thread-safe) calling the Close() and Dispose(). More...
 
void ShowThread ()
 
void ShowThread (string text)
 Shows a fading message in a new thread, with message text equal to mshtext and without a title;. More...
 
void ShowThread (string msgtext, int showtime)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms. More...
 
void ShowThread (string msgtext, int showtime, double fadeportion)
 Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion. More...
 
void ShowThread (string title, string text)
 Shows the consform in a new thread, with a title and with message text equal to msgtext. More...
 
void ShowThread (string title, string msgtext, int showtime)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms. More...
 
void ShowThread (string title, string msgtext, int showtime, double fadeportion)
 Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion. More...
 

Static Public Member Functions

static void Example ()
 Launches a sample fading message, with some instructions of how to use it. More...
 
static void ExampleLargeNum (double maxDurationInSeconds=5.0, double launchIntervalInSeconds=0.05, bool launchInCurrentThreadWhenPossible=true)
 Launches a larger number of fading messages to check that the system is capable of correct display. More...
 
static void ExampleInferior ()
 A less relevant example. More...
 
static void Example ()
 
static void Example2 ()
 

Public Attributes

Color ForeGroundColorTitle = Color.Blue
 Color of the title (if shown in fading message). More...
 
Color ForeGroundColorMsg = Color.Black
 Color of the message text shown in the fading message. More...
 
Color BackGroundColor = Color.LightYellow
 Active background color of the fading message. More...
 
Color FadeColor = Color.DarkGray
 Final (faded) color of the fading message. More...
 
string MsgTitle = null
 
bool IsReady = false
 
bool BlockMaxShownCurrent = false
 Indicates to block launching new messges when too many are processed. More...
 

Static Public Attributes

static int MaxShown = 50
 If false then the consform can not be closed or dispoded. More...
 
static bool BlockMaxShown = false
 Indicates how many messages can be shown simultaneously. More...
 

Protected Member Functions

virtual void InitFadingMessageBegin ()
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string msgtext)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string msgtext, int showtime)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string msgtext, int showtime, double fadeportion)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string title, string msgtext)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string title, string msgtext, int showtime)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessageBegin (string title, string msgtext, int showtime, double fadeportion)
 Begins initialization of the fading message (it does not launch it). More...
 
virtual void InitFadingMessageEndBase (bool doLaunch, bool inParallelThread)
 Ends initialization of the fading message as specified by parameters. More...
 
virtual void InitFadingMessageEnd (bool doLaunch)
 Finalizes initialization of the fading message, which may include launching the message. More...
 
void InitFadingMessage (bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string msgtext, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string msgtext, int showtime, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string msgtext, int showtime, double fadeportion, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string title, string msgtext, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string title, string msgtext, int showtime, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void InitFadingMessage (string title, string msgtext, int showtime, double fadeportion, bool doLaunch=true)
 Begins initialization of the fading message (it does not launch it). More...
 
void IncrementNumLaunched ()
 Increments the total number of launched fading messages. More...
 
void IncrementNumShown ()
 Increments the number of currently active (displayed) fading messages. More...
 
void DecrementNumShown ()
 Decrements the number of currently active (displayed) fading messages. More...
 
void LauncherNewThread ()
 Launches the current fading message in a parallel thread. More...
 
void LauncherCurrentThread ()
 Launches the current fading message in the current thread, which should be a GUI thread (with a message loop running). More...
 
virtual void LauncherMethod (bool launchedInNewThread)
 This method is used to launch the fading message, either in a parallel thread to the caller thread or on the caller thread. Parameter specified in which way the message is launched. More...
 
override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Static Protected Member Functions

static int GetNextId ()
 

Protected Attributes

bool IsClosable = true
 Returns true if control has been created and is ready to work with. More...
 

Static Protected Attributes

static int _idStatic = -1
 

Properties

static object LockStatic [get]
 Static lock object that can be used by all fadiing message objects. More...
 
object Lock [get]
 ILockable's lock object. More...
 
int Id [get]
 ID of the current fading message object. More...
 
static int NumLaunched [get]
 Gets the total number of launched fading messages. More...
 
static int NumShown = 0 [get]
 Gets the total number of fading messages that aree currently active (displayed). More...
 
static int OutputLevel [get, set]
 Level of output printed to console (for debugging). More...
 
bool IsTopMostWindow [get, set]
 
bool LaunchedAtMouseCursor [get, set]
 Whether the message should be launched at the position of the mouse cursor. More...
 
int ShowTime [get, set]
 Total time, in milliseconds, for which the message is displayed. More...
 
double FadingTimePortion [get, set]
 Portion of display time in which the message background color fades at the end of its display time. More...
 
bool WasLaunched [get, protected set]
 Specifies whether the current fading message has already been launched. More...
 
bool LaunchedInParallelThread [get, set]
 Specifies whether the current fading message has been launched in a parallel thread. More...
 
DateTime StartTime [get, protected set]
 Time when the fading message was launched. More...
 
TimeSpan ElapsedTimeSpan [get]
 Gets the amount of time during which the message has been displayed until now. More...
 
TimeSpan ShowTimeSpan [get, set]
 Gets or sets the total time span for which the message is to be displayed. More...
 
TimeSpan RemainingTimeSpan [get, protected set]
 Gets the remaining time span for which the message will be displayed. More...
 
int MinTickinterval [get, set]
 Minimal tick interval in milliseconds. More...
 
int MaxTicks [get, set]
 Maximal number of timer ticks before the message fades out (this refers to the second part of the message). More...
 
int NumTicks [get, set]
 Number of timer ticks that occurred after the fading message has been launched. More...
 
int TotalTicks [get, set]
 Total number of timerr ticks in the fading portion of the message display time. More...
 
int FirstTickInterval [get, set]
 Length of the first timer tick interval in milliseconds. <pra>The first tick marks start of the fading portion of the display time. After the first tick, tick interval is reduced to enable smooth color transition.</pra> More...
 
int TickInterval [get, set]
 Current tick interval in milliseconds. More...
 
double FadingFactor [get, set]
 Current fading factor - extent to which the active bacground color has changed to the faded color. More...
 
bool IsFormClosing [get]
 Gets a flag indicating whether the fading message is currently being closed. More...
 
bool IsFormClosedOrClosing [get]
 Gets aa flag indicating whether the form has been closed or is currently being closed. More...
 
double MinimalRemainingSecondsWithMenu [get, set]
 Minimal remaining show time, in seconds, when user launches a context menu. More...
 

Private Member Functions

void ManipulationThreadFunc ()
 A parallel thread that takes care of launching the thread that manages the form. This thread also takes care that the form is disposed after the prescribed time elapses. More...
 
void timer1_Tick (object sender, EventArgs e)
 Timer event, handles color change, closing after display time is passed, etc. More...
 
void FadeMessage_MouseMove (object sender, MouseEventArgs e)
 Enables dragging by mouse. More...
 
void FadeMessage_MouseDown (object sender, MouseEventArgs e)
 Enables dragging by mouse. More...
 
void SetFadeLevel (double fadefactor)
 Sets control's background accordig to the fading factor. More...
 
void SetCommonEvents (Control f)
 This method is used to set the common event handlers for the curren fading message control and its subcontrols. More...
 
void FadeMessage_Load (object sender, System.EventArgs e)
 
void FadeMessage_Disposed (object sender, System.EventArgs e)
 
void FadeMessage_FormClosing (object sender, FormClosingEventArgs e)
 
void CancelBtn_Click (object sender, EventArgs e)
 
void FadeMessage_MouseClick (object sender, MouseEventArgs e)
 Handles mouse click events for the current fading message control. More...
 
void FadeMessage_KeyPress (object sender, KeyPressEventArgs e)
 Handles mouse click events for the current fading message control. More...
 
void menuStrip1_ItemClicked (object sender, ToolStripItemClickedEventArgs e)
 
void menuCopyMessage_Click (object sender, EventArgs e)
 Copies message text to clipboard. More...
 
void menuClose_Click (object sender, EventArgs e)
 
void menuMain_Opening (object sender, CancelEventArgs e)
 Executed when the context menue is opening. More...
 
void menuIdentifyThread_Click (object sender, EventArgs e)
 
void menuLaunchSameThread_Click (object sender, EventArgs e)
 
void menuLaunchMessageParallel_Click (object sender, EventArgs e)
 
void menuExample_Click (object sender, EventArgs e)
 Launches a demonstrative example message. More...
 
void menuExampleMassive_Click (object sender, EventArgs e)
 Runs a massive launch demo. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 
void baseFadeMessage ()
 Required designer variable. More...
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 
void FadeMessage_MouseMove (object sender, MouseEventArgs e)
 
void FadeMessage_MouseDown (object sender, MouseEventArgs e)
 
void ManipulationThreadFunc ()
 
void FormThreadFunc ()
 Launches the message. More...
 
void timer1_Tick (object sender, EventArgs e)
 
void SetFadeLevel (double fadefactor)
 
void SetCommonEvents (Control f)
 
void FadeMessage_Load (object sender, System.EventArgs e)
 
void FadeMessage_Disposed (object sender, System.EventArgs e)
 
void FadeMessage_FormClosing (object sender, FormClosingEventArgs e)
 
void CancelBtn_Click (object sender, EventArgs e)
 
void FadeMessage_MouseClick (object sender, MouseEventArgs e)
 
void PnlStatus_Paint (object sender, PaintEventArgs e)
 

Private Attributes

readonly object _lock = new object()
 
volatile int _id = GetNextId()
 
bool _isTopMostWindow = true
 
bool _launchesAtMouseCursor = false
 
string MsgText = null
 
int _showTime = defaultShowtime
 
double _fadingTimePortion = defaultFadingTimePortion
 
Thread _formthread = null
 
Thread _manipulationthread = null
 
bool _wasLaunched = false
 
bool _launchedInParallelThread = false
 
DateTime _startTime
 
int _minTickInterval = 40
 
int _maxTicks = 50
 
int _numTicks = 0
 
int _totalTicks = 20
 
int _firstTick = 1000
 
int _tickInterval = 100
 
double _fadingFactor = 0
 
volatile bool _isFormClosing = false
 
volatile bool _isFormClosed = false
 
int m_PrevX
 
int m_PrevY
 
double _minRemainingSecMenu = 8.0
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
System.Windows.Forms.Timer timer1
 
System.Windows.Forms.Button btnCancel
 
System.Windows.Forms.Label lblStatus
 
System.Windows.Forms.Panel BodyPnl
 
System.Windows.Forms.Label lblMEssage
 
System.Windows.Forms.Label lblTitle
 
System.Windows.Forms.Panel PnlStatus
 
System.Windows.Forms.Label labelBottom
 
System.Windows.Forms.ContextMenuStrip menuMain
 
System.Windows.Forms.ToolStripMenuItem menuCopyMessage
 
System.Windows.Forms.ToolStripMenuItem menuClose
 
System.Windows.Forms.ToolStripMenuItem menuLaunchThreadParallel
 
System.Windows.Forms.ToolStripMenuItem menuIdentifyThread
 
System.Windows.Forms.ToolStripMenuItem menuLaunchSameThread
 
System.Windows.Forms.ToolStripMenuItem menuExample
 
System.Windows.Forms.ToolStripMenuItem menuExampleMassive
 
bool Counted = false
 Instructs just for the current index to block launching the messge when too many are processed. More...
 
Button btnCancel
 
Label lblStatus
 
Panel BodyPnl
 
Label lblMEssage
 
Label lblTitle
 
Panel PnlStatus
 
Label labelBottom
 
IContainer components
 
int vShowTime = defaultShowtime
 
double vFadingTimePortion = defaultFadingTimePortion
 
Thread formthread = null
 
Thread manipulationthread = null
 
int mintickinterval = 40
 
int maxticks = 50
 
int numticks = 0
 
int totalticks = 20
 
int firsttick = 1000
 
int tickinterval = 100
 
double fadingfactor = 0
 

Static Private Attributes

static object _lockStatic = null
 
static volatile int _numLaunched = 0
 
static volatile int _numShown = 0
 
static int _outputLevel = 0
 
static int defaultShowtime = 3000
 Instructs just for the current index to block launching the messge when too many are processed. More...
 
static double defaultFadingTimePortion = 0.3
 

Detailed Description

Manages a fading message window. Windows containing a message are launched in separate threads, closing after a specified time.

This class' constructors call virtual methods. This should in general be avoides and should be considered exceptional case.

Because of this, in derived classes, constructors should just directly call constructors of base class with the same arguments!

$A Igor jul08;

$A Igor jul08;

Constructor & Destructor Documentation

IG.Forms.FadingMessage.FadingMessage ( bool  doLaunch = true)
inline

Argument-less constructor, does not launch the window in a parallel thread.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext,
bool  doLaunch = true 
)
inline

Shows a fading message in a new thread, with message text equal to mshtext and without a title;.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext,
int  showtime,
bool  doLaunch = true 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext,
int  showtime,
double  fadeportion,
bool  doLaunch = true 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext,
bool  doLaunch = true 
)
inline

Shows the consform in a new thread, with a title and with message text equal to msgtext.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext,
int  showtime,
bool  doLaunch = true 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext,
int  showtime,
double  fadeportion,
bool  doLaunch = true 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion.

IG.Forms.FadingMessage.FadingMessage ( )
inline

Argument-less constructor, does not launch the window in a parallel thread.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext)
inline

Shows a fading message in a new thread, with message text equal to mshtext and without a title;.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext,
int  showtime 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms.

IG.Forms.FadingMessage.FadingMessage ( string  msgtext,
int  showtime,
double  fadeportion 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext 
)
inline

Shows the consform in a new thread, with a title and with message text equal to msgtext.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext,
int  showtime 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms.

IG.Forms.FadingMessage.FadingMessage ( string  title,
string  msgtext,
int  showtime,
double  fadeportion 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion.

Member Function Documentation

virtual void IG.Forms.FadingMessage.InitFadingMessageBegin ( )
inlineprotectedvirtual

Begins initialization of the fading message (it does not launch it).

If necessary, this method can be

void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  msgtext)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  msgtext,
int  showtime 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  msgtext,
int  showtime,
double  fadeportion 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
fadeportionPortion of the show time in shich teh message background fades.
void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  title,
string  msgtext 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  title,
string  msgtext,
int  showtime 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
void IG.Forms.FadingMessage.InitFadingMessageBegin ( string  title,
string  msgtext,
int  showtime,
double  fadeportion 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
fadeportionPortion of the show time in shich teh message background fades.
virtual void IG.Forms.FadingMessage.InitFadingMessageEndBase ( bool  doLaunch,
bool  inParallelThread 
)
inlineprotectedvirtual

Ends initialization of the fading message as specified by parameters.

This method can be overridden in derived classes.

Parameters
doLaunchIf true then fading message is automatically launched when initialization is done.
inParallelThreadIf true then mafing message is launched in a paralleel thread.
virtual void IG.Forms.FadingMessage.InitFadingMessageEnd ( bool  doLaunch)
inlineprotectedvirtual

Finalizes initialization of the fading message, which may include launching the message.

Parameters
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( bool  doLaunch = true)
inlineprotected

Begins initialization of the fading message (it does not launch it).

If necessary, this method can be overridden in derived classes.

Parameters
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  msgtext,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  msgtext,
int  showtime,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  msgtext,
int  showtime,
double  fadeportion,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
fadeportionPortion of the show time in shich teh message background fades.
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  title,
string  msgtext,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  title,
string  msgtext,
int  showtime,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
doLaunchWhether the message should also be launched.
void IG.Forms.FadingMessage.InitFadingMessage ( string  title,
string  msgtext,
int  showtime,
double  fadeportion,
bool  doLaunch = true 
)
inlineprotected

Begins initialization of the fading message (it does not launch it).

Parameters
titleFading message's title.
msgtextFading message's text (the message).
showtimeTime (in miilliiseconds) in which the message is shown.
fadeportionPortion of the show time in shich teh message background fades.
doLaunchWhether the message should also be launched.
static int IG.Forms.FadingMessage.GetNextId ( )
inlinestaticprotected
void IG.Forms.FadingMessage.IncrementNumLaunched ( )
inlineprotected

Increments the total number of launched fading messages.

void IG.Forms.FadingMessage.IncrementNumShown ( )
inlineprotected

Increments the number of currently active (displayed) fading messages.

void IG.Forms.FadingMessage.DecrementNumShown ( )
inlineprotected

Decrements the number of currently active (displayed) fading messages.

void IG.Forms.FadingMessage.SetScreenPosition ( int  left = -1,
int  top = -1 
)
inline

Sets position of the message window on the screen.

If position arguments are less than 0 then mouse cursor position is taken.

Parameters
leftDistance of window from the left edge of the screen.

If less than 0, it is set at mouse cursor horizontal position.

Parameters
topDistance of window from the top edge of the screen.

If less than 0, it is set at mouse cursor vertical position.

References IG.Lib.Left, and IG.Lib.Top.

void IG.Forms.FadingMessage.ManipulationThreadFunc ( )
inlineprivate

A parallel thread that takes care of launching the thread that manages the form. This thread also takes care that the form is disposed after the prescribed time elapses.

void IG.Forms.FadingMessage.LaunchInNewThread ( )
inline

Shows a fading message in a new thread.

It first launches a new thread that launches the thread managing the form. In this way, the calling thread returns quickly and robust manipulation of the consform can be done.

Referenced by IG.Forms.ConsoleForm.ReserveReportError0().

void IG.Forms.FadingMessage.LauncherNewThread ( )
inlineprotected

Launches the current fading message in a parallel thread.

void IG.Forms.FadingMessage.LauncherCurrentThread ( )
inlineprotected

Launches the current fading message in the current thread, which should be a GUI thread (with a message loop running).

virtual void IG.Forms.FadingMessage.LauncherMethod ( bool  launchedInNewThread)
inlineprotectedvirtual

This method is used to launch the fading message, either in a parallel thread to the caller thread or on the caller thread. Parameter specified in which way the message is launched.

Parameters
launchedInNewThreadIf true then the message is launched in a new parallel thread, which means that the message loop must be run by calling ShowDialog() method.

Launches the message.

void IG.Forms.FadingMessage.timer1_Tick ( object  sender,
EventArgs  e 
)
inlineprivate

Timer event, handles color change, closing after display time is passed, etc.

Parameters
sender
e
void IG.Forms.FadingMessage.CloseForm ( )
inline

Closes the fading message control by properly (i.e. thread-safe) calling the Close() and Dispose().

References IG.Forms.VoidDelegate().

void IG.Forms.FadingMessage.FadeMessage_MouseMove ( object  sender,
MouseEventArgs  e 
)
inlineprivate

Enables dragging by mouse.

References IG.Lib.Left, and IG.Lib.Top.

void IG.Forms.FadingMessage.FadeMessage_MouseDown ( object  sender,
MouseEventArgs  e 
)
inlineprivate

Enables dragging by mouse.

void IG.Forms.FadingMessage.SetFadeLevel ( double  fadefactor)
inlineprivate

Sets control's background accordig to the fading factor.

Parameters
fadefactor

References IG.Forms.UtilForms.SetBackColorRec().

void IG.Forms.FadingMessage.SetCommonEvents ( Control  f)
inlineprivate

This method is used to set the common event handlers for the curren fading message control and its subcontrols.

Parameters
fControl on which common event handlers are set.
void IG.Forms.FadingMessage.FadeMessage_Load ( object  sender,
System.EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_Disposed ( object  sender,
System.EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_FormClosing ( object  sender,
FormClosingEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.CancelBtn_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_MouseClick ( object  sender,
MouseEventArgs  e 
)
inlineprivate

Handles mouse click events for the current fading message control.

void IG.Forms.FadingMessage.FadeMessage_KeyPress ( object  sender,
KeyPressEventArgs  e 
)
inlineprivate

Handles mouse click events for the current fading message control.

void IG.Forms.FadingMessage.menuStrip1_ItemClicked ( object  sender,
ToolStripItemClickedEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.menuCopyMessage_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Copies message text to clipboard.

void IG.Forms.FadingMessage.CopyMessageToClipboard ( )
inline
void IG.Forms.FadingMessage.menuClose_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.menuMain_Opening ( object  sender,
CancelEventArgs  e 
)
inlineprivate

Executed when the context menue is opening.

If necessary, display time of the fading message is extended, such that the user has time to select items from the menu.

void IG.Forms.FadingMessage.menuIdentifyThread_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.menuLaunchSameThread_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.menuLaunchMessageParallel_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.menuExample_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Launches a demonstrative example message.

References IG.Forms.FadingMessage.Example().

void IG.Forms.FadingMessage.menuExampleMassive_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Runs a massive launch demo.

References IG.Forms.FadingMessage.ExampleLargeNum().

static void IG.Forms.FadingMessage.Example ( )
inlinestatic

Launches a sample fading message, with some instructions of how to use it.

References IG.Forms.FadingMessage.Launch().

Referenced by IG.Script.AppExtBase.FormDemoFunctionFadingMessage(), and IG.Forms.FadingMessage.menuExample_Click().

static void IG.Forms.FadingMessage.ExampleLargeNum ( double  maxDurationInSeconds = 5.0,
double  launchIntervalInSeconds = 0.05,
bool  launchInCurrentThreadWhenPossible = true 
)
inlinestatic
static void IG.Forms.FadingMessage.ExampleInferior ( )
inlinestatic
override void IG.Forms.FadingMessage.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.
void IG.Forms.FadingMessage.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

void IG.Forms.FadingMessage.baseFadeMessage ( )
inlineprivate

Required designer variable.

void IG.Forms.FadingMessage.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

void IG.Forms.FadingMessage.FadeMessage_MouseMove ( object  sender,
MouseEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_MouseDown ( object  sender,
MouseEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.ManipulationThreadFunc ( )
inlineprivate
void IG.Forms.FadingMessage.FormThreadFunc ( )
inlineprivate

Launches the message.

void IG.Forms.FadingMessage.timer1_Tick ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.SetFadeLevel ( double  fadefactor)
inlineprivate
void IG.Forms.FadingMessage.SetCommonEvents ( Control  f)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_Load ( object  sender,
System.EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_Disposed ( object  sender,
System.EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.FadeMessage_FormClosing ( object  sender,
FormClosingEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.CancelBtn_Click ( object  sender,
EventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.CloseForm ( )
inline

Closes the FadeMessage by properly (i.e. thread-safe) calling the Close() and Dispose().

References IG.Forms.VoidDelegate().

void IG.Forms.FadingMessage.ShowThread ( )
inline

Shows a fading message in a new thread. It first launches a new thread that launches the thread managing the consform.

Referenced by IG.Forms.XMLTreeView.ReportError0(), and IG.Forms.ConsoleForm.ReserveReportError0().

void IG.Forms.FadingMessage.ShowThread ( string  text)
inline

Shows a fading message in a new thread, with message text equal to mshtext and without a title;.

void IG.Forms.FadingMessage.ShowThread ( string  msgtext,
int  showtime 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms.

void IG.Forms.FadingMessage.ShowThread ( string  msgtext,
int  showtime,
double  fadeportion 
)
inline

Shows a fading message in a new thread, with message text equal to msgtext and with specified showing time in ms and fading time portion.

void IG.Forms.FadingMessage.ShowThread ( string  title,
string  text 
)
inline

Shows the consform in a new thread, with a title and with message text equal to msgtext.

void IG.Forms.FadingMessage.ShowThread ( string  title,
string  msgtext,
int  showtime 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms.

void IG.Forms.FadingMessage.ShowThread ( string  title,
string  msgtext,
int  showtime,
double  fadeportion 
)
inline

Shows a fading message in a new thread, with a title and with message text equal to msgtext, with specified showing time in ms and fading time portion.

void IG.Forms.FadingMessage.FadeMessage_MouseClick ( object  sender,
MouseEventArgs  e 
)
inlineprivate
void IG.Forms.FadingMessage.PnlStatus_Paint ( object  sender,
PaintEventArgs  e 
)
inlineprivate
static void IG.Forms.FadingMessage.Example ( )
inlinestatic
static void IG.Forms.FadingMessage.Example2 ( )
inlinestatic

Member Data Documentation

object IG.Forms.FadingMessage._lockStatic = null
staticprivate
readonly object IG.Forms.FadingMessage._lock = new object()
private
int IG.Forms.FadingMessage._idStatic = -1
staticprotected
volatile int IG.Forms.FadingMessage._id = GetNextId()
private
volatile int IG.Forms.FadingMessage._numLaunched = 0
staticprivate
volatile int IG.Forms.FadingMessage._numShown = 0
staticprivate
int IG.Forms.FadingMessage._outputLevel = 0
staticprivate
bool IG.Forms.FadingMessage._isTopMostWindow = true
private
bool IG.Forms.FadingMessage._launchesAtMouseCursor = false
private
Color IG.Forms.FadingMessage.ForeGroundColorTitle = Color.Blue

Color of the title (if shown in fading message).

Referenced by IG.Forms.ReporterForms.DefaultReport_FadeMessage(), and IG.Forms.ReporterForms.DefaultReserveReportErrorForms().

Color IG.Forms.FadingMessage.ForeGroundColorMsg = Color.Black

Color of the message text shown in the fading message.

Referenced by IG.Forms.ReporterForms.DefaultReport_FadeMessage(), and IG.Forms.ReporterForms.DefaultReserveReportErrorForms().

Color IG.Forms.FadingMessage.FadeColor = Color.DarkGray
bool IG.Forms.FadingMessage.IsReady = false
bool IG.Forms.FadingMessage.IsClosable = true
protected

Returns true if control has been created and is ready to work with.

static int IG.Forms.FadingMessage.MaxShown = 50
static

If false then the consform can not be closed or dispoded.

static bool IG.Forms.FadingMessage.BlockMaxShown = false
static

Indicates how many messages can be shown simultaneously.

bool IG.Forms.FadingMessage.BlockMaxShownCurrent = false

Indicates to block launching new messges when too many are processed.

static int IG.Forms.FadingMessage.defaultShowtime = 3000
staticprivate

Instructs just for the current index to block launching the messge when too many are processed.

static double IG.Forms.FadingMessage.defaultFadingTimePortion = 0.3
staticprivate
int IG.Forms.FadingMessage._showTime = defaultShowtime
private
double IG.Forms.FadingMessage._fadingTimePortion = defaultFadingTimePortion
private
Thread IG.Forms.FadingMessage._formthread = null
private
Thread IG.Forms.FadingMessage._manipulationthread = null
private
bool IG.Forms.FadingMessage._wasLaunched = false
private
bool IG.Forms.FadingMessage._launchedInParallelThread = false
private
DateTime IG.Forms.FadingMessage._startTime
private
int IG.Forms.FadingMessage._minTickInterval = 40
private
int IG.Forms.FadingMessage._maxTicks = 50
private
int IG.Forms.FadingMessage._numTicks = 0
private
int IG.Forms.FadingMessage._totalTicks = 20
private
int IG.Forms.FadingMessage._firstTick = 1000
private
int IG.Forms.FadingMessage._tickInterval = 100
private
double IG.Forms.FadingMessage._fadingFactor = 0
private
volatile bool IG.Forms.FadingMessage._isFormClosing = false
private
volatile bool IG.Forms.FadingMessage._isFormClosed = false
private
int IG.Forms.FadingMessage.m_PrevX
private
int IG.Forms.FadingMessage.m_PrevY
private
double IG.Forms.FadingMessage._minRemainingSecMenu = 8.0
private
System.ComponentModel.IContainer IG.Forms.FadingMessage.components = null
private

Required designer variable.

System Windows Forms Timer IG.Forms.FadingMessage.timer1
private
System.Windows.Forms.Button IG.Forms.FadingMessage.btnCancel
private
System.Windows.Forms.Label IG.Forms.FadingMessage.lblStatus
private
System.Windows.Forms.Panel IG.Forms.FadingMessage.BodyPnl
private
System.Windows.Forms.Label IG.Forms.FadingMessage.lblMEssage
private
System.Windows.Forms.Label IG.Forms.FadingMessage.lblTitle
private
System.Windows.Forms.Panel IG.Forms.FadingMessage.PnlStatus
private
System.Windows.Forms.Label IG.Forms.FadingMessage.labelBottom
private
System.Windows.Forms.ContextMenuStrip IG.Forms.FadingMessage.menuMain
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuCopyMessage
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuClose
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuLaunchThreadParallel
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuIdentifyThread
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuLaunchSameThread
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuExample
private
System.Windows.Forms.ToolStripMenuItem IG.Forms.FadingMessage.menuExampleMassive
private
bool IG.Forms.FadingMessage.Counted = false
private

Instructs just for the current index to block launching the messge when too many are processed.

Button IG.Forms.FadingMessage.btnCancel
private
Label IG.Forms.FadingMessage.lblStatus
private
Panel IG.Forms.FadingMessage.BodyPnl
private
Label IG.Forms.FadingMessage.lblMEssage
private
Label IG.Forms.FadingMessage.lblTitle
private
Panel IG.Forms.FadingMessage.PnlStatus
private
Label IG.Forms.FadingMessage.labelBottom
private
IContainer IG.Forms.FadingMessage.components
private
int IG.Forms.FadingMessage.vShowTime = defaultShowtime
private
double IG.Forms.FadingMessage.vFadingTimePortion = defaultFadingTimePortion
private
Thread IG.Forms.FadingMessage.formthread = null
private
Thread IG.Forms.FadingMessage.manipulationthread = null
private
int IG.Forms.FadingMessage.mintickinterval = 40
private
int IG.Forms.FadingMessage.maxticks = 50
private
int IG.Forms.FadingMessage.numticks = 0
private
int IG.Forms.FadingMessage.totalticks = 20
private
int IG.Forms.FadingMessage.firsttick = 1000
private
int IG.Forms.FadingMessage.tickinterval = 100
private
double IG.Forms.FadingMessage.fadingfactor = 0
private

Property Documentation

object IG.Forms.FadingMessage.LockStatic
staticget

Static lock object that can be used by all fadiing message objects.

object IG.Forms.FadingMessage.Lock
get

ILockable's lock object.

int IG.Forms.FadingMessage.Id
get

ID of the current fading message object.

int IG.Forms.FadingMessage.NumLaunched
staticget

Gets the total number of launched fading messages.

static int IG.Forms.FadingMessage.NumShown = 0
staticget

Gets the total number of fading messages that aree currently active (displayed).

Indicates how many messages can be shown simultaneously.

int IG.Forms.FadingMessage.OutputLevel
staticgetsetprotected

Level of output printed to console (for debugging).

bool IG.Forms.FadingMessage.LaunchedAtMouseCursor
getset

Whether the message should be launched at the position of the mouse cursor.

If set when the message is displayed, the form moves to the position of mouse cursor.

Referenced by IG.Forms.ReporterForms.DefaultReport_FadeMessage(), and IG.Forms.FadingMessage.ExampleLargeNum().

double IG.Forms.FadingMessage.FadingTimePortion
getset

Portion of display time in which the message background color fades at the end of its display time.

Referenced by IG.Forms.ReporterForms.DefaultReport_FadeMessage(), and IG.Forms.ReporterForms.DefaultReserveReportErrorForms().

bool IG.Forms.FadingMessage.WasLaunched
getprotected set

Specifies whether the current fading message has already been launched.

bool IG.Forms.FadingMessage.LaunchedInParallelThread
getset

Specifies whether the current fading message has been launched in a parallel thread.

Referenced by IG.Forms.OutputValueSelector.menuSummary_Click(), and IG.Forms.InputParameterSelectorMinMax.menuSummary_Click().

DateTime IG.Forms.FadingMessage.StartTime
getprotected set

Time when the fading message was launched.

TimeSpan IG.Forms.FadingMessage.ElapsedTimeSpan
getprotected

Gets the amount of time during which the message has been displayed until now.

Zero time span is returned if the message has not yett been displayed.

TimeSpan IG.Forms.FadingMessage.ShowTimeSpan
getset

Gets or sets the total time span for which the message is to be displayed.

TimeSpan IG.Forms.FadingMessage.RemainingTimeSpan
getprotected set

Gets the remaining time span for which the message will be displayed.

Can be negative.

int IG.Forms.FadingMessage.MinTickinterval
getsetprivate

Minimal tick interval in milliseconds.

int IG.Forms.FadingMessage.MaxTicks
getsetprivate

Maximal number of timer ticks before the message fades out (this refers to the second part of the message).

int IG.Forms.FadingMessage.NumTicks
getsetprivate

Number of timer ticks that occurred after the fading message has been launched.

This onlly counts ticks in the fading portion of display time.

int IG.Forms.FadingMessage.TotalTicks
getsetprivate

Total number of timerr ticks in the fading portion of the message display time.

int IG.Forms.FadingMessage.FirstTickInterval
getsetprivate

Length of the first timer tick interval in milliseconds. <pra>The first tick marks start of the fading portion of the display time. After the first tick, tick interval is reduced to enable smooth color transition.</pra>

int IG.Forms.FadingMessage.TickInterval
getsetprivate

Current tick interval in milliseconds.

double IG.Forms.FadingMessage.FadingFactor
getsetprotected

Current fading factor - extent to which the active bacground color has changed to the faded color.

bool IG.Forms.FadingMessage.IsFormClosing
get

Gets a flag indicating whether the fading message is currently being closed.

bool IG.Forms.FadingMessage.IsFormClosedOrClosing
get

Gets aa flag indicating whether the form has been closed or is currently being closed.

double IG.Forms.FadingMessage.MinimalRemainingSecondsWithMenu
getsetprotected

Minimal remaining show time, in seconds, when user launches a context menu.

If in that case the remaining display time of the message is lesser than the minimum time, the display time is extented accordingly.


The documentation for this class was generated from the following files: