/// <summary>
        /// TaskDialog wrapped in a CommonDialog class. THis is required to work well in
        /// MMC 2.1. In MMC 2.1 you must use the ShowDialog methods on the MMC classes to
        /// correctly show a modal dialog. This class will allow you to do this and keep access
        /// to the results of the TaskDialog.
        /// </summary>
        /// <param name="taskDialog">The TaskDialog to show.</param>
        public TaskDialogCommonDialog(TaskDialog taskDialog)
        {
            if(taskDialog == null) {
            throw new ArgumentNullException("taskDialog");
              }

              this.taskDialog = taskDialog;
        }
示例#2
0
 /// <summary>
 /// Delete the specified Episode.
 /// </summary>
 /// <param name="e">Episode to delete</param>
 private void DeleteEpisode(Episode e)
 {
     TaskDialog td = new TaskDialog();
       td.WindowTitle = Properties.Resources.TitleDelete;
       td.MainInstruction = Properties.Resources.InstrDelete;
       td.Content = Properties.Resources.NoteDelete;
       td.CommonButtons = TaskDialogCommonButtons.Cancel;
       td.Buttons = new TaskDialogButton[] {
     new TaskDialogButton(80, string.Format(Properties.Resources.DeleteOption, "\n")),
     new TaskDialogButton(81, string.Format(Properties.Resources.DeleteRerecordOption, "\n"))
       };
       td.DefaultButton = 80;
       td.PositionRelativeToWindow = true;
       td.UseCommandLinks = true;
       int btnid = td.Show(this);
       if(btnid >= 80)
     if(e.Delete(btnid == 81))
       if(_selected != null)
     if(_selected.Tag is Episode)
       if(_pnlMain.Controls.Count > 1) {
         int pos = _pnlMain.Controls.IndexOf(_selected);
         _pnlMain.Controls.Remove(_selected);
         if(pos < _pnlMain.Controls.Count)
           Select(_pnlMain.Controls[pos]);
         else
           Select(_pnlMain.Controls[pos - 1]);
       } else if(_recordings.Contains(e.Season.Show))
         ListSeasons(e.Season.Show);
       else
         ListShows();
     else
       ShowInfo(_selected.Tag);
 }
示例#3
0
 /// <summary>
 /// Show a dialog to choose a filename format with examples and available
 /// options based on the specified episode.
 /// </summary>
 /// <param name="e">Episode to determine available options and use for examples</param>
 /// <param name="plural">Whether more than one episode will be exported</param>
 /// <returns>Chosen filename format, or null if canceled</returns>
 private string AskExportFileFormat(Episode e, bool plural)
 {
     TaskDialog td = new TaskDialog();
       td.WindowTitle = plural ? Properties.Resources.TitleExportPlural : Properties.Resources.TitleExportOne;
       td.MainInstruction = Properties.Resources.InstrExport;
       td.Content = Properties.Resources.NoteExport;
       td.CommonButtons = TaskDialogCommonButtons.Cancel;
       List<TaskDialogButton> buttons = new List<TaskDialogButton>();
       if(string.IsNullOrEmpty(e.Name)) {
     buttons.Add(new TaskDialogButton(83, Properties.Resources.ExportOptionYear + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportYear, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
     buttons.Add(new TaskDialogButton(84, Properties.Resources.ExportOptionDate + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportDate, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
     buttons.Add(new TaskDialogButton(85, Properties.Resources.ExportOptionTitle + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportTitle, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
       } else {
     if(e.Season.Number > 0 && e.Number > 0)
       buttons.Add(new TaskDialogButton(80, Properties.Resources.ExportOptionSeasonEpisode + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportSeasonEpisode, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
     buttons.Add(new TaskDialogButton(81, Properties.Resources.ExportOptionDateEpisode + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportDateEpisode, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
     buttons.Add(new TaskDialogButton(82, Properties.Resources.ExportOptionEpisode + "\n" + SanitizeFilename(string.Format(Properties.Resources.ExportEpisode, e.Season.Show.Title, e.Name, e.FirstAired, e.Season.Number, e.Number))));
       }
       td.Buttons = buttons.ToArray();
       td.PositionRelativeToWindow = true;
       td.UseCommandLinks = true;
       switch(td.Show(this)) {
     case 80: return Properties.Resources.ExportSeasonEpisode;
     case 81: return Properties.Resources.ExportDateEpisode;
     case 82: return Properties.Resources.ExportEpisode;
     case 83: return Properties.Resources.ExportYear;
     case 84: return Properties.Resources.ExportDate;
     case 85: return Properties.Resources.ExportTitle;
     default: return null;
       }
 }