/// <summary> /// Executes the New command. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">ExecutedRoutedEventArgs instance with information about the event.</param> private void NewExecuted(object sender, ExecutedRoutedEventArgs e) { if (this.currentIcon != null && this.currentIcon.Images.Count > 0 && this.modified) { if (MessageBox.Show(this, "Icon has not been saved. Create a new icon?", "Icon Maker", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { this.currentIcon = new IconFile(); this.imageList.ItemsSource = this.currentIcon.Images; this.modified = false; } } }
/// <summary> /// Executes the Delete command. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">ExecutedRoutedEventArgs instance with information about the event.</param> private void DeleteExecuted(object sender, ExecutedRoutedEventArgs e) { var image = this.imageList.SelectedItem as BitmapSource; if (image != null) { if (this.currentIcon == null) { this.currentIcon = new IconFile(); this.imageList.ItemsSource = this.currentIcon.Images; } this.currentIcon.Images.Remove(image); this.modified = true; } }
/// <summary> /// Executes the New command. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">ExecutedRoutedEventArgs instance with information about the event.</param> private void NewExecuted(object sender, ExecutedRoutedEventArgs e) { if(this.currentIcon != null && this.currentIcon.Images.Count > 0 && this.modified) { if(MessageBox.Show(this, "Icon has not been saved. Create a new icon?", "Icon Maker", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { this.currentIcon = new IconFile(); this.imageList.ItemsSource = this.currentIcon.Images; this.modified = false; } } }
/// <summary> /// Executes the Delete command. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">ExecutedRoutedEventArgs instance with information about the event.</param> private void DeleteExecuted(object sender, ExecutedRoutedEventArgs e) { var image = this.imageList.SelectedItem as BitmapSource; if(image != null) { if(this.currentIcon == null) { this.currentIcon = new IconFile(); this.imageList.ItemsSource = this.currentIcon.Images; } this.currentIcon.Images.Remove(image); this.modified = true; } }