Exemple #1
0
 private void BtnDeleteTitle_Click(object sender, EventArgs e)
 {
     if (m_currentTitle == null)
     {
         return;
     }
     if (MessageBox.Show("Do you want to delete " + m_currentTitle.TitleName + "?", "Confirm Title Removal", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         try
         {
             if (m_images != null)
             {
                 foreach (var img in m_images)
                 {
                     MediaSamplePersistence.RemoveSample(img);
                 }
             }
             TitlePersistence.DeleteTitle(m_currentTitle.Id);
             TVTitles.RemoveObject(m_currentTitle);
             DisplayTitleInfo(null);
         }
         catch (Exception err)
         {
             MessageBox.Show(err.Message, "Error Deleting Title");
         }
     }
 }
Exemple #2
0
 private void BtnDeleteImage_Click(object sender, EventArgs e)
 {
     if (m_images == null || CheckForChanges())
     {
         return;
     }
     if (m_imageIndex >= m_images.Count)
     {
         return;
     }
     if (MessageBox.Show("Are you sure you want to delete current image?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         MediaSamplePersistence.RemoveSample(m_images[m_imageIndex]);
         m_images.RemoveAt(m_imageIndex);
         if (m_imageIndex >= m_images.Count)
         {
             m_imageIndex--;
         }
         if (m_imageIndex < 0)
         {
             m_imageIndex = 0;
         }
         DisplayImage();
     }
 }
Exemple #3
0
        private void SetTitle(TmdbResult searchResult)
        {
            if (m_currentTitle == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(searchResult.ImdbId))
            {
                //TODO: make it async
                (new Wait((cts) => searchResult.GetMore(cts.Token), "Retrieving additional info: {0} seconds elapsed")).ShowDialog();
            }
            m_currentTitle.DateModifiedUtc = GeneralPersistense.GetTimestamp();
            if (CbxOverrideDescription.Checked && !string.IsNullOrWhiteSpace(searchResult.Overview))
            {
                m_currentTitle.Description = searchResult.Overview;
            }
            if (CbxOverrideTitle.Checked && !string.IsNullOrWhiteSpace(searchResult.Title))
            {
                m_currentTitle.TitleName = searchResult.Title;
            }
            if (CbxOverrideYear.Checked && searchResult.ReleaseDate.HasValue)
            {
                m_currentTitle.Year = searchResult.ReleaseDate.Value.Year;
            }
            if (!string.IsNullOrWhiteSpace(searchResult.ImdbId))
            {
                m_currentTitle.ImdbId = searchResult.ImdbId;
            }


            /*StoredItem.SeasonPersistence,
            *  StoredItem.DiskPersistence,
            *  StoredItem.EpisodePersistence*/

            if (m_currentTitle.TitleName == null)
            {
                m_currentTitle.TitleName = "";
            }
            GeneralPersistense.Upsert(m_currentTitle);

            if (searchResult.Poster != null && searchResult.Poster.Length > 0)
            {
                MediaSamplePersistence.AddSample(searchResult.Poster, m_currentTitle.Id, MediaSampleKind.Image, Path.GetExtension(searchResult.PosterPath));
            }
        }
Exemple #4
0
        private void BtnAddImage_Click(object sender, EventArgs e)
        {
            var ofd = new OpenFileDialog();

            ofd.Filter           = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
            ofd.FilterIndex      = 0;
            ofd.RestoreDirectory = true;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                byte[] data = File.ReadAllBytes(ofd.FileName);
                var    img  = MediaSamplePersistence.AddSample(data, m_currentTitle.Id, MediaSampleKind.Image, Path.GetExtension(ofd.FileName));
                m_images.Add(img);
                m_imageIndex = m_images.Count - 1;
                DisplayImage();
            }
        }
Exemple #5
0
        private void DisplayTitleInfo(Title title)
        {
            m_currentTitle = title;
            LVLocations.ClearObjects();
            LVRatings.ClearObjects();
            m_imageIndex = 0;

            if (title != null)
            {
                TbxReleaseYear.Text = title.Year.ToString("##");
                TbxDescription.Text = title.Description;
                TbxImdbId.Text      = title.ImdbId;
                TbxSeason.Text      = title.Season.ToString("##");
                TbxDisk.Text        = title.Disk.ToString("##");
                TbxEpisode.Text     = title.EpisodeOrTrack.ToString("##");

                TbxTitleName.Text = title.TitleName;
                CbxKind.SetSelectedKey(title.Kind);

                LVLocations.AddObjects(LocationPersistence.ListTitleLocations(title.Id));
                LVRatings.AddObjects(TitlePersistence.GetRatings(title.Id));
                SetEpisodeControlsState(m_currentTitle.Kind);
                m_images = MediaSamplePersistence.GetSamples(title.Id, MediaSampleKind.Image);
                DisplayImage();
            }
            else
            {
                TbxReleaseYear.Text = "";
                TbxDescription.Text = "";
                TbxImdbId.Text      = "";
                TbxSeason.Text      = "";
                TbxDisk.Text        = "";
                TbxEpisode.Text     = "";

                TbxTitleName.Text     = "";
                CbxKind.SelectedIndex = -1;
                SetEpisodeControlsState(TitleKind.Title);
                m_images = null;
                SetImageNavigationControls();
                PbxImage.Clear();
            }
        }