public void CloseGui() { if (IFForm != null && GUIThread != null && GUIThread.ThreadState == ThreadState.Running) { IFForm.CloseInvoke(); GUIThread.Abort(); IFForm = null; } }
public bool StartGui() { if (IFForm == null && (GUIThread==null || GUIThread.ThreadState == ThreadState.Stopped || GUIThread.ThreadState == ThreadState.StopRequested || GUIThread.ThreadState == ThreadState.Aborted || GUIThread.ThreadState == ThreadState.AbortRequested)) { IFForm = new IndexFileForm(); GUIThread = new Thread(() => { IFForm.ShowDialog(); IFForm.CloseInvoke(); IFForm = null; }); GUIThread.Start(); return true; } else { return false; } }