private void BeginRecordButton_Click(object sender, EventArgs e) { if (this.Root == null) { return; } try { if (this.recordModeSwitch.Value == false) { return; } if (this.Root.Recorder.IsRecording(this._currentRecordType)) { this.Root.Recorder.Stop(this._currentRecordType); this.recordTime.Visible = false; this.recordStateLabel.Visible = false; this.recordStateProgressbar.Visible = false; this.beginRecordButton.ButtonText = "녹화 시작"; } else { if (this._currentRecordType == oyo.OYORecorder.RecordingStateType.None) { throw new Exception("녹화 설정을 먼저 한 뒤에 녹화를 시작하세요."); } var directoryName = Path.GetDirectoryName(this.recordFileNameTextBox.Text); if (Directory.Exists(directoryName) == false) { throw new Exception("올바른 경로가 아닙니다."); } var success = this.Root.Recorder.Record(this._currentRecordType, this.recordFileNameTextBox.Text, this._currentResolution, 11); if (success == false) { throw new Exception("녹화를 시작할 수 없습니다. 호환성을 확인하세요."); } this.recordTime.Visible = true; this.recordStateLabel.Visible = true; this.recordStateProgressbar.Visible = true; this.beginRecordButton.ButtonText = "녹화 정지"; } } catch (Exception exc) { var dialog = new Dialog.MessageDialog(exc.Message); dialog.ShowDialog(this); } }
private void PatrolStartEndButton_Click(object sender, EventArgs e) { try { if (this.Root == null) { return; } if (this.patrolModeSwitch.Value == false) { return; } if (this.PatrolFileName == null) { throw new Exception("순찰 파일명을 설정하지 않았습니다."); } var isActive = this.patrolModeSwitch.Value; if (isActive == false) { return; } if (this.Root.Patrol.Enabled) { if (this.Root.Patrol.Mode == oyo.OYOPatrol.PatrolMode.Read) { this.Root.Patrol.Reader.Stop(); } else { this.Root.Patrol.Writer.Stop(); } this.patrolWriteTimer.Stop(); this.ElapsedTime = 0; } else { if (this.Root.Patrol.Mode == oyo.OYOPatrol.PatrolMode.Read) { this.Root.Patrol.Reader.Start(this.PatrolFileName); } else { this.Root.Patrol.Writer.Start(this.PatrolFileName); } this.patrolWriteTimer.Start(); } this.synchronizeUI(); } catch (Exception exc) { var dialog = new Dialog.MessageDialog(exc.Message); dialog.ShowDialog(this); } }