private void deployButton_Click(object sender, RoutedEventArgs e) {
			IMission mission = missionList.SelectedItem as IMission;
			if(mission == null){
				MessageBox.Show("A mission must be selected for this deployment.");
				return;
			}
			Settings.Default.SelectedMission = mission.Name;
			Settings.Default.Save();

			IDeployment deployment = mission.Deployments.Create(DateTime.Parse(this.dateTimeTextBox.Text), new TextRange(this.notesRichTextBox.Document.ContentStart, this.notesRichTextBox.Document.ContentEnd).Text, Devices);


			Controller controller = new Controller(ControllerIndex.One);
			DashboardWindow dashboardWindow = new DashboardWindow(mission, deployment);
			VideoDisplayWindow videoDisplayWindow;
			Thread videoDisplayThread = new Thread(new ParameterizedThreadStart(delegate (Object args){
				Object[] argArray = args as Object[];
				videoDisplayWindow = new VideoDisplayWindow(argArray[0] as IMission, argArray[1] as IDeployment);
				videoDisplayWindow.Controller = controller;
				videoDisplayWindow.Dashboard = dashboardWindow;
				dashboardWindow.VideoDisplay = videoDisplayWindow;
				videoDisplayWindow.Show();
				System.Windows.Threading.Dispatcher.Run();
			}));

			videoDisplayThread.SetApartmentState(ApartmentState.STA);
			videoDisplayThread.IsBackground = true;
			videoDisplayThread.Start(new Object[] { mission, deployment, this.Owner });
			dashboardWindow.Controller = controller;
			dashboardWindow.Show();

			showOwner = false;
			this.Close();
		}
Example #2
0
        private void deployButton_Click(object sender, RoutedEventArgs e)
        {
            IMission mission = missionList.SelectedItem as IMission;

            if (mission == null)
            {
                MessageBox.Show("A mission must be selected for this deployment.");
                return;
            }
            Settings.Default.SelectedMission = mission.Name;
            Settings.Default.Save();

            IDeployment deployment = mission.Deployments.Create(DateTime.Parse(this.dateTimeTextBox.Text), new TextRange(this.notesRichTextBox.Document.ContentStart, this.notesRichTextBox.Document.ContentEnd).Text, Devices);


            Controller         controller      = new Controller(ControllerIndex.One);
            DashboardWindow    dashboardWindow = new DashboardWindow(mission, deployment);
            VideoDisplayWindow videoDisplayWindow;
            Thread             videoDisplayThread = new Thread(new ParameterizedThreadStart(delegate(Object args){
                Object[] argArray             = args as Object[];
                videoDisplayWindow            = new VideoDisplayWindow(argArray[0] as IMission, argArray[1] as IDeployment);
                videoDisplayWindow.Controller = controller;
                videoDisplayWindow.Dashboard  = dashboardWindow;
                dashboardWindow.VideoDisplay  = videoDisplayWindow;
                videoDisplayWindow.Show();
                System.Windows.Threading.Dispatcher.Run();
            }));

            videoDisplayThread.SetApartmentState(ApartmentState.STA);
            videoDisplayThread.IsBackground = true;
            videoDisplayThread.Start(new Object[] { mission, deployment, this.Owner });
            dashboardWindow.Controller = controller;
            dashboardWindow.Show();

            showOwner = false;
            this.Close();
        }