/// <summary> /// Occurs when clicked. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The event.</param> private void _OnChangeEpisode(object sender, RoutedEventArgs e) { // Initialize the input. string Input = InputView.ShowDialog(this, "Episode Mutation"); // Initialize the value. int Current, Value; // Parse the input to value and check for success. if (int.TryParse(Input, out Value)) { // Iterate through each selected item. foreach (object Item in DataGrid.SelectedItems) { // Initialize the file model. FileModel FileModel = (FileModel)Item; // Parse the episode number to current and check for success. if (int.TryParse(FileModel.EpisodeNumber, out Current)) { // Set the episode number. FileModel.EpisodeNumber = (Current + Value).ToString("00.####"); } } // Refresh the items. DataGrid.Items.Refresh(); // Focus the data grid. DataGrid.Focus(); } }
/// <summary> /// Show an input view as dialog. /// </summary> /// <param name="Owner">The owner.</param> /// <param name="Title">The title.</param> public static string ShowDialog(Window Owner, string Title) { // Initialize a new instance of the InputView class. InputView InputView = new InputView(Title); // Set the owner. InputView.Owner = Owner; // Show the dialog. InputView.ShowDialog(); // Return the result. return(InputView.Result); }
/// <summary> /// Occurs when clicked. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The event.</param> private void _OnChangeTranslationGroup(object sender, RoutedEventArgs e) { // Initialize the input. string Input = InputView.ShowDialog(this, "Translation Group"); // Iterate through each selected item. foreach (object Item in DataGrid.SelectedItems) { // Initialize the file model. FileModel FileModel = (FileModel)Item; // Set the translation group. FileModel.TranslationGroup = Input; } // Refresh the items. DataGrid.Items.Refresh(); // Focus the data grid. DataGrid.Focus(); }