private void StopClient(object state) { try { _client.StopClient(); ClientState = EClientState.Stopped; NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), Strings.MAINFORM_CLIENT_STOPPED, false); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); } }
public MainWindow() { InitializeComponent(); Init(); n = new NotifyContextMenu(this); notifyIcon = new System.Windows.Forms.NotifyIcon(); notifyIcon.Text = "ShadowKernel"; notifyIcon.Icon = Properties.Resources.icon; notifyIcon.Visible = true; notifyIcon.DoubleClick += new EventHandler(NotifyIcon_DoubleClick); notifyIcon.MouseClick += NotifyIcon_MouseClick; }
/// ----------------------------------------------------------------------------- /// <summary> /// Arrêt effectif du client /// </summary> /// <param name="state">les parametres</param> /// ----------------------------------------------------------------------------- private void StopClient(Object state) { try { _client.StopClient(); ClientState = EClientState.Stopped; // On utilise un Invoke car le thread courant est différent du thread créateur du contrôle (modèle STA) NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), new object[] { Strings.MAINFORM_CLIENT_STOPPED, false }); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); } }
private void StartClient(Object state) { try { _client.StartClient(); ClientState = EClientState.Started; NotifyContextMenu.Invoke(new UpdateNotifyIconDelegate(UpdateNotifyIcon), Strings.MAINFORM_CLIENT_STARTED, true); } catch (Exception e) { _client.Log(e.Message, ESeverity.ERROR); _client.Log(e.ToString(), ESeverity.DEBUG); StopClient(null); } NotifyContextMenu_Opened(this, EventArgs.Empty); }