コード例 #1
0
        /// <summary>
        ///     Searches for files.
        /// </summary>
        private void SearchForFiles()
        {
            var files = Directory.EnumerateFiles(this.settings.StoragePath, "*.mp4").OrderByDescending(x => x);

            foreach (var file in files)
            {
                var item = new ScreenGunFileViewModel(file);
                item.RecordingDeleted += this.RemoveFile;
                this.Files.Add(item);
            }

            this.NotifyOfPropertyChange(() => this.Status);
            this.NotifyOfPropertyChange(() => this.HasAnyRecordings);
        }
コード例 #2
0
        /// <summary>
        ///     Starts the recording.
        /// </summary>
        public void StartRecording()
        {
            this.notifyIcon.HideBalloonTip();
            this.IsRecording = true;

            var fileName       = string.Format("Recording {0}.mp4", DateTime.Now.ToString("yy-MM-dd HH-mm-ss"));
            var outputFilePath = Path.Combine(this.settings.StoragePath, fileName);

            this.fileViewModel = new ScreenGunFileViewModel(outputFilePath, RecordingStage.DoingNothing);

            var opts = new ScreenRecorderOptions(this.RecordingRegion)
            {
                DeleteMaterialWhenDone     = true,
                OutputFilePath             = outputFilePath,
                RecordMicrophone           = this.UseMicrophone,
                AudioRecordingDeviceNumber = this.settings.RecordingDeviceNumber
            };

            var progress = new Progress <RecorderState>(state => this.fileViewModel.RecordingStage = state.Stage);

            this.recorder.Start(opts, progress);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RecordingCreated"/> class.
 /// </summary>
 /// <param name="file">
 /// The file.
 /// </param>
 public RecordingCreated(ScreenGunFileViewModel file)
 {
     this.File = file;
 }
コード例 #4
0
 /// <summary>
 /// Removes the file.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 private void RemoveFile(ScreenGunFileViewModel model)
 {
     this.Files.Remove(model);
     this.NotifyOfPropertyChange(() => this.Status);
     this.NotifyOfPropertyChange(() => this.HasAnyRecordings);
 }
コード例 #5
0
 /// <summary>
 /// Adds the file.
 /// </summary>
 /// <param name="file">
 /// The file.
 /// </param>
 private void AddFile(ScreenGunFileViewModel file)
 {
     this.Files.Insert(0, file);
     this.NotifyOfPropertyChange(() => this.Status);
     this.NotifyOfPropertyChange(() => this.HasAnyRecordings);
 }