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