/// <summary> /// 録画形式のコンボボックスをセットする /// </summary> /// <param name="lpv"></param> private void setComboBoxValue(LapsVideo lpv) { if (lpv.Video_codec == AForge.Video.FFMPEG.VideoCodec.Raw) { CB_extension.SelectedIndex = 0; } else if (lpv.Video_codec == AForge.Video.FFMPEG.VideoCodec.MPEG4) { CB_extension.SelectedIndex = 1; } if (lpv.recordMode == LapsVideo.RecordMode.normal) { comboBox_recordMode.SelectedIndex = 0; } else if (lpv.recordMode == LapsVideo.RecordMode.MotionDetection) { comboBox_recordMode.SelectedIndex = 1; } else if (lpv.recordMode == LapsVideo.RecordMode.MotionDetection_Lite) { comboBox_recordMode.SelectedIndex = 2; } else if (lpv.recordMode == LapsVideo.RecordMode.MotionDetection_VeryLite) { comboBox_recordMode.SelectedIndex = 3; } }
/// <summary> /// lapsVideoに設定されている情報をセットする /// </summary> /// <param name="lpv">接続しているLapsVideoコンポ―ネント</param> public void InitializeUI(LapsVideo lpv) { this.lpv = lpv; // UI 初期化 txtBox_interval.Text = lpv.interval.ToString(); textBox_fps.Text = lpv.frameRate.ToString(); trackBar_quality.Value = lpv.quantity; // MotionDetectionの閾値設定 try { float tval = (int)(Math.Pow(lpv.motionRecordThreshold, 1 / 4) * 1414.2); if (tval < trackBar_MotionThrethold.Minimum) { tval = trackBar_MotionThrethold.Minimum; } if (tval > trackBar_MotionThrethold.Maximum) { tval = trackBar_MotionThrethold.Maximum; } trackBar_MotionThrethold.Value = (int)(Math.Pow(lpv.motionRecordThreshold, 1.0 / 4.0) * 1414.2); } catch { trackBar_MotionThrethold.Value = trackBar_MotionThrethold.Minimum; } setComboBoxValue(lpv); // 日時焼き込みの設定項目 checkBox_insert_dateTime.Checked = lpv.insert_time; try { trackBar_process_timeScale.Value = (int)(lpv.insert_time_scale * 100.0f) + 1; } catch { trackBar_process_timeScale.Value = 5; } float val = trackBar_quality.Value / 10f; label_qualityvalue.Text = val.ToString("F1") + "%"; label_bitrate.Text = Form1.kgmConvert(lpv.MaxBitRate * val / 100.0) + "bps(about)"; val = (float)(Math.Pow((float)trackBar_MotionThrethold.Value / 1414.2, 4)); label_motionThrethold.Text = (val * 100f).ToString("F4") + "%"; Update_LbInfo(); }
public setBoundForm(LapsVideo lpv, Screen setScreen) { this.StartPosition = FormStartPosition.Manual; this.Location = setScreen.Bounds.Location; ActivScreen = setScreen; InitializeComponent(); this.lpv = lpv; pictureBox1.Size = ActivScreen.Bounds.Size; Console.Write(pictureBox1.Size); bmp = new Bitmap(pictureBox1.Width, pictureBox1.Height); }
// --------------- // ========================= public Form1() { InitializeComponent(); Screen sc = Screen.FromControl(this); lapsVideo = new LapsVideo(sc); Config_read(); // 録画中のUI更新サブプロセス lapsTimer = new System.Timers.Timer(); lapsTimer.Elapsed += new ElapsedEventHandler(recordVideo_UI_update); lapsTimer.AutoReset = true; lapsTimer.Interval = 1000; // UI初期化 stop_rec.Enabled = false; toolStripStatusLabel_worn.Text = ""; recordingTimer = new Stopwatch(); label_recTime.Text = "00.00:00:00"; label_videoTime.Text = "00.00:00:00"; label_videoSize.Text = "0B"; //スリープにしないための処理のサブプロセス SleepDeterrence = new System.Timers.Timer(); SleepDeterrence.Elapsed += new ElapsedEventHandler(sleepDeterrence); SleepDeterrence.AutoReset = true; SleepDeterrence.Interval = 30000; sleeped_in_recording = false; SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); activeateItemsEndRecord(); }