📄 statusmessagewindow.cs
字号:
using Launcher.Properties;
using Microsoft.WindowsCE.Forms;
namespace Launcher
{
/// <summary>
/// Derive's from MessageWindow class to process
/// custom Windows messages
/// </summary>
public class StatusMessageWindow : MessageWindow
{
#region Fields & Constants
// Assign integers to messages.
// Note that custom Window messages are after WM_USER = 0x400.
private const int WM_STATUSUPDATE = 0x0401;
private const int WM_ERROR = 0x0402;
private const int WM_DONE = 0x0403;
// Holds the instance of our splash screen to be updated
private SplashScreen splashScreen;
#endregion
#region Constructors
/// <summary>
/// Initialize
/// </summary>
/// <param name="splashScreen">pointer to the Parent Splash Form</param>
/// <param name="windowName">Name to be assigned to this message window. This name is used by ot
/// other processes for IPC</param>
public StatusMessageWindow(SplashScreen splashScreen, string windowName)
{
//hold reference to the splash screen
this.splashScreen = splashScreen;
//assign the window name to be used to find this window by the main application
this.Text = windowName;
//set the initial status
splashScreen.UpdateStatus( Resources.ResourceManager.GetString("InitialStatus") );
}
#endregion
#region MessageWindow overriden methods
/// <summary>
/// Override the default WndProc behavior to examine messages.
/// </summary>
/// <param name="msg">recevied message</param>
protected override void WndProc(ref Message msg)
{
//custom processing for known message codes
switch ( msg.Msg )
{
case (WM_STATUSUPDATE):
{
//update the status text in the parent splash screen
this.splashScreen.UpdateStatus(
Resources.ResourceManager.GetString(
MessageCodes.Instance.ResourceKey[msg.WParam.ToInt32()])
);
break;
}
case WM_ERROR:
{
//update the status text in the parent splash screen
this.splashScreen.UpdateStatus(
Resources.ResourceManager.GetString(
MessageCodes.Instance.ResourceKey[msg.WParam.ToInt32()])
);
//give the user time to read the message
System.Threading.Thread.Sleep(1000);
//inform the user that we are shutting down
this.splashScreen.UpdateStatus(
Resources.ResourceManager.GetString("ShuttingDown")
);
//shut down the splash screen
splashScreen.Shutdown();
break;
}
case WM_DONE:
{
splashScreen.Shutdown();
}
break;
}
// Call the base class WndProc for default message handling.
base.WndProc(ref msg);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -