private void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { UnsubscribeEvents(); trayIcon.Visible = false; trayIcon.Dispose(); } instance = null; disposed = true; }
public MainContext() { try { serverStatus = Status.Offline; this.SetUpReader(); this.SetUpConnectivityChecker(); this.SubscribeEvents(); this.StartServer(); this.iconController = TrayIconController.Instance; } catch { MessageBox.Show("Closing app..."); var a = new System.Timers.Timer(50); a.Elapsed += Close; a.AutoReset = false; a.Enabled = true; return; } }