示例#1
0
        /// <summary>
        /// BTNs the ok click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void BtnOkClick(object sender, EventArgs e)
        {
            if (chkFolderContainsMovies.Checked == false && chkFolderContainsTvShows.Checked == false)
            {
                XtraMessageBox.Show("Please select an import type");
                return;
            }

            switch (actionType)
            {
            case MediaPathActionType.Add:
                // This can probably be prettier
                foreach (var model in MediaPathDBFactory.MediaPathDB)
                {
                    if (model.MediaPath == this.editingMediaPathModel.MediaPath)
                    {
                        XtraMessageBox.Show("You can't add the same source twice!");
                        return;
                    }
                }
                MediaPathDBFactory.MediaPathDB.Add(this.editingMediaPathModel);
                break;
            }

            MediaPathDBFactory.CurrentMediaPath = this.editingMediaPathModel;

            this.Close();

            DatabaseIOFactory.Save(DatabaseIOFactory.OutputName.MediaPathDb);

            ImportFiles.ScanMediaPath(MediaPathDBFactory.CurrentMediaPath);
        }
示例#2
0
        /// <summary>
        /// Refresh the files found from the mediapaths.
        /// </summary>
        /// <param name="progress">The progress.</param>
        public static void RefreshFiles(Progress progress)
        {
            foreach (MediaPathModel mediaPath in MediaPathDB)
            {
                progress.Message = string.Format("Scanning: {0}", mediaPath.MediaPath);

                ImportFiles.ScanMediaPath(mediaPath);
            }

            progress.Message = "Scan complete. Processing";

            GeneratateUnsortedList();

            progress.Message = "Idle.";
        }
示例#3
0
        /// <summary>
        /// BTNs the ok click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void BtnOkClick(object sender, EventArgs e)
        {
            if (chkFolderContainsMovies.Checked == false && chkFolderContainsTvShows.Checked == false)
            {
                XtraMessageBox.Show("Please select an import type");
                return;
            }

            this.Close();

            if (actionType == MediaPathActionType.Add)
            {
                MediaPathDBFactory.CommitNewRecord();
            }
            else if (actionType == MediaPathActionType.Edit)
            {
                MediaPathDBFactory.CommitChangedRecord();
            }

            ImportFiles.ScanMediaPath(MediaPathDBFactory.CurrentMediaPath);
        }