Пример #1
0
        private void tmrWatchdog_Tick(object sender, EventArgs e)
        {
            tmrWatchdog.Enabled = false;
            Process[] procs   = Process.GetProcesses();
            bool      running = false;

            foreach (Process p in procs)
            {
                if (p.ProcessName == "MediaPortal")
                {
                    running = true;
                    break;
                }
            }
            if (running)
            {
                tmrWatchdog.Enabled = true;
            }
            else
            {
                if (!File.Exists(Config.GetFile(Config.Dir.Config, "mediaportal.running")))
                {
                    Close();
                    return;
                }
                this.ShowInTaskbar = true;
                this.WindowState   = FormWindowState.Normal;
                CheckRequirements();
                EnableChoice(false);
                ExportLogsRadioButton.Checked = true;
                ProceedButton.Enabled         = true;
                if (_restoreTaskbar)
                {
                    MediaPortal.Util.Win32API.EnableStartBar(true);
                    MediaPortal.Util.Win32API.ShowStartBar(true);
                }
                if (!_restartMP)
                {
                    Utils.ErrorDlg("MediaPortal crashed unexpectedly.");
                }
                else
                {
                    CrashRestartDlg dlg = new CrashRestartDlg(_cancelDelay);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        PerformPostTestActions();
                        string  mpExe = Config.GetFolder(Config.Dir.Base) + "\\MediaPortal.exe";
                        Process mp    = new Process();
                        mp.StartInfo.FileName = mpExe;
                        mp.Start();
                        Close();
                    }
                }
            }
        }
Пример #2
0
    private void tmrWatchdog_Tick(object sender, EventArgs e)
    {
      tmrWatchdog.Enabled = false;
      Process[] procs = Process.GetProcesses();
      bool running = procs.Any(p => p.ProcessName == "MediaPortal");
      if (running)
      {
        tmrWatchdog.Enabled = true;
      }
      else
      {
        if (!File.Exists(Config.GetFile(Config.Dir.Config, "mediaportal.running")))
        {
          Close();
          return;
        }
        ShowInTaskbar = true;
        WindowState = FormWindowState.Normal;
        CheckRequirements();
        EnableChoice(false);
        ExportLogsRadioButton.Checked = true;
        ProceedButton.Enabled = true;

        if (_restoreTaskbar)
        {
          MediaPortal.Util.Win32API.EnableStartBar(true);
          MediaPortal.Util.Win32API.ShowStartBar(true);
        }

        if (!_restartMP)
        {
          Utils.ErrorDlg("MediaPortal crashed unexpectedly.");
        }
        else
        {
          var dlg = new CrashRestartDlg(_cancelDelay);
          if (dlg.ShowDialog() == DialogResult.OK)
          {
            PerformPostTestActions();
            string mpExe = Config.GetFolder(Config.Dir.Base) + "\\MediaPortal.exe";
            var mp = new Process {StartInfo = {FileName = mpExe}};
            mp.Start();
            Close();
          }
        }
      }
    }
Пример #3
0
 private void tmrWatchdog_Tick(object sender, EventArgs e)
 {
   tmrWatchdog.Enabled = false;
   Process[] procs = Process.GetProcesses();
   bool running = false;
   foreach (Process p in procs)
   {
     if (p.ProcessName == "MediaPortal")
     {
       running = true;
       break;
     }
   }
   if (running)
   {
     tmrWatchdog.Enabled = true;
   }
   else
   {
     if (!File.Exists(Config.GetFile(Config.Dir.Config, "mediaportal.running")))
     {
       Close();
       return;
     }
     this.ShowInTaskbar = true;
     this.WindowState = FormWindowState.Normal;
     CheckRequirements();
     EnableChoice(false);
     ExportLogsRadioButton.Checked = true;
     ProceedButton.Enabled = true;
     if (!_restartMP)
     {
       Utils.ErrorDlg("MediaPortal crashed unexpectedly.");
     }
     else
     {
       CrashRestartDlg dlg = new CrashRestartDlg(_cancelDelay);
       if (dlg.ShowDialog() == DialogResult.OK)
       {
         PerformPostTestActions();
         string mpExe = Config.GetFolder(Config.Dir.Base) + "\\MediaPortal.exe";
         Process mp = new Process();
         mp.StartInfo.FileName = mpExe;
         mp.Start();
         Close();
       }
     }
   }
 }