Beispiel #1
0
        private void ShowShowsBtn_Click(object sender, EventArgs e)
        {
            foreach (Form frm in this.MdiChildren)
            {
                frm.Close();
            }
            ShowsForm form = new ShowsForm {
                MdiParent = this,
                Dock      = DockStyle.Fill
            };

            form.Show();
            Slider.Top    = ShowShowsBtn.Top;
            Slider.Height = ShowShowsBtn.Height;
        }
      private void InterpretShowResults(IEnumerable<Show> results, TVShowFile fileToRename)
      {
         switch (results.Count())
         {
            case 0:
               {
                  // no results... to bad..
                  // Not sure if ths code would ever get reached.
                  throw new ShowNotFoundException(String.Format("No show with the name '{0}' was found.", fileToRename.ShowName), fileToRename.ShowName);
               }
            case 1:
               {
                  // one result... use the show ID to rename the file.
                  Show show = results.First();
                  ShowsController controller = new ShowsController(fileToRename);
                  try
                  {
                     controller.Rename(show);
                  }
                  catch (EpisodeNotFoundException)
                  {
                     // TODO: Let the user know that the episode data could not be found.
                  }
                  break;
               }
            default:
               {
                  // TODO: create the ShowsFrom to display the results.
                  SetStatus(String.Format("Multiple shows with the name {0} were found. Select the intended show to continue...", fileToRename.ShowName));
                  using (ShowsForm form = new ShowsForm())
                  {
                     ShowsController controller = new ShowsController(form, fileToRename, results);
                     if (form.ShowDialog() != DialogResult.OK)
                     {
                        // TODO: error case.
                     }

                  }
                  break;
               }
         }
      }