private void ExitApplication_EventHandler(object sender, EventArgs e) { try { if (CheckForOpenRequestDetails() == false) { return; } log.Info("Logged out of DataMart Client."); foreach (NetWorkSetting ns in Configuration.Instance.NetworkSettingCollection.NetWorkSettings) { if (ns.SftpClient != null) { ns.SftpClient.Dispose(); } } SystemTray.HideSystemTrayIcon(); Application.DoEvents(); Application.Exit(); } catch (Exception ex) { log.Error(ex); MessageBox.Show(ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); SystemTray.HideSystemTrayIcon(); _autoRefresh.CallDispose(); _tabIcons.CallDispose(); }
protected override void OnClosed(EventArgs e) { base.OnClosed(e); SystemTray.HideSystemTrayIcon(); if (_networkRefreshList != null && _networkRefreshList.Any()) { _networkRefreshList.ForEach(p => p.CallDispose()); _networkRefreshList.Clear(); } _tabIcons.CallDispose(); }