Пример #1
0
 private void bgwLogout_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         ApplicationInfo.IsAreadyLogin = false;
         AlertManager.Instance.IsMonitoring = false;
         if (this.feedsWebProxy != null)
         {
             this.feedsWebProxy.Stop();
             this.feedsWebProxy.OnDataIN -= new FeedsWebProxy.OnDataInHandler(this.feedsWebProxy_OnDataIN);
             this.feedsWebProxy.OnError -= new FeedsWebProxy.OnErrorHandler(this.feedsWebProxy_OnError);
             this.feedsWebProxy.OnGettingHttp -= new EventHandler(this.feedsWebProxy_OnGettingHttp);
             this.feedsWebProxy.OnGettedHttp -= new EventHandler(this.feedsWebProxy_OnGettedHttp);
             this.feedsWebProxy.OnStoped -= new EventHandler(this.feedsWebProxy_OnStoped);
             this.feedsWebProxy.OnStarted -= new EventHandler(this.feedsWebProxy_OnStarted);
             this.feedsWebProxy = null;
         }
         this.stopBC();
         if (this._qMessage != null)
         {
             this._qMessage.Clear();
             this._qMessage = null;
         }
         SystemEvents.PowerModeChanged -= new PowerModeChangedEventHandler(this.SystemEvents_PowerModeChanged);
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(this.SendOrderBox.ReceiveMessage));
         frmMain._OnMessageTfexReceived = (frmMain.OnMessageTfexRecievedEventHendler)Delegate.Remove(frmMain._OnMessageTfexReceived, new frmMain.OnMessageTfexRecievedEventHendler(this.SendOrderBox.ReceiveTfexMessage));
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(this.ViewOrderBox.ReceiveMessage));
         frmMain._OnMessageTfexReceived = (frmMain.OnMessageTfexRecievedEventHendler)Delegate.Remove(frmMain._OnMessageTfexReceived, new frmMain.OnMessageTfexRecievedEventHendler(this.ViewOrderBox.ReceiveTfexMessage));
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(this.BroadcastMessageBox.ReceiveMessage));
         frmMain._OnMessageTfexReceived = (frmMain.OnMessageTfexRecievedEventHendler)Delegate.Remove(frmMain._OnMessageTfexReceived, new frmMain.OnMessageTfexRecievedEventHendler(this.BroadcastMessageBox.ReceiveTfexMessage));
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(this.TickerSlideBox.ReceiveMessage));
         frmMain._OnMessageTfexReceived = (frmMain.OnMessageTfexRecievedEventHendler)Delegate.Remove(frmMain._OnMessageTfexReceived, new frmMain.OnMessageTfexRecievedEventHendler(this.TickerSlideBox.ReceiveTfexMessage));
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(this.Smart1ClickBox.ReceiveMessage));
         frmMain._OnMessageReceived = (frmMain.OnMessageRecievedEventHendler)Delegate.Remove(frmMain._OnMessageReceived, new frmMain.OnMessageRecievedEventHendler(AlertManager.Instance.ReceiveMessage));
         frmMain._OnMessageTfexReceived = (frmMain.OnMessageTfexRecievedEventHendler)Delegate.Remove(frmMain._OnMessageTfexReceived, new frmMain.OnMessageTfexRecievedEventHendler(AlertManager.Instance.ReceiveTfexMessage));
         try
         {
             AlertManager.Instance.OnAlert -= new AlertManager.OnAlertHandler(this.OnAlert);
             AlertManager.Instance.SaveXML();
         }
         catch (Exception ex)
         {
             EventLog.WriteEntry("i2TradePlus", "SaveAlert::" + ex.Message, EventLogEntryType.Error);
         }
         if (this._alertDetailForm != null)
         {
             if (!this._alertDetailForm.IsDisposed)
             {
                 this._alertDetailForm.Dispose();
             }
             this._alertDetailForm = null;
         }
         if (this._systemOptionForm != null)
         {
             if (!this._systemOptionForm.IsDisposed)
             {
                 this._systemOptionForm.Dispose();
             }
             this._systemOptionForm = null;
         }
         this.ClearAllTemplate();
         this.SetTopPanelActive(false);
         this.SaveAppInfo();
         if (base.WindowState == FormWindowState.Maximized)
         {
             Settings.Default.Default_WindowMaximizeState = true;
             Settings.Default.Default_Bound = base.Bounds;
         }
         else if (base.WindowState != FormWindowState.Minimized)
         {
             Settings.Default.Default_WindowMaximizeState = false;
             Settings.Default.Default_Bound = base.Bounds;
         }
         Settings.Default.Default_MainScreenHeight = this._BTop;
         Settings.Default.Save();
         if (this.ViewOrderBox != null)
         {
             this.ViewOrderBox.DisposeMe();
         }
         this.SendOrderBox.DisposeMe();
         this.panelMenu.Hide();
         this.panelDockR.Hide();
         this.panBottom.Hide();
         this.CloseSpashForm();
         ExceptionManager.Close();
         if (this._isForceLogout)
         {
             this._isForceLogout = false;
             if (this._isExpire)
             {
                 MessageBox.Show("Your session has expired.", "Logout", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 MessageBox.Show("Another sign with the same user!.", "Logout", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         if (ApplicationInfo.StockAutoComp != null)
         {
             ApplicationInfo.StockAutoComp.Clear();
             ApplicationInfo.StockAutoComp = null;
         }
         if (ApplicationInfo.StockInfo != null)
         {
             ApplicationInfo.StockInfo.Items.Clear();
             ApplicationInfo.StockInfo = null;
         }
         if (ApplicationInfo.IndexStatInfo != null)
         {
             ApplicationInfo.IndexStatInfo.Items.Clear();
             ApplicationInfo.IndexStatInfo = null;
         }
         if (ApplicationInfo.TunnelHosts != null)
         {
             ApplicationInfo.TunnelHosts.Clear();
             ApplicationInfo.TunnelHosts = null;
         }
         if (ApplicationInfo.AccInfo != null)
         {
             ApplicationInfo.AccInfo.Items.Clear();
         }
         if (ApplicationInfo.FavStockList != null)
         {
             ApplicationInfo.FavStockList.Clear();
             ApplicationInfo.FavStockList = null;
         }
         base.Close();
     }
     catch (Exception ex2)
     {
         EventLog.WriteEntry("i2Trade", ex2.Message, EventLogEntryType.Error);
     }
 }
Пример #2
0
 private void InitializeFeedsWebProxy()
 {
     if (this.feedsWebProxy == null)
     {
         this.feedsWebProxy = new FeedsWebProxy();
         this.feedsWebProxy.UrlForSyncHandler = ApplicationInfo.UrlSyncHandler;
         this.feedsWebProxy.OnDataIN += new FeedsWebProxy.OnDataInHandler(this.feedsWebProxy_OnDataIN);
         this.feedsWebProxy.OnError += new FeedsWebProxy.OnErrorHandler(this.feedsWebProxy_OnError);
         this.feedsWebProxy.OnGettingHttp += new EventHandler(this.feedsWebProxy_OnGettingHttp);
         this.feedsWebProxy.OnGettedHttp += new EventHandler(this.feedsWebProxy_OnGettedHttp);
         this.feedsWebProxy.OnStoped += new EventHandler(this.feedsWebProxy_OnStoped);
         this.feedsWebProxy.OnStarted += new EventHandler(this.feedsWebProxy_OnStarted);
     }
 }