private void InitComponent(string mainDir, string projectName, string videoPath, string subjectName, ExportVideoInfo MexportVideoInfo, ExportVideoInfo GexportVideoInfo)
        {
            cb_exportVideo_codec.ItemsSource      = Enum.GetValues(typeof(VideoCodec));
            cb_exportVideo_codec.SelectedIndex    = 0;
            pb_exportVideo_processbar.Value       = 0;
            tooltip_exportVideo_processbar.Text   = "0";
            bt_cancelExportVideo_export.IsEnabled = false;
            if (File.Exists(videoPath))
            {
                //Set BackgroundWorker
                _bgWorker.WorkerReportsProgress      = true;
                _bgWorker.WorkerSupportsCancellation = true;
                _bgWorker.DoWork             += bgWorker_DoWork;
                _bgWorker.ProgressChanged    += bgWorker_ProgressChanged;
                _bgWorker.RunWorkerCompleted += bgWorker_RunWorkerCompleted;

                //Set Variables
                _mainDir          = mainDir;
                _projectName      = projectName;
                _sourceVideoPath  = videoPath;
                _subjectName      = subjectName;
                _MexportVideoInfo = MexportVideoInfo;
                _GexportVideoInfo = GexportVideoInfo;
                _saveFolder       = _mainDir + @"\" + _projectName + @"\ProcessVideo";
                tb_exportVideo_savefolder.Text = _saveFolder;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Can't find the video!", "ERROR");
                this.Close();
            }
        }
        public ExportVideo(string mainDir, string projectName, string videoPath, string subjectName, ExportVideoInfo MexportVideoInfo, ExportVideoInfo GexportVideoInfo)
        {
            InitializeComponent();

            InitComponent(mainDir, projectName, videoPath, subjectName, MexportVideoInfo, GexportVideoInfo);
        }
        private void bt_replay_exportVideo_Click(object sender, RoutedEventArgs e)
        {
            //_replayControl.FileOpen_Click();
            string          userName  = this._replayInfo[cb_replay_videoName.SelectedIndex].userName;
            string          videoPath = this._replayInfo[cb_replay_videoName.SelectedIndex].videoPath;
            ExportVideoInfo mevinfo   = new ExportVideoInfo();
            ExportVideoInfo gevinfo   = new ExportVideoInfo();

            if (bt_toolbar_mouse_track.Background == Brushes.Gray)
            {
                mevinfo.isTrackVisible = true;
            }
            if (bt_toolbar_mouse_cursor.Background == Brushes.Gray)
            {
                mevinfo.isCursorVisible = true;
            }
            if (bt_toolbar_mouse_cursor_circle.Background == Brushes.Gray)
            {
                mevinfo.isCircleVisible = true;
            }
            if (bt_toolbar_mouse_fixation.Background == Brushes.Gray)
            {
                mevinfo.isFixationVisible = true;
            }
            if (bt_toolbar_mouse_scanpath.Background == Brushes.Gray)
            {
                mevinfo.isPathVisible = true;
            }
            if (bt_toolbar_mouse_fixationID.Background == Brushes.Gray)
            {
                mevinfo.isFixationIDVisible = true;
            }
            mevinfo.TrackPenWidth      = (int)iud_toolbar_mouse_track_linewidth.Value;
            mevinfo.CirclePenWidth     = (int)iud_toolbar_mouse_cursor_circle_linewidth.Value;
            mevinfo.FixationPenWidth   = (int)iud_toolbar_mouse_fixation_linewidth.Value;
            mevinfo.PathPenWidth       = (int)iud_toolbar_mouse_scanpath_linewidth.Value;
            mevinfo.TrackPenColor      = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_mouse_track_colorpicker.Text);
            mevinfo.CirclePenColor     = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_mouse_cursor_circle_colorpicker.Text);
            mevinfo.FixationPenColor   = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_mouse_fixation_colorpicker.Text);
            mevinfo.PathPenColor       = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_mouse_scanpath_colorpicker.Text);
            mevinfo.FixationIDPenColor = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_mouse_fixationID_colorpicker.Text);
            if (bt_toolbar_mouse_track_type.Content.ToString() == "D")
            {
                mevinfo.TrackType = 1;
            }
            mevinfo.FixationRate         = (int)iud_toolbar_mouse_fixation_rate.Value;
            mevinfo.BrowserToolbarHeight = (int)iud_toolbar_mouse_browsertoolbarHeight.Value;


            if (bt_toolbar_eye_track.Background == Brushes.Gray)
            {
                gevinfo.isTrackVisible = true;
            }
            if (bt_toolbar_eye_cursor.Background == Brushes.Gray)
            {
                gevinfo.isCursorVisible = true;
            }
            if (bt_toolbar_eye_cursor_circle.Background == Brushes.Gray)
            {
                gevinfo.isCircleVisible = true;
            }
            if (bt_toolbar_eye_fixation.Background == Brushes.Gray)
            {
                gevinfo.isFixationVisible = true;
            }
            if (bt_toolbar_eye_scanpath.Background == Brushes.Gray)
            {
                gevinfo.isPathVisible = true;
            }
            if (bt_toolbar_eye_fixationID.Background == Brushes.Gray)
            {
                gevinfo.isFixationIDVisible = true;
            }
            gevinfo.TrackPenWidth      = (int)iud_toolbar_eye_track_linewidth.Value;
            gevinfo.CirclePenWidth     = (int)iud_toolbar_eye_cursor_circle_linewidth.Value;
            gevinfo.FixationPenWidth   = (int)iud_toolbar_eye_fixation_linewidth.Value;
            gevinfo.PathPenWidth       = (int)iud_toolbar_eye_scanpath_linewidth.Value;
            gevinfo.TrackPenColor      = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_eye_track_colorpicker.Text);
            gevinfo.CirclePenColor     = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_eye_cursor_circle_colorpicker.Text);
            gevinfo.FixationPenColor   = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_eye_fixation_colorpicker.Text);
            gevinfo.PathPenColor       = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_eye_scanpath_colorpicker.Text);
            gevinfo.FixationIDPenColor = System.Drawing.ColorTranslator.FromHtml(tb_toolbar_eye_fixationID_colorpicker.Text);
            if (bt_toolbar_eye_track_type.Content.ToString() == "D")
            {
                gevinfo.TrackType = 1;
            }
            gevinfo.FixationRate         = (int)iud_toolbar_eye_fixation_rate.Value;
            gevinfo.BrowserToolbarHeight = (int)iud_toolbar_eye_browsertoolbarHeight.Value;

            new ExportVideo(_mainDir, _projectName, videoPath, userName, mevinfo, gevinfo).Show();
        }