Пример #1
0
 private void TimingSwitch_Click(object sender, RoutedEventArgs e)
 {
     _parent = this.FindVisualParent <Panel>();
     if (_parent != null)
     {
         _parent.Children.Remove(this);
         _timeSwitch = new TimeSwitchPlanControl();
         _timeSwitch.ViewModel.ReturnAction += BackToCurrent;
         _parent.Children.Add(_timeSwitch);
     }
 }
Пример #2
0
 private void BackToCurrent()
 {
     if (_timeSwitch != null)
     {
         _timeSwitch.ViewModel.ReturnAction -= BackToCurrent;
     }
     if (_parent != null)
     {
         _parent.Children.Remove(_timeSwitch);
         _parent.Children.Add(this);
         _timeSwitch = null;
     }
 }