private void ShowHide() { int iHeight = m_iHeight; if (!m_bHidden) { // the form always rise in front of others, but not over // the taskbar. this.TopMost = true; //this.TopMost = false; for (int i = 0; i < iHeight; i++) { this.Top++; System.Threading.Thread.Sleep(5); } if(frmIV == null) frmIV = new frmInvisible(this); frmIV.Show(); this.Visible = false; notifyIcon1.Visible = true; m_bHidden = true; mitmMinimize.Text = "Show"; } else { // the form always rise in front of others, but not over // the taskbar. //this.TopMost = true; if(frmIV == null) frmIV = new frmInvisible(this); frmIV.Hide(); this.TopMost = false; this.Visible = true; for (int i = 0; i < iHeight; i++) { this.Top--; System.Threading.Thread.Sleep(5); } m_bHidden = false; mitmMinimize.Text = "Hide"; notifyIcon1.Visible = false; SetStartupPlace(); } }
private void tmrGeneral_Tick(object sender, System.EventArgs e) { tmrGeneral.Enabled = false; ShowHide(); frmRecordOptions frmOps = new frmRecordOptions(); if (!frmOps.CurrentRecordOptions.HasBeenSaved) { if (frmOps.ShowDialog() != System.Windows.Forms.DialogResult.OK) { Application.Exit(); return; } } mLogger.WriteLog("Displaying Login screen..."); OCL.Oyster oyster = new OCL.Oyster(frmOps.CurrentRecordOptions.DefaultOysterAddress,frmOps.CurrentRecordOptions.DefaultOysterConnectionPort); frmLogin frm = new frmLogin(ref oyster); if (frm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK) { //m_bExitWithoutAsking = true; Application.Exit(); //this.Close(); return; } m_me = frm.LoginUser; this.TopMost = true; frmIV = new frmInvisible(this); frmIV.Show(); frmIV.Hide(); }