예제 #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);
                }
            }
        }
예제 #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);
                }
            }
        }
예제 #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);
                }
            }
        }
예제 #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);
                }
            }
        }