public HotkeySetup(HotkeyActionRegisterer HotkeyActionRegisterer, HotKeyManager HotKeyManager) { _hotkeyActionRegisterer = HotkeyActionRegisterer; _hotKeyManager = HotKeyManager; }
MainViewModel() { _timer = new Timer(1000); _timer.Elapsed += TimerOnElapsed; #region Commands ScreenShotCommand = new DelegateCommand(CaptureScreenShot); RecordCommand = new DelegateCommand(() => { if (RecorderState == RecorderState.NotRecording) { StartRecording(); } else { StopRecording(); } }); RefreshCommand = new DelegateCommand(() => { VideoViewModel.RefreshVideoSources(); VideoViewModel.RefreshCodecs(); AudioViewModel.AudioSource.Refresh(); Status = "Refreshed"; }); OpenOutputFolderCommand = new DelegateCommand(() => { EnsureOutPath(); Process.Start(Settings.OutPath); }); PauseCommand = new DelegateCommand(() => { if (RecorderState == RecorderState.Paused) { _recorder.Start(); _timer.Start(); RecorderState = RecorderState.Recording; Status = "Recording..."; } else { _recorder.Stop(); _timer.Stop(); RecorderState = RecorderState.Paused; Status = "Paused"; SystemTrayManager.ShowNotification("Recording Paused", " ", 500, null); } }, false); SelectOutputFolderCommand = new DelegateCommand(() => { var dlg = new FolderBrowserDialog { SelectedPath = Settings.OutPath, Description = "Select Output Folder" }; if (dlg.ShowDialog() == DialogResult.OK) { Settings.OutPath = dlg.SelectedPath; } }); #endregion //Populate Available Codecs, Audio and Video Sources ComboBoxes RefreshCommand.Execute(null); AudioViewModel.AudioSource.PropertyChanged += (Sender, Args) => { if (Args.PropertyName == nameof(AudioViewModel.AudioSource.SelectedRecordingSource) || Args.PropertyName == nameof(AudioViewModel.AudioSource.SelectedLoopbackSource)) { CheckFunctionalityAvailability(); } }; VideoViewModel.PropertyChanged += (Sender, Args) => { if (Args.PropertyName == nameof(VideoViewModel.SelectedVideoSource)) { CheckFunctionalityAvailability(); } }; _cursor = new MouseCursor(Settings.IncludeCursor); Settings.PropertyChanged += (Sender, Args) => { switch (Args.PropertyName) { case nameof(Settings.IncludeCursor): _cursor.Include = Settings.IncludeCursor; break; } }; // If Output Dircetory is not set. Set it to Documents\Captura\ if (string.IsNullOrWhiteSpace(Settings.OutPath)) { Settings.OutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Captura\\"); } // Create the Output Directory if it does not exist if (!Directory.Exists(Settings.OutPath)) { Directory.CreateDirectory(Settings.OutPath); } HotKeyManager.RegisterAll(); SystemTrayManager.Init(); }
public HotkeySetup(HotKeyManager HotKeyManager, IMessageProvider MessageProvider) { _hotKeyManager = HotKeyManager; _messageProvider = MessageProvider; }