예제 #1
0
        public RecordingModel(Settings.Settings settings,
                              LanguageManager languageManager,
                              ISystemTray systemTray,
                              IRegionProvider regionProvider,
                              WebCamOverlay webcamOverlay,
                              IMainWindow mainWindow,
                              IPreviewWindow previewWindow,
                              VideoSourcesViewModel videoSourcesViewModel,
                              VideoWritersViewModel videoWritersViewModel,
                              AudioSource audioSource,
                              IWebCamProvider webCamProvider,
                              KeymapViewModel keymap,
                              IAudioPlayer audioPlayer,
                              IRecentList recentList,
                              TimerModel timerModel) : base(settings, languageManager)
        {
            _systemTray            = systemTray;
            _regionProvider        = regionProvider;
            _webcamOverlay         = webcamOverlay;
            _mainWindow            = mainWindow;
            _previewWindow         = previewWindow;
            _videoSourcesViewModel = videoSourcesViewModel;
            _videoWritersViewModel = videoWritersViewModel;
            _audioSource           = audioSource;
            _webCamProvider        = webCamProvider;
            _keymap      = keymap;
            _audioPlayer = audioPlayer;
            _recentList  = recentList;
            _timerModel  = timerModel;

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;

            timerModel.CountdownElapsed += InternalStartRecording;
            timerModel.DurationElapsed  += async() =>
            {
                if (_syncContext != null)
                {
                    _syncContext.Post(async state => await StopRecording(), null);
                }
                else
                {
                    await StopRecording();
                }
            };
        }
예제 #2
0
        public MainModel(Settings.Settings settings,
                         IWebCamProvider webCamProvider,
                         VideoWritersViewModel videoWritersViewModel,
                         AudioSource audioSource,
                         HotKeyManager hotKeyManager,
                         RememberByName rememberByName)
        {
            _settings              = settings;
            _webCamProvider        = webCamProvider;
            _videoWritersViewModel = videoWritersViewModel;
            _audioSource           = audioSource;
            _hotKeyManager         = hotKeyManager;
            _rememberByName        = rememberByName;

            // If Output Directory 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();
        }