Example #1
0
        private void Set()
        {
            if (m_currentTitle == null)
            {
                return;
            }

            m_currentTitle.DateModifiedUtc = GeneralPersistense.GetTimestamp();
            m_currentTitle.TitleName       = TbxTitleName.Text;
            m_currentTitle.Kind            = CbxKind.GetSelectedKey <TitleKind>();
            m_currentTitle.Year            = TbxReleaseYear.Text.To <int>(0);
            m_currentTitle.Description     = TbxDescription.Text;
            m_currentTitle.ImdbId          = TbxImdbId.Text;
            m_currentTitle.Season          = TbxSeason.Text.To <int>(0);
            m_currentTitle.Disk            = TbxDisk.Text.To <int>(0);
            m_currentTitle.EpisodeOrTrack  = TbxEpisode.Text.To <int>(0);

            GeneralPersistense.Upsert(m_currentTitle);
            SetControlsFromDirtyState(false);


            //HACK: TVTitles.Sort doesn't work
            if (!m_currentTitle.ParentTitleId.HasValue)
            {
                var roots = new List <Title>(TVTitles.Roots.Cast <Title>());
                roots.Sort();
                TVTitles.Roots = roots;
                TVTitles.EnsureModelVisible(m_currentTitle);
            }
        }
Example #2
0
        private void Reload()
        {
            var kind = GetResourceKind();

            TVTitles.ClearObjects();
            CbxKind.Items.Clear();

            BtnSave.Enabled = false;

            switch (kind)
            {
            case ResourceKind.Audio:
                TVTitles.Roots = new SortableTitles(TitlePersistence.ListRootAudio());
                CbxKind.SetupComboBox <TitleKind>("Audio_");
                break;

            case ResourceKind.Video:
                TVTitles.Roots = new SortableTitles(TitlePersistence.ListRootVideo());
                CbxKind.SetupComboBox <TitleKind>("Video_");
                break;
            }

            m_currentTitle = null;
            m_images       = null;
            m_imageIndex   = 0;
            SetImageNavigationControls();
            PbxImage.Image = null;
        }
Example #3
0
        private bool IsDirty()
        {
            if (m_currentTitle == null)
            {
                return(false);
            }

            if (TbxTitleName.Text != m_currentTitle.TitleName)
            {
                return(true);
            }
            if (CbxKind.GetSelectedKey <TitleKind>() != m_currentTitle.Kind)
            {
                return(true);
            }

            if (TbxReleaseYear.Text.To <int>(0) != m_currentTitle.Year)
            {
                return(true);
            }
            if (TbxDescription.Text != m_currentTitle.Description)
            {
                return(true);
            }
            if (TbxImdbId.Text != m_currentTitle.ImdbId)
            {
                return(true);
            }
            if (TbxSeason.Text.To <int>(0) != m_currentTitle.Season)
            {
                return(true);
            }
            if (TbxDisk.Text.To <int>(0) != m_currentTitle.Disk)
            {
                return(true);
            }
            if (TbxEpisode.Text.To <int>(0) != m_currentTitle.EpisodeOrTrack)
            {
                return(true);
            }

            return(false);
        }
Example #4
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();
            }
        }
Example #5
0
 private void CbxKind_SelectedIndexChanged(object sender, EventArgs e)
 {
     SetEpisodeControlsState(CbxKind.GetSelectedKey <TitleKind>());
     SetControlsFromDirtyState();
 }