コード例 #1
0
        public IVideoFileWriter GetVideoFileWriter(VideoWriterArgs args)
        {
            _previewWindow.Show();

            return(new DiscardWriter());
        }
コード例 #2
0
        public MainViewModel(AudioSource AudioSource,
                             VideoViewModel VideoViewModel,
                             ISystemTray SystemTray,
                             IRegionProvider RegionProvider,
                             IWebCamProvider WebCamProvider,
                             WebcamOverlay WebcamOverlay,
                             IMainWindow MainWindow,
                             Settings Settings,
                             RecentViewModel RecentViewModel,
                             LanguageManager LanguageManager,
                             HotKeyManager HotKeyManager,
                             CustomOverlaysViewModel CustomOverlays,
                             CustomImageOverlaysViewModel CustomImageOverlays,
                             IPreviewWindow PreviewWindow,
                             CensorOverlaysViewModel CensorOverlays,
                             FFmpegLog FFmpegLog,
                             IDialogService DialogService) : base(Settings, LanguageManager)
        {
            this.AudioSource         = AudioSource;
            this.VideoViewModel      = VideoViewModel;
            _systemTray              = SystemTray;
            _regionProvider          = RegionProvider;
            this.WebCamProvider      = WebCamProvider;
            _webcamOverlay           = WebcamOverlay;
            _mainWindow              = MainWindow;
            this.RecentViewModel     = RecentViewModel;
            this.HotKeyManager       = HotKeyManager;
            this.CustomOverlays      = CustomOverlays;
            this.CustomImageOverlays = CustomImageOverlays;
            _previewWindow           = PreviewWindow;
            _dialogService           = DialogService;
            this.CensorOverlays      = CensorOverlays;
            this.FFmpegLog           = FFmpegLog;

            ShowPreviewCommand = new DelegateCommand(() => _previewWindow.Show());

            #region Commands
            ScreenShotCommand = new DelegateCommand(() => CaptureScreenShot());

            ScreenShotActiveCommand = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.ForegroundWindow)));

            ScreenShotDesktopCommand = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.DesktopWindow)));

            RecordCommand = new DelegateCommand(OnRecordExecute);

            RefreshCommand = new DelegateCommand(OnRefresh);

            PauseCommand = new DelegateCommand(OnPauseExecute, false);

            OpenOutputFolderCommand = new DelegateCommand(OpenOutputFolder);

            SelectOutputFolderCommand = new DelegateCommand(SelectOutputFolder);

            ResetFFmpegFolderCommand = new DelegateCommand(() => Settings.FFmpeg.FolderPath = "");
            #endregion

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;

            Settings.Audio.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(Settings.Audio.Enabled):
                case null:
                case "":
                    CheckFunctionalityAvailability();
                    break;
                }
            };

            VideoViewModel.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(VideoViewModel.SelectedVideoSourceKind):
                case nameof(VideoViewModel.SelectedVideoSource):
                case null:
                case "":
                    CheckFunctionalityAvailability();
                    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
            Settings.EnsureOutPath();

            // Handle Hoykeys
            HotKeyManager.HotkeyPressed += Service =>
            {
                switch (Service)
                {
                case ServiceName.Recording:
                    RecordCommand?.ExecuteIfCan();
                    break;

                case ServiceName.Pause:
                    PauseCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ScreenShot:
                    ScreenShotCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ActiveScreenShot:
                    ScreenShotActiveCommand?.ExecuteIfCan();
                    break;

                case ServiceName.DesktopScreenShot:
                    ScreenShotDesktopCommand?.ExecuteIfCan();
                    break;

                case ServiceName.ToggleMouseClicks:
                    Settings.Clicks.Display = !Settings.Clicks.Display;
                    break;

                case ServiceName.ToggleKeystrokes:
                    Settings.Keystrokes.Display = !Settings.Keystrokes.Display;
                    break;
                }
            };
        }
コード例 #3
0
 private void HandleShowPreview()
 {
     previewWindow.Show();
 }