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;
        }
Exemple #3
0
        /// <summary>
        /// Gets the one and only instance of this class that is allowed to exist.
        /// </summary>
        /// <returns>Instance of ArdyMotorBoard class</returns>
        public static BoothSelectorViewModel GetInstance()
        {
            if (_instance == null)
            {
                _instance = new BoothSelectorViewModel();
            }

            return(_instance);
        }
        private void OK_Button_Click(object sender, RoutedEventArgs e)
        {
            BoothSelectorViewModel vm = DataContext as BoothSelectorViewModel;

            if (vm != null)
            {
                vm.ResultOK = true;
            }

            //Close the port selector window
            this.Close();
        }