Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool StartRecording
- {
- get
- {
- return startrecording;
- }
- set
- {
- if (RecordingInOperation)
- {
- StopRecording = true;
- }
- startrecording = value;
- if (Directory.Exists(DirectoryPath.Substring(0, DirectoryPath.IndexOf("\") + 1)) && value && !this.StopRecording)
- {
- try
- {
- job = new ScreenCaptureJob();
- Rectangle Resolution = Screen.AllScreens[ScreenID].Bounds;
- int offset = 0;
- for (int i = 0; i < ScreenID; i++)
- {
- offset += Screen.AllScreens[i].Bounds.Width;
- }
- job.ScreenCaptureVideoProfile.Quality = this.Quality;
- job.ScreenCaptureVideoProfile.FrameRate = this.FrameRate;
- ConstantBitrate b = new ConstantBitrate(this.BitRate);
- job.ScreenCaptureVideoProfile.Bitrate = b;
- // Sets the top right coordinates of the capture rectangle
- int topRightX = offset;
- int topRightY = 0;
- // Sets the bottom left coordinates of the capture rectangle
- int BottomLeftX = topRightX + Resolution.Width;
- int BottomLeftY = topRightY + Resolution.Height;
- //job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
- job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
- job.ScreenCaptureVideoProfile.AutoFit = true;
- job.ShowFlashingBoundary = false;
- job.OutputScreenCaptureFileName = DirectoryPath + @"" + FileNamePrefix + "_" + DateTime.Now.ToString("yyyyMMdd_hhmmss") + ".xesc";
- job.Start();
- startTim = DateTime.Now;
- recording = true;
- try
- {
- RecordingStatusChanged();
- }
- catch (Exception)
- {
- }
- }
- catch (Exception)
- {
- throw;
- }
- this.StartRecording = false;
- }
- }
- }
- public bool StopRecording
- {
- get
- {
- return stoprecording;
- }
- set
- {
- stoprecording = value;
- if (value && !this.StartRecording)
- {
- try
- {
- recording = false;
- job.Stop();
- try
- {
- RecordingStatusChanged();
- }
- catch (Exception)
- {
- }
- }
- catch(Exception)
- {
- throw;
- }
- this.StopRecording = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement