Example #1
0
        public void Init(bool Persist, bool Timer, bool Remembered, bool Hotkeys)
        {
            _persist = Persist;
            _hotkeys = Hotkeys;

            if (Timer)
            {
                RecordingViewModel.InitTimer();
            }

            // Register Hotkeys if not console
            if (_hotkeys)
            {
                HotKeyManager.RegisterAll();
            }

            VideoViewModel.Init();

            if (Remembered)
            {
                _remembered = true;

                _rememberByName.RestoreRemembered();
            }
        }
Example #2
0
 public HotkeyActor(ScreenShotViewModel ScreenShotViewModel,
                    RecordingViewModel RecordingViewModel,
                    Settings Settings)
 {
     _screenShotViewModel = ScreenShotViewModel;
     _recordingViewModel  = RecordingViewModel;
     _settings            = Settings;
 }
Example #3
0
 public HotkeyActor(
     RecordingViewModel RecordingViewModel,
     Settings Settings,
     VideoSourcesViewModel VideoSourcesViewModel,
     RegionSourceProvider RegionSourceProvider)
 {
     _recordingViewModel    = RecordingViewModel;
     _settings              = Settings;
     _videoSourcesViewModel = VideoSourcesViewModel;
     _regionSourceProvider  = RegionSourceProvider;
 }
Example #4
0
        public void Dispose()
        {
            RecordingViewModel.Dispose();

            if (_hotkeys)
            {
                HotKeyManager.Dispose();
            }

            AudioSource.Dispose();

            RecentViewModel.Dispose();

            // Remember things if not console.
            if (_persist)
            {
                _rememberByName.Remember();

                Settings.Save();
            }
        }
Example #5
0
        public MainViewModel(AudioSource AudioSource,
                             VideoViewModel VideoViewModel,
                             IWebCamProvider WebCamProvider,
                             Settings Settings,
                             RecentViewModel RecentViewModel,
                             LanguageManager LanguageManager,
                             HotKeyManager HotKeyManager,
                             IPreviewWindow PreviewWindow,
                             FFmpegLog FFmpegLog,
                             IDialogService DialogService,
                             RememberByName RememberByName,
                             ScreenShotViewModel ScreenShotViewModel,
                             RecordingViewModel RecordingViewModel) : base(Settings, LanguageManager)
        {
            this.AudioSource         = AudioSource;
            this.VideoViewModel      = VideoViewModel;
            this.WebCamProvider      = WebCamProvider;
            this.RecentViewModel     = RecentViewModel;
            this.HotKeyManager       = HotKeyManager;
            _dialogService           = DialogService;
            _rememberByName          = RememberByName;
            this.ScreenShotViewModel = ScreenShotViewModel;
            this.RecordingViewModel  = RecordingViewModel;
            this.FFmpegLog           = FFmpegLog;

            ShowPreviewCommand = new DelegateCommand(PreviewWindow.Show);

            #region Commands
            RefreshCommand = new DelegateCommand(OnRefresh);

            OpenOutputFolderCommand = new DelegateCommand(OpenOutputFolder);

            SelectOutputFolderCommand = new DelegateCommand(SelectOutputFolder);

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

            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;
                }
            };

            RecordingViewModel.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(RecordingViewModel.RecorderState):
                case null:
                case "":
                    RefreshCommand.RaiseCanExecuteChanged(RecordingViewModel.RecorderState == RecorderState.NotRecording);
                    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:
                    RecordingViewModel.RecordCommand.ExecuteIfCan();
                    break;

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

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

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

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

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

                case ServiceName.ToggleKeystrokes:
                    Settings.Keystrokes.Display = !Settings.Keystrokes.Display;
                    break;
                }
            };
        }
Example #6
0
        public MainViewModel(AudioSource AudioSource,
                             VideoSourcesViewModel VideoSourcesViewModel,
                             VideoWritersViewModel VideoWritersViewModel,
                             IWebCamProvider WebCamProvider,
                             Settings Settings,
                             LanguageManager LanguageManager,
                             HotKeyManager HotKeyManager,
                             IPreviewWindow PreviewWindow,
                             IDialogService DialogService,
                             RememberByName RememberByName,
                             ScreenShotViewModel ScreenShotViewModel,
                             RecordingViewModel RecordingViewModel,
                             HotkeyActionRegisterer HotkeyActionRegisterer,
                             IRecentList RecentList) : base(Settings, LanguageManager)
        {
            this.AudioSource           = AudioSource;
            this.VideoSourcesViewModel = VideoSourcesViewModel;
            this.VideoWritersViewModel = VideoWritersViewModel;
            this.WebCamProvider        = WebCamProvider;
            this.HotKeyManager         = HotKeyManager;
            _dialogService             = DialogService;
            _rememberByName            = RememberByName;
            this.ScreenShotViewModel   = ScreenShotViewModel;
            this.RecordingViewModel    = RecordingViewModel;
            _recentList = RecentList;

            ShowPreviewCommand = new DelegateCommand(PreviewWindow.Show);

            #region Commands
            RefreshCommand = new DelegateCommand(OnRefresh);

            OpenOutputFolderCommand = new DelegateCommand(OpenOutputFolder);

            SelectOutputFolderCommand = new DelegateCommand(SelectOutputFolder);

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

            TrayLeftClickCommand = new DelegateCommand(() => HotKeyManager.FakeHotkey(Settings.Tray.LeftClickAction));
            #endregion

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

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

            RecordingViewModel.PropertyChanged += (Sender, Args) =>
            {
                switch (Args.PropertyName)
                {
                case nameof(RecordingViewModel.RecorderState):
                case null:
                case "":
                    RefreshCommand.RaiseCanExecuteChanged(RecordingViewModel.RecorderState == RecorderState.NotRecording);
                    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
            HotkeyActionRegisterer.Register();
        }
Example #7
0
 public Server()
 {
     _recordingViewModel = ServiceProvider.Get <RecordingViewModel>();
 }