public void ShowDialog()
 {
     if (handler == null)
         return;
     handler.OnTaskProgress += setProgress;
     handler.OnTaskCompleted += handler_OnTaskCompleted;
     closeProgDialog();
     dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
     if (dlgPrgrs != null)
     {
         dlgPrgrs.Reset();
         dlgPrgrs.DisplayProgressBar = true;
         dlgPrgrs.ShowWaitCursor = false;
         dlgPrgrs.DisableCancel(true);
         dlgPrgrs.SetHeading(string.IsNullOrEmpty(handler.TaskName) ? MP1Utils.Options.ReadOption(o => o.PluginDisplayName) : handler.TaskName);
         dlgPrgrs.SetLine(1, "");
         dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
     }
     else
     {
         GUIWaitCursor.Init(); GUIWaitCursor.Show();
     }
     if (!handler.Start())
     {
         closeProgDialog();
         return;
     }
 }
Exemplo n.º 2
0
    private void UpdateMediaInfoInFolder(GUIListItem item)
    {
      List<GUIListItem> itemlist = new List<GUIListItem>();

      ListFilesForUpdateMediaInfo(item, ref itemlist);
      Log.Debug("UpdateMediaInfoInFolder: File count {0}", itemlist.Count);

      _progressDialogForUpdateMediaInfo =
       (GUIDialogProgress)GUIWindowManager.GetWindow(101); //(int)Window.WINDOW_DIALOG_PROGRESS
      _progressDialogForUpdateMediaInfo.Reset();
      _progressDialogForUpdateMediaInfo.SetHeading(GUILocalizeStrings.Get(2160));
      _progressDialogForUpdateMediaInfo.ShowProgressBar(true);
      _progressDialogForUpdateMediaInfo.SetLine(1, item.Path.Replace("\\", "/"));
      _progressDialogForUpdateMediaInfo.SetLine(2, string.Empty);
      _progressDialogForUpdateMediaInfo.SetLine(3, "Movie count: " + itemlist.Count + "/0");
      _progressDialogForUpdateMediaInfo.StartModal(GUIWindowManager.ActiveWindow);

      if (_refreshMediaInfoThread != null && _refreshMediaInfoThread.IsAlive)
      {
        _refreshMediaInfoThread.Abort();
      }

      _refreshMediaInfoThreadAbort = false;
      _refreshMediaInfoThread = new Thread(RefreshMediaInfoThread);
      _refreshMediaInfoThread.Priority = ThreadPriority.Lowest;
      _refreshMediaInfoThread.IsBackground = true;
      _refreshMediaInfoThread.Name = "RefreshMediaInfoThread";
      _refreshMediaInfoThread.Start(itemlist);
    }