Guest User

Untitled

a guest
Nov 18th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. public class StartGUI
  2. {
  3. [CommandMethod("startplagin")]
  4. public static void StartPlagin()
  5. {
  6. MainView mainView = new MainView();
  7. autoDSK.ShowModelessWindow(mainView);
  8. mainView.DataContext = new ViewModel.MainViewModel();
  9. }
  10. }
  11.  
  12. public class MainViewModel:INotifyPropertyChanged
  13. {
  14.  
  15. #region PropertyChangedEventHandler
  16. /// <summary>
  17. /// Метод проверяющий изменилось ли свойство
  18. /// </summary>
  19. public event PropertyChangedEventHandler PropertyChanged;
  20. protected virtual void OnPropertyChanged(string propertyName)
  21. {
  22. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  23. }
  24. #endregion
  25.  
  26.  
  27.  
  28. private ShowLayersViewModel _showLayers;
  29. private ColorPickerViewModel _colorPicker;
  30. private string _visibleColorPicker;
  31.  
  32. public MainViewModel()
  33. {
  34. ColorPicker = new ColorPickerViewModel();
  35. ShowLayers = new ShowLayersViewModel();
  36.  
  37. //ColorPicker.VisibleColorPicker = "Collapsed";
  38.  
  39. VisibleColorPicker = "Collapsed";
  40. ClickCommandVisible = new Command(arg =>
  41. {
  42. VisibleColorPicker = "Collapsed";
  43. });
  44. }
  45.  
  46. public ShowLayersViewModel ShowLayers
  47. {
  48. get { return _showLayers; }
  49. set { _showLayers = value; OnPropertyChanged("ShowLayers");}
  50. }
  51.  
  52. public ColorPickerViewModel ColorPicker
  53. {
  54. get { return _colorPicker; }
  55. set { _colorPicker = value; OnPropertyChanged("ColorPicker"); }
  56. }
  57.  
  58. public string VisibleColorPicker
  59. {
  60. get { return _visibleColorPicker; }
  61. set { _visibleColorPicker = value; OnPropertyChanged("VisibleColorPicker"); }
  62. }
  63.  
  64.  
  65.  
  66. public ICommand ClickCommandVisible { get; set; }
  67. }
  68.  
  69. <Grid>
  70. <Grid.RowDefinitions>
  71. <RowDefinition Height="25" />
  72. <RowDefinition Height="150" />
  73. <RowDefinition Height="Auto" />
  74. </Grid.RowDefinitions>
  75. <Button Grid.Row="0" Command="{Binding ClickCommandVisible}" />
  76. <userControls:ShowLayers Grid.Row="1" DataContext="{Binding ShowLayers}" />
  77. <userControls:ColorPicker
  78. Grid.Row="2"
  79. DataContext="{Binding ColorPicker}"
  80. Visibility="{Binding VisibleColorPicker}" />
  81. </Grid>
Add Comment
Please, Sign In to add comment