private void btnOk_Click(object sender, EventArgs e) { if (tbFilesLocation.Text == string.Empty || cbFileExtensions.SelectedIndex == -1) { if (tbFilesLocation.Text == string.Empty) { lbLocation.ForeColor = Color.Red; } if (cbFileExtensions.SelectedIndex == -1) { lbFilesExtensions.ForeColor = Color.Red; } MsgBox.Show("Please specify all required import parameters!", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MoviesImportParams = new FilesImportParams { Location = tbFilesLocation.Text, FilesExtension = cbFileExtensions.Text, GenerateThumbnail = cbGenerateThumbnails.Checked, ForceAddMissingEntries = cbForceAddMissingMovies.Checked, PreserveManuallySetData = cbPreserveManuallySetData.Checked }; DialogResult = DialogResult.OK; Close(); }
private void btnOk_Click(object sender, EventArgs e) { if (tbFilesLocation.Text == string.Empty || /*tbYear.Text == string.Empty ||*/ cbFileExtensions.SelectedIndex == -1 || string.IsNullOrEmpty(tbSeason.Text)) { if (tbFilesLocation.Text == string.Empty) { lbLocation.ForeColor = Color.Red; } if (cbFileExtensions.SelectedIndex == -1) { lbFilesExtensions.ForeColor = Color.Red; } if (string.IsNullOrEmpty(tbSeason.Text)) { lbSeason.ForeColor = Color.Red; } MsgBox.Show("Please specify all required import parameters!", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var files = Directory.GetFiles(tbFilesLocation.Text, cbFileExtensions.Text); if (files.Length == 0) { MsgBox.Show("There are no files with the specified extension in the selected folder!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (MsgBox.Show(string.Format("Are you sure you want to import {0} Episodes in the selected Series?", files.Length), "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } EpisodesImportParams = new FilesImportParams { ParentId = _parentId, Location = tbFilesLocation.Text, FilesExtension = cbFileExtensions.Text, Season = tbSeason.Text, Year = tbYear.Text, GenerateThumbnail = cbGenerateThumbnails.Checked, RecordingAudio = (string)cbLanguages.SelectedValue, SkipMultiVersion = cbSkipMultiVersion.Checked }; DialogResult = DialogResult.OK; Close(); }