Example #1
0
        private void BeginEditOverride()
        {
            var dataContext = this.DataContext as FanConfigViewModel;
            var viewModel   = this.overridesGrid.SelectedValue as FanSpeedOverrideViewModel;

            if (viewModel != null && dataContext != null)
            {
                var clonedViewModel = viewModel.Clone() as FanSpeedOverrideViewModel;
                clonedViewModel.Parent = dataContext;

                var dialog = new FanSpeedOverrideWindow()
                {
                    DataContext = clonedViewModel,
                    Owner       = this
                };

                if (dialog.ShowDialog() == true)
                {
                    dataContext.FanSpeedOverrides.Replace(viewModel, clonedViewModel);
                }
            }
        }
Example #2
0
        private void addOverride_Click(object sender, RoutedEventArgs e)
        {
            var dataContext = this.DataContext as FanConfigViewModel;

            if (dataContext != null)
            {
                var viewModel = new FanSpeedOverrideViewModel()
                {
                    Parent = dataContext
                };

                var dialog = new FanSpeedOverrideWindow()
                {
                    DataContext = viewModel,
                    Owner       = this
                };

                if (dialog.ShowDialog() == true)
                {
                    dataContext.FanSpeedOverrides.Add(viewModel);
                }
            }
        }
Example #3
0
        private void BeginEditOverride()
        {
            var dataContext = this.DataContext as FanConfigViewModel;
            var viewModel = this.overridesGrid.SelectedValue as FanSpeedOverrideViewModel;

            if (viewModel != null && dataContext != null)
            {
                var clonedViewModel = viewModel.Clone() as FanSpeedOverrideViewModel;
                clonedViewModel.Parent = dataContext;

                var dialog = new FanSpeedOverrideWindow()
                {
                    DataContext = clonedViewModel,
                    Owner = this
                };

                if (dialog.ShowDialog() == true)
                {
                    dataContext.FanSpeedOverrides.Replace(viewModel, clonedViewModel);
                }
            }
        }
Example #4
0
        private void addOverride_Click(object sender, RoutedEventArgs e)
        {
            var dataContext = this.DataContext as FanConfigViewModel;

            if (dataContext != null)
            {
                var viewModel = new FanSpeedOverrideViewModel()
                {
                    Parent = dataContext
                };

                var dialog = new FanSpeedOverrideWindow()
                {
                    DataContext = viewModel,
                    Owner = this
                };

                if (dialog.ShowDialog() == true)
                {
                    dataContext.FanSpeedOverrides.Add(viewModel);
                }
            }
        }