public void Execute(object parameter) { // record button clicked if (parameter != null) { recordingInfo = new RecordingInfo { Name = System.IO.Path.GetRandomFileName().Replace(".", string.Empty), Location = @Properties.Settings.Default.SaveLocation, Width = viewModel.MainWindowModel.Width, Height = viewModel.MainWindowModel.Height }; // begin the countdown counter = new SettingsModel().CountdownSecond; counterCurrent = counter; notificationBalloon = Notification.Instance.ShowNotificationBalloon("Press " + new SettingsModel().HotKeyAsString + " stop process.", "Process starting...", counter * 1000 + 2000); notificationModel = (notificationBalloon.DataContext as NotificationViewModel).Model; countdownTimer = new Timer { Interval = 1000 }; countdownTimer.Elapsed += CountdownTimerEvent; countdownTimer.Start(); // Making selection click-through viewModel.MainWindowModel.Foreground = "#00000000"; viewModel.MainWindowModel.Background = "#00000000"; viewModel.MainWindowModel.RecordButton.IsVisible = false; } // contextmenu item dorecord clicked else { if (viewModel.MainWindowModel.IsRecording) { Stop(); return; } if (viewModel.MainWindowModel.SelectionVisibility == Visibility.Hidden) { viewModel.ShowSelection(); } else { viewModel.HideSelection(); } } }
public SettingsViewModel() { Settings = new SettingsModel(); Settings.RecorderList = new List<SettingsRecorderListModel> { new SettingsRecorderListModel("VLC (broken)", "VLCRecorder", false), new SettingsRecorderListModel("FFMPEG (default, faster)", "FFMPEGRecorder") }; Settings.HotkeyList = new List<AvailableHotkeyModel> { new AvailableHotkeyModel("NONE"), new AvailableHotkeyModel("CTRL"), new AvailableHotkeyModel("ALT"), new AvailableHotkeyModel("SHIFT"), new AvailableHotkeyModel("WIN") }; BrowseSaveLocationCommand = new BrowseSaveLocation(this); SaveSettingsCommand = new SaveSettings(this); }
private void RegisterStopHotkey() { // Global Stop Hotkey HotKey hk = new SettingsModel().HotKey; recorderHotKey = hk; recorderHotKey.HotKeyPressed += k => Stop(); }