示例#1
0
 private void ShowSplash(bool visible, string message)
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new frmAutoTrade.ShowSplashCallBack(this.ShowSplash), new object[]
         {
             visible,
             message
         });
     }
     else
     {
         if (this.splashForm == null)
         {
             this.splashForm = new frmSplash();
             this.splashForm.TopLevel = false;
             this.splashForm.Parent = this;
             this.splashForm.TopMost = true;
         }
         if (base.WindowState != FormWindowState.Minimized)
         {
             this.splashForm.Left = (base.Width - this.splashForm.Width) / 2;
             this.splashForm.Top = (base.Height - this.splashForm.Height) / 2;
         }
         this.splashForm.SetCurrentTask(message);
     }
 }
示例#2
0
 private void bgwLoading_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     try
     {
         if (this._loginResult == frmLogIn.LoginResult.InvalidVersion)
         {
             DialogResult dialogResult = MessageBox.Show(this._loginResultMessage, "", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
             if (dialogResult == DialogResult.Yes)
             {
                 Process.Start(ApplicationInfo.WebService.GetUrlClient());
             }
             if (this.splashForm != null)
             {
                 this.splashForm.Close();
             }
             this.txtPassword.Enabled = true;
             this.btnLogin.Enabled = true;
             return;
         }
         if (this._loginResult == frmLogIn.LoginResult.Fail)
         {
             if (this.splashForm != null)
             {
                 this.splashForm.Close();
             }
             if (this._loginResultMessage != string.Empty)
             {
                 MessageBox.Show(this._loginResultMessage);
             }
             else
             {
                 MessageBox.Show("Unknow error!!!");
             }
             this.txtPassword.Enabled = true;
             this.btnLogin.Enabled = true;
             this.txtUserID.Focus();
             this.txtUserID.SelectAll();
             return;
         }
         if (this.splashForm != null)
         {
             this.splashForm.Close();
         }
         this.txtUserID.Text = string.Empty;
         this.txtPassword.Text = string.Empty;
         this.txtPassword.Enabled = true;
         this.btnLogin.Enabled = true;
         this.txtUserID.Focus();
         this.txtUserID.SelectAll();
         this.chkSettingProxy.Checked = false;
     }
     catch (Exception ex)
     {
         this.ShowError("bgwLoading_RunWorkerCompleted", ex);
     }
     base.Hide();
     try
     {
         if (this.frm == null)
         {
             this.frm = new frmMain();
         }
         this.frm.FormClosed -= new FormClosedEventHandler(this.frmMain_FormClosed);
         this.frm.FormClosed += new FormClosedEventHandler(this.frmMain_FormClosed);
         this.frm.Show();
         if (this.splashForm != null)
         {
             this.splashForm.Close();
             this.splashForm.Dispose();
         }
         this.splashForm = null;
     }
     catch (Exception ex)
     {
         EventLog.WriteEntry("i2Trade", ex.Message, EventLogEntryType.Error);
     }
 }
示例#3
0
 private void CloseSpash()
 {
     if (this.splashForm != null)
     {
         if (this.splashForm.InvokeRequired)
         {
             this.splashForm.Invoke(new MethodInvoker(this.CloseSpash));
         }
         else
         {
             this.splashForm.Hide();
             this.splashForm.DisposeMe();
             this.splashForm = null;
         }
     }
 }
示例#4
0
 private void LoginProcessing()
 {
     try
     {
         this.txtPassword.Enabled = false;
         this.btnLogin.Enabled = false;
         this.splashForm = new frmSplash();
         this.splashForm.StartPosition = FormStartPosition.Manual;
         ApplicationInfo.IsSupportTfex = this.chbSupportTfex.Checked;
         this._userId = this.txtUserID.Text.Trim();
         Settings.Default.LastLoginId = this._userId;
         Settings.Default.RequestTfex = this.chbSupportTfex.Checked;
         if (ApplicationInfo.IsOpenFromWeb)
         {
             this._userPassword = ApplicationInfo.AuthenKey;
         }
         else
         {
             this._userPassword = this.txtPassword.Text.Trim();
         }
         if (this.chkSettingProxy.Checked)
         {
             this.SaveProxySetting();
         }
         if (this.bgwCheckProxy == null)
         {
             this.bgwCheckProxy = new BackgroundWorker();
             this.bgwCheckProxy.WorkerReportsProgress = true;
             this.bgwCheckProxy.DoWork += new DoWorkEventHandler(this.bgwCheckProxy_DoWork);
             this.bgwCheckProxy.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgwCheckProxy_RunWorkerCompleted);
         }
         if (!this.bgwCheckProxy.IsBusy)
         {
             this.bgwCheckProxy.RunWorkerAsync();
         }
     }
     catch (Exception ex)
     {
         this.ShowError("LoginProcessing", ex);
     }
 }