public MainWindow() { InitializeComponent(); //Load the config file JawBoothConfiguration.GetInstance().LoadConfigurationFile(); //Have the user select a booth BoothSelectionUI booth_selection_window = new BoothSelectionUI(); booth_selection_window.ShowDialog(); //Get the result of the booth selection string port_name = string.Empty; BoothSelectorViewModel booth_selection_result = BoothSelectorViewModel.GetInstance(); if (booth_selection_result.ResultOK && booth_selection_result.AvailablePortCount > 0) { port_name = booth_selection_result.AvailablePorts[booth_selection_result.SelectedPortIndex].Model.DeviceID; } if (!string.IsNullOrEmpty(port_name)) { //Set the data context DataContext = new SessionViewModel(port_name); } else { //Close the main window and exit the program if no booth was selected this.Close(); } }
public BoothSelectionUI() { InitializeComponent(); BoothSelectorViewModel viewModel = BoothSelectorViewModel.GetInstance(); DataContext = viewModel; }