Beispiel #1
0
        private void addRegisterWriteConfig_Click(object sender, RoutedEventArgs e)
        {
            var dc = this.DataContext as MainViewModel;

            if (dc != null)
            {
                var vm  = new RegisterWriteConfigViewModel();
                var wnd = new RegisterWriteConfigWindow()
                {
                    DataContext = vm,
                    Owner       = this
                };

                AddViewModel(dc.RegisterWriteConfigs, vm, wnd);
            }
        }
Beispiel #2
0
        private void BeginEditRegisterWriteConfig()
        {
            var dc = this.DataContext as MainViewModel;
            var vm = this.registerWriteConfigsGrid.SelectedValue as RegisterWriteConfigViewModel;

            if (vm != null && dc != null)
            {
                var clonedViewModel = vm.Clone() as RegisterWriteConfigViewModel;

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

                EditViewModel(dc.RegisterWriteConfigs, vm, wnd);
            }
        }