void DoViewVerifyResult(bool bOpenWindow) { // string strError = ""; // 优化,避免无谓地进行服务器调用 if (bOpenWindow == false) { if (this.MainForm.PanelFixedVisible == false && (m_verifyViewer == null || m_verifyViewer.Visible == false)) return; } if (this.m_verifyViewer == null || (bOpenWindow == true && this.m_verifyViewer.Visible == false)) { m_verifyViewer = new VerifyViewerForm(); MainForm.SetControlFont(m_verifyViewer, this.Font, false); // m_viewer.MainForm = this.MainForm; // 必须是第一句 m_verifyViewer.Text = "校验结果"; m_verifyViewer.ResultString = this.m_strVerifyResult; m_verifyViewer.DoDockEvent -= new DoDockEventHandler(m_viewer_DoDockEvent); m_verifyViewer.DoDockEvent += new DoDockEventHandler(m_viewer_DoDockEvent); m_verifyViewer.FormClosed -= new FormClosedEventHandler(m_viewer_FormClosed); m_verifyViewer.FormClosed += new FormClosedEventHandler(m_viewer_FormClosed); m_verifyViewer.Locate -= new LocateEventHandler(m_viewer_Locate); m_verifyViewer.Locate += new LocateEventHandler(m_viewer_Locate); } if (bOpenWindow == true) { if (m_verifyViewer.Visible == false) { this.MainForm.AppInfo.LinkFormState(m_verifyViewer, "verify_viewer_state"); m_verifyViewer.Show(this); m_verifyViewer.Activate(); this.MainForm.CurrentVerifyResultControl = null; } else { if (m_verifyViewer.WindowState == FormWindowState.Minimized) m_verifyViewer.WindowState = FormWindowState.Normal; m_verifyViewer.Activate(); } } else { if (m_verifyViewer.Visible == true) { } else { if (this.MainForm.CurrentVerifyResultControl != m_verifyViewer.ResultControl) m_verifyViewer.DoDock(false); // 不会自动显示FixedPanel } } return; /* ERROR1: MessageBox.Show(this, "DoViewVerifyResult() 出错: " + strError); * */ }
void CloseVerifyViewer() { if (m_verifyViewer != null) { if (this.MainForm != null && this.MainForm.CurrentVerifyResultControl == m_verifyViewer.ResultControl) { // 避免多重拥有。方便后面的 Dispose() this.MainForm.CurrentVerifyResultControl = null; } this.m_verifyViewer.DisposeFreeControls(); this.m_verifyViewer = null; } }
void m_viewer_FormClosed(object sender, FormClosedEventArgs e) { if (m_verifyViewer != null) { if (this.MainForm != null && this.MainForm.AppInfo != null) this.MainForm.AppInfo.UnlinkFormState(m_verifyViewer); this.m_verifyViewer = null; } }