Exemplo n.º 1
0
        private void BeginEditFanConfig()
        {
            var dc = this.DataContext as MainViewModel;
            var vm = this.fanConfigsGrid.SelectedValue as FanConfigViewModel;

            if (vm != null && dc != null)
            {
                var clonedViewModel = (FanConfigViewModel)vm.Clone();
                clonedViewModel.Parent = dc;

                var wnd = new FanConfigWindow()
                {
                    DataContext = clonedViewModel,
                    Owner       = this
                };

                EditViewModel(dc.FanConfigs, vm, wnd);
            }
        }
Exemplo n.º 2
0
        private void addFanConfig_Click(object sender, RoutedEventArgs e)
        {
            var dc = this.DataContext as MainViewModel;

            if (dc != null)
            {
                var vm = new FanConfigViewModel()
                {
                    Parent = dc
                };

                var wnd = new FanConfigWindow()
                {
                    DataContext = vm,
                    Owner       = this
                };

                AddViewModel(dc.FanConfigs, vm, wnd);
            }
        }