RemoveGrowthCurveCommand.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Input;
  6. using Aitex.UI.Charting.ViewModel;
  7. using System.Windows;
  8. using Aitex.UI.Charting.Model;
  9. using Abt.Controls.SciChart;
  10. using System.Windows.Media;
  11. using DataAnalysisControl.Core;
  12. namespace Aitex.UI.Charting.Command
  13. {
  14. public class RemoveGrowthCurveCommand : ICommand
  15. {
  16. public bool CanExecute(object parameter)
  17. {
  18. return true;
  19. }
  20. #pragma warning disable 0067
  21. public event EventHandler CanExecuteChanged;
  22. #pragma warning restore 0067
  23. private void AsyncShowWarningMessageBox(string message, string title)
  24. {
  25. Application.Current.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Warning)));
  26. }
  27. public void Execute(object parameter)
  28. {
  29. string reason = string.Empty;
  30. try
  31. {
  32. var commonViewModel = (CommonViewModel)parameter;
  33. if (commonViewModel.RenderableSeries.Contains(commonViewModel.GrowthRateRenderableSeries))
  34. commonViewModel.RenderableSeries.Remove(commonViewModel.GrowthRateRenderableSeries);
  35. }
  36. catch (Exception ex)
  37. {
  38. CONTEXT.WriteLog(ex);
  39. }
  40. }
  41. }
  42. }