private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { BoothViewModel viewModel = this.DataContext as BoothViewModel; if (viewModel != null) { if (!viewModel.ClosePermanently) { e.Cancel = true; viewModel.CloseBoothWindow(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; if (b != null) { BoothViewModel vm = b.DataContext as BoothViewModel; if (vm != null) { vm.ShowBoothWindow(); } } }
private void StartButtonClick(object sender, RoutedEventArgs e) { //Start or stop collecting data BoothViewModel viewModel = this.DataContext as BoothViewModel; viewModel.IsRunning = !viewModel.IsRunning; if (viewModel.IsRunning) { viewModel.Run(); } else { viewModel.Stop(); } }
public MainWindow() { InitializeComponent(); //Get an instance of the scope manager. This should also create the first instance, //which should also configure all of the oscilloscopes. var scopeManager = ScopeManager.GetInstance(); //Start streaming on all scopes foreach (PicoScope s in scopeManager.Scopes) { //Create a view model for the booth/scope BoothViewModel vm = new BoothViewModel(s); //Add the booth/scope to the items control of this window BoothList.Items.Add(vm); } }