예제 #1
0
 public override void Cleanup()
 {
     if (selectedStyle != null)
     {
         selectedStyle.PropertyChanged -= SelectedStyle_PropertyChanged;
     }
     selectedStyle           = null;
     parent.PropertyChanged -= Parent_PropertyChanged;
     parent = null;
     base.Cleanup();
 }
예제 #2
0
 public SelectedStyleViewModel(StyleViewModel parent)
 {
     this.parent             = parent;
     this.selectedStyle      = parent.SelectedStyle;
     parent.PropertyChanged += Parent_PropertyChanged;
     if (selectedStyle != null)
     {
         selectedStyle.PropertyChanged += SelectedStyle_PropertyChanged;
         this.selectedIndex             = parent.Styles.IndexOf(selectedStyle);
     }
     this.Delete = new RelayCommand(() => this.parent.Delete(this.selectedStyle), () => this.selectedStyle != null);
     this.Rename = new RelayCommand(rename, () => this.newName != null);
 }