Пример #1
0
        private void btnAddMovieToCollection_Click(object sender, EventArgs e)
        {
            if (!Utils.Helpers.ConfirmDiscardChanges())
            {
                return;
            }

            var selectedNodeData = (SeriesEpisodesShortInfo)tvCollections.SelectedNode.Tag;
            var frmAddMovie      = new FrmAddMovie(selectedNodeData.IsEpisode ? selectedNodeData.SeriesId : selectedNodeData.Id)
            {
                Owner = _parent
            };

            if (frmAddMovie.ShowDialog() != DialogResult.OK)
            {
                Helpers.UnsavedChanges = false;
                return;
            }

            var sesi         = (SeriesEpisodesShortInfo)tvCollections.SelectedNode.Tag;
            var collectionId =
                tvCollections.SelectedNode.Level == 1
                    ? sesi.Id
                    : sesi.SeriesId;

            ReloadTreeView(collectionId, DAL.CurrentMTD.Id);
            tvCollections.SelectedNode.ExpandAll();

            LoadSelectionDetails();
        }
Пример #2
0
        private void AddMovie(object sender, EventArgs e)
        {
            if (!Utils.Helpers.ConfirmDiscardChanges())
            {
                return;
            }

            var frmAddMovie = new FrmAddMovie {
                Owner = _parent
            };

            if (frmAddMovie.ShowDialog() != DialogResult.OK)
            {
                Helpers.UnsavedChanges = false;
                return;
            }

            var msi = new MovieShortInfo
            {
                Id       = DAL.CurrentMTD.Id,
                FileName = DAL.CurrentMTD.FileName,
                //Cover = DAL.CurrentMTD.Poster,
                HasPoster   = DAL.CurrentMTD.Poster != null,
                HasSynopsis = !string.IsNullOrEmpty(DAL.CurrentMTD.Synopsis)
            };

            DAL.MoviesData.Add(msi);
            DAL.MoviesData = new BindingList <MovieShortInfo>(DAL.MoviesData.OrderBy(o => o.FileName).ToList());
            RefreshGrid();

            FocusCurrentMovieInGrid(msi);
        }