Exemple #1
0
        public MainForm()
        {
            InitializeComponent();

            SystemEvents.SessionEnding +=
                new SessionEndingEventHandler(SystemEvents_SessionEnding);

            wm.CreateReceiver();

            Win32.WTSRegisterSessionNotification(wm.ReceiverHandle, (int)ConsoleNotificationFlagsEnum.NOTIFY_FOR_ALL_SESSIONS);
            this.Closed += (sender, args) => Win32.WTSUnRegisterSessionNotification(wm.ReceiverHandle);

            wm.RegisterMessage(WM_WTSSESSION_CHANGE);
            //wm.RegisterMessage(WM_QUERYENDSESSION);
            wm.RegisterMessage(Win32.WM_MyMessage1);
            wm.RegisterMessage(Win32.WM_MyMessage2);
            wm.RegisterEvent((m) => { MessageReceiveChangeCallback(m); });

            //前のバージョンの設定を読み込み、新しいバージョンの設定とする
            Properties.Settings.Default.Upgrade();

            _statusForm = new StatusForm(wm.ReceiverHandle);
            _logoForm   = new LogoForm(this);

            _settingsForm = new SettingsForm(_statusForm);
        }
Exemple #2
0
 public SettingsForm(StatusForm statusForm)
 {
     InitializeComponent();
     _statusForm     = statusForm;
     txtCurrent.Text = StatusForm.Device?.DeviceName;
     _statusForm.InitialDeviceState += (sender, args) =>
     {
         txtCurrent.Text = StatusForm.Device?.DeviceName;
     };
 }