Пример #1
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            CounterEditor w = new CounterEditor();
            PerfCounter   c = new PerfCounter {
                Duration = 5
            };

            w.ViewModel.SetPerfCounter(c);
            if (w.ShowDialog() == true)
            {
                PerfCounter nc = w.ViewModel.GetPerfCounter();
                this.Counters.Add(nc);
                this.countersGrid.SelectedItem = nc;
            }
        }
Пример #2
0
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.countersGrid.SelectedItem == null)
            {
                return;
            }

            CounterEditor w = new CounterEditor();
            PerfCounter   c = (PerfCounter)this.countersGrid.SelectedItem;

            w.ViewModel.SetPerfCounter(c);
            if (w.ShowDialog() == true)
            {
                PerfCounter nc = w.ViewModel.GetPerfCounter();
                this.Counters.Remove(c);
                this.Counters.Add(nc);
                this.countersGrid.SelectedItem = nc;
            }
        }
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.countersGrid.SelectedItem == null)
                return;

            CounterEditor w = new CounterEditor();
            PerfCounter c = (PerfCounter)this.countersGrid.SelectedItem;
            w.ViewModel.SetPerfCounter(c);
            if (w.ShowDialog() == true)
            {
                PerfCounter nc = w.ViewModel.GetPerfCounter();
                this.Counters.Remove(c);
                this.Counters.Add(nc);
                this.countersGrid.SelectedItem = nc;
            }
        }
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     CounterEditor w = new CounterEditor();
     PerfCounter c = new PerfCounter { Duration = 5 };
     w.ViewModel.SetPerfCounter(c);
     if (w.ShowDialog() == true)
     {
         PerfCounter nc = w.ViewModel.GetPerfCounter();
         this.Counters.Add(nc);
         this.countersGrid.SelectedItem = nc;
     }
 }