public MainWindow()
        {
            // Initialize the main controls
            InitializeComponent();

            // Add and initilize the image display
            videoDisplay = new OpenNIImageDisplay();
            Controls.Add(videoDisplay);
            videoDisplay.Size = new Size(640, 480);
            videoDisplay.Location = new Point(30, 7);

            try
            {
                kinect = new OpenNILiveStreamController();
                kinect.StartedRecording += kinect_StartedRecording;
                kinect.StoppedRecording += kinect_StoppedRecording;
            }
            catch (Exception)
            {
                kinect = null;
            }

            // Initialize tab pages and events
            tabControlVideoSources.SelectedTab = tabPageExport;

            // Initialize project directory
            // Try to load from settings
            if (Settings.Default.ProjectDirectory != null &&
                Settings.Default.ProjectDirectory != "")
            {
                projectDirectory = Settings.Default.ProjectDirectory;
            }
            else
            {
                projectDirectory =
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            // Set evaluation form
            evaluationForm = new Evaluation(videoDisplay);
            evaluationForm.VisibleChanged += new EventHandler(evaluationForm_VisibleChanged);
            buttonEvaluation.Text = BUTTON_EVALUATION_SHOW_TEXT;
            evaluationForm.EvaluationRangeChanged += new Action<int, int>(evaluationForm_EvaluationRangeChanged);

            // Initialize File system watcher
            fileSystemWatcherProjectDir.Path = projectDirectory;

            // Initialize Event system.
            fileSystemWatcherProjectDir.Changed += fileSystemWatcherProjectDir_Changed;
            videoDisplay.ErrorOccured += videoImageControl_ErrorOccured;
            tabControlVideoSources.SelectedIndexChanged += tabControlVideoSources_SelectedIndexChanged;

            // - for the TrackBar
            videoDisplay.SourceChanged += trackBarVideoImageSourceChanged;
            videoDisplay.NewRecordingFrameDisplayed += trackBarVideoUpdateValue;

            // - for the PlayButton
            videoDisplay.SourceChanged += buttonPlayImageSourceChanged;
            videoDisplay.StartedPlaying += buttonPlayStartedPlayingHandler;
            videoDisplay.StoppedPlaying += buttonPlayStoppedPlayingHandler;

            // - for the Mark Frame button
            videoDisplay.SourceChanged += buttonMarkFrameImageSourceChanged;
            evaluationForm.VisibleChanged += buttonMarkFrameEvaluationFormVisibleChanged;

            // - for the evaluation button
            videoDisplay.SourceChanged += buttonEvaluationUpdateEnabledHandler;

            // - for the export and reset button
            trackBarVideo.MarkerValueChanged += buttonExportUpdateEnabledHandler;
            evaluationForm.VisibleChanged += buttonExportUpdateEnabledHandler;
            trackBarVideo.MarkerValueChanged += buttonResetMarkersUpdateEnabledHandler;
            evaluationForm.VisibleChanged += buttonResetMarkersUpdateEnabledHandler;

            // Initialize project dir display
            updateListBoxProjectDir();

            // Initialize the export form
            exportForm.buttonCancelExport.Click += cancelCurrentExport;
        }
Exemple #2
0
        public MainWindow()
        {
            // Initialize the main controls
            InitializeComponent();

            // Add and initilize the image display
            videoDisplay = new OpenNIImageDisplay();
            Controls.Add(videoDisplay);
            videoDisplay.Size     = new Size(640, 480);
            videoDisplay.Location = new Point(30, 7);

            try
            {
                kinect = new OpenNILiveStreamController();
                kinect.StartedRecording += kinect_StartedRecording;
                kinect.StoppedRecording += kinect_StoppedRecording;
            }
            catch (Exception)
            {
                kinect = null;
            }

            // Initialize tab pages and events
            tabControlVideoSources.SelectedTab = tabPageExport;

            // Initialize project directory
            // Try to load from settings
            if (Settings.Default.ProjectDirectory != null &&
                Settings.Default.ProjectDirectory != "")
            {
                projectDirectory = Settings.Default.ProjectDirectory;
            }
            else
            {
                projectDirectory =
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            // Set evaluation form
            evaluationForm = new Evaluation(videoDisplay);
            evaluationForm.VisibleChanged         += new EventHandler(evaluationForm_VisibleChanged);
            buttonEvaluation.Text                  = BUTTON_EVALUATION_SHOW_TEXT;
            evaluationForm.EvaluationRangeChanged += new Action <int, int>(evaluationForm_EvaluationRangeChanged);

            // Initialize File system watcher
            try
            {
                fileSystemWatcherProjectDir.Path = projectDirectory;

                // Initialize Event system.
                fileSystemWatcherProjectDir.Changed += fileSystemWatcherProjectDir_Changed;
            }
            catch (Exception)
            {
                projectDirectory =
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                MessageBox.Show(this, "Project folder could not be loaded. Using Default.", "Info",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                // TODO Error handling
            }
            videoDisplay.ErrorOccured += videoImageControl_ErrorOccured;
            tabControlVideoSources.SelectedIndexChanged += tabControlVideoSources_SelectedIndexChanged;

            // - for the TrackBar
            videoDisplay.SourceChanged += trackBarVideoImageSourceChanged;
            videoDisplay.NewRecordingFrameDisplayed += trackBarVideoUpdateValue;

            // - for the PlayButton
            videoDisplay.SourceChanged  += buttonPlayImageSourceChanged;
            videoDisplay.StartedPlaying += buttonPlayStartedPlayingHandler;
            videoDisplay.StoppedPlaying += buttonPlayStoppedPlayingHandler;

            // - for the Mark Frame button
            videoDisplay.SourceChanged    += buttonMarkFrameImageSourceChanged;
            evaluationForm.VisibleChanged += buttonMarkFrameEvaluationFormVisibleChanged;

            // - for the evaluation button
            videoDisplay.SourceChanged += buttonEvaluationUpdateEnabledHandler;

            // - for the export and reset button
            trackBarVideo.MarkerValueChanged += buttonExportUpdateEnabledHandler;
            evaluationForm.VisibleChanged    += buttonExportUpdateEnabledHandler;
            trackBarVideo.MarkerValueChanged += buttonResetMarkersUpdateEnabledHandler;
            evaluationForm.VisibleChanged    += buttonResetMarkersUpdateEnabledHandler;

            // Initialize project dir display
            updateListBoxProjectDir();

            // Initialize the export form
            exportForm.buttonCancelExport.Click += cancelCurrentExport;
        }