Beispiel #1
0
        private void BeginEditThreshold()
        {
            var dataContext = this.DataContext as FanConfigViewModel;
            var viewModel = this.thresholdsGrid.SelectedValue as TemperatureThresholdViewModel;

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

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

                if (dialog.ShowDialog() == true)
                {
                    dataContext.TemperatureThresholds.Replace(viewModel, clonedViewModel);
                }
            }
        }
Beispiel #2
0
        private void BeginEditThreshold()
        {
            var dataContext = this.DataContext as FanConfigViewModel;
            var viewModel   = this.thresholdsGrid.SelectedValue as TemperatureThresholdViewModel;

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

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

                if (dialog.ShowDialog() == true)
                {
                    dataContext.TemperatureThresholds.Replace(viewModel, clonedViewModel);
                }
            }
        }
Beispiel #3
0
        private void addThreshold_Click(object sender, RoutedEventArgs e)
        {
            var dataContext = this.DataContext as FanConfigViewModel;

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

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

                if (dialog.ShowDialog() == true)
                {
                    dataContext.TemperatureThresholds.Add(viewModel);
                }
            }
        }
Beispiel #4
0
        private void addThreshold_Click(object sender, RoutedEventArgs e)
        {
            var dataContext = this.DataContext as FanConfigViewModel;

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

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

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