Exemplo n.º 1
0
        public ScreenShotModel(VideoSourcesViewModel VideoSourcesViewModel,
                               ISystemTray SystemTray,
                               IRegionProvider RegionProvider,
                               IMainWindow MainWindow,
                               IVideoSourcePicker SourcePicker,
                               IAudioPlayer AudioPlayer,
                               IEnumerable <IImageWriterItem> ImageWriters,
                               Settings Settings,
                               ILocalizationProvider Loc,
                               IPlatformServices PlatformServices,
                               WebcamModel WebcamModel)
        {
            _videoSourcesViewModel = VideoSourcesViewModel;
            _systemTray            = SystemTray;
            _regionProvider        = RegionProvider;
            _mainWindow            = MainWindow;
            _sourcePicker          = SourcePicker;
            _audioPlayer           = AudioPlayer;
            _settings         = Settings;
            _loc              = Loc;
            _platformServices = PlatformServices;
            _webcamModel      = WebcamModel;

            AvailableImageWriters = ImageWriters.ToList();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }
        }
Exemplo n.º 2
0
        public RecordingViewModel(Settings Settings,
                                  LanguageManager LanguageManager,
                                  CustomOverlaysViewModel CustomOverlays,
                                  CustomImageOverlaysViewModel CustomImageOverlays,
                                  CensorOverlaysViewModel CensorOverlays,
                                  ISystemTray SystemTray,
                                  IRegionProvider RegionProvider,
                                  WebcamOverlay WebcamOverlay,
                                  IMainWindow MainWindow,
                                  IPreviewWindow PreviewWindow,
                                  VideoViewModel VideoViewModel,
                                  AudioSource AudioSource,
                                  RecentViewModel RecentViewModel,
                                  IWebCamProvider WebCamProvider) : base(Settings, LanguageManager)
        {
            this.CustomOverlays      = CustomOverlays;
            this.CustomImageOverlays = CustomImageOverlays;
            this.CensorOverlays      = CensorOverlays;
            _systemTray      = SystemTray;
            _regionProvider  = RegionProvider;
            _webcamOverlay   = WebcamOverlay;
            _mainWindow      = MainWindow;
            _previewWindow   = PreviewWindow;
            _videoViewModel  = VideoViewModel;
            _audioSource     = AudioSource;
            _recentViewModel = RecentViewModel;
            _webCamProvider  = WebCamProvider;

            RecordCommand = new DelegateCommand(OnRecordExecute);

            PauseCommand = new DelegateCommand(OnPauseExecute, false);

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
        }
Exemplo n.º 3
0
 public RememberByName(Settings Settings,
                       VideoViewModel VideoViewModel,
                       AudioSource AudioSource,
                       IRegionProvider RegionProvider,
                       IWebCamProvider WebCamProvider,
                       ScreenShotViewModel ScreenShotViewModel,
                       // ReSharper disable SuggestBaseTypeForParameter
                       ScreenSourceProvider ScreenSourceProvider,
                       WindowSourceProvider WindowSourceProvider,
                       RegionSourceProvider RegionSourceProvider,
                       NoVideoSourceProvider NoVideoSourceProvider,
                       DeskDuplSourceProvider DeskDuplSourceProvider
                       // ReSharper restore SuggestBaseTypeForParameter
                       )
 {
     _settings               = Settings;
     _videoViewModel         = VideoViewModel;
     _audioSource            = AudioSource;
     _regionProvider         = RegionProvider;
     _webCamProvider         = WebCamProvider;
     _screenShotViewModel    = ScreenShotViewModel;
     _screenSourceProvider   = ScreenSourceProvider;
     _windowSourceProvider   = WindowSourceProvider;
     _regionSourceProvider   = RegionSourceProvider;
     _noVideoSourceProvider  = NoVideoSourceProvider;
     _deskDuplSourceProvider = DeskDuplSourceProvider;
 }
Exemplo n.º 4
0
        public ScreenShotModel(VideoSourcesViewModel videoSourcesViewModel,
                               ISystemTray systemTray,
                               IRegionProvider regionProvider,
                               IMainWindow mainWindow,
                               IVideoSourcePicker sourcePicker,
                               IAudioPlayer audioPlayer,
                               IEnumerable <IImageWriterItem> imageWriters,
                               Settings.Settings settings,
                               LanguageManager loc,
                               IPlatformServices platformServices)
        {
            _videoSourcesViewModel = videoSourcesViewModel;
            _systemTray            = systemTray;
            _regionProvider        = regionProvider;
            _mainWindow            = mainWindow;
            _sourcePicker          = sourcePicker;
            _audioPlayer           = audioPlayer;
            _settings         = settings;
            _loc              = loc;
            _platformServices = platformServices;

            AvailableImageWriters = imageWriters.ToList();

            if (!AvailableImageWriters.Any(imageWriterItem => imageWriterItem.Active))
            {
                AvailableImageWriters[0].Active = true;
            }
        }
Exemplo n.º 5
0
        public ScreenShotModel(VideoSourcesViewModel VideoSourcesViewModel,
                               ISystemTray SystemTray,
                               IRegionProvider RegionProvider,
                               IMainWindow MainWindow,
                               IVideoSourcePicker SourcePicker,
                               IAudioPlayer AudioPlayer,
                               IEnumerable <IImageWriterItem> ImageWriters,
                               Settings Settings,
                               LanguageManager Loc)
        {
            _videoSourcesViewModel = VideoSourcesViewModel;
            _systemTray            = SystemTray;
            _regionProvider        = RegionProvider;
            _mainWindow            = MainWindow;
            _sourcePicker          = SourcePicker;
            _audioPlayer           = AudioPlayer;
            _settings = Settings;
            _loc      = Loc;

            AvailableImageWriters = ImageWriters.ToList();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }
        }
Exemplo n.º 6
0
        public void Init()
        {
            RegionProvider = ServiceProvider.Get <IRegionProvider>(ServiceName.RegionProvider);

            // Check if there are multiple Screens
            if (ScreenItem.Count > 1)
            {
                AvailableVideoSourceKinds.Add(new ObjectLocalizer <VideoSourceKind>(VideoSourceKind.Screen, nameof(Resources.Screen)));
            }

            // Check if SharpAvi is available
            if (ServiceProvider.FileExists("SharpAvi.dll"))
            {
                AvailableVideoWriterKinds.Add(VideoWriterKind.SharpAvi);

                SelectedVideoWriterKind = VideoWriterKind.SharpAvi;
            }

            // Check if FFMpeg is available
            RefreshFFMpeg();

            RefreshCodecs();

            RefreshVideoSources();

            ServiceProvider.FFMpegPathChanged += RefreshFFMpeg;

            RegionProvider.SelectorHidden += () =>
            {
                if (SelectedVideoSourceKind == VideoSourceKind.Region)
                {
                    SelectedVideoSourceKind = VideoSourceKind.Window;
                }
            };
        }
Exemplo n.º 7
0
        public VideoViewModel(IRegionProvider RegionProvider,
                              IEnumerable <IImageWriterItem> ImageWriters,
                              Settings Settings,
                              LanguageManager LanguageManager,
                              FullScreenSourceProvider FullScreenProvider,
                              IIconSet Icons,
                              // ReSharper disable SuggestBaseTypeForParameter
                              ScreenSourceProvider ScreenSourceProvider,
                              WindowSourceProvider WindowSourceProvider,
                              RegionSourceProvider RegionSourceProvider,
                              NoVideoSourceProvider NoVideoSourceProvider,
                              DeskDuplSourceProvider DeskDuplSourceProvider,
                              FFmpegWriterProvider FFmpegWriterProvider,
                              SharpAviWriterProvider SharpAviWriterProvider,
                              GifWriterProvider GifWriterProvider,
                              StreamingWriterProvider StreamingWriterProvider,
                              DiscardWriterProvider DiscardWriterProvider
                              // ReSharper restore SuggestBaseTypeForParameter
                              ) : base(Settings, LanguageManager)
        {
            this.NoVideoSourceProvider = NoVideoSourceProvider;

            AvailableVideoWriters = new ReadOnlyObservableCollection <IVideoWriterItem>(_videoWriters);

            AvailableImageWriters = new ReadOnlyObservableCollection <IImageWriterItem>(_imageWriters);

            _regionProvider     = RegionProvider;
            _fullScreenProvider = FullScreenProvider;

            VideoSources.Add(new VideoSourceModel(NoVideoSourceProvider, nameof(Loc.OnlyAudio), NoVideoDescription, Icons.Video));
            VideoSources.Add(new VideoSourceModel(FullScreenProvider, nameof(Loc.FullScreen), FullScreenDescription, Icons.MultipleMonitor));
            VideoSources.Add(new VideoSourceModel(ScreenSourceProvider, nameof(Loc.Screen), ScreenDescription, Icons.Screen));
            VideoSources.Add(new VideoSourceModel(WindowSourceProvider, nameof(Loc.Window), WindowDescription, Icons.Window));
            VideoSources.Add(new VideoSourceModel(RegionSourceProvider, nameof(Loc.Region), RegionDescription, Icons.Region));

            if (Windows8OrAbove)
            {
                VideoSources.Add(new VideoSourceModel(DeskDuplSourceProvider, "Desktop Duplication", DeskDuplDescription, Icons.Game));
            }

            VideoWriterProviders.Add(FFmpegWriterProvider);
            VideoWriterProviders.Add(GifWriterProvider);
            VideoWriterProviders.Add(SharpAviWriterProvider);
            VideoWriterProviders.Add(StreamingWriterProvider);
            VideoWriterProviders.Add(DiscardWriterProvider);

            foreach (var imageWriter in ImageWriters)
            {
                _imageWriters.Add(imageWriter);
            }

            SetDefaultSource();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }

            SelectedVideoWriterKind = FFmpegWriterProvider;
        }
Exemplo n.º 8
0
        public ScreenShotViewModel(VideoViewModel VideoViewModel,
                                   RecentViewModel RecentViewModel,
                                   ISystemTray SystemTray,
                                   LanguageManager Loc,
                                   Settings Settings,
                                   IRegionProvider RegionProvider,
                                   IMainWindow MainWindow,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImgurWriter ImgurWriter,
                                   IVideoSourcePicker SourcePicker) : base(Settings, Loc)
        {
            _videoViewModel      = VideoViewModel;
            _recentViewModel     = RecentViewModel;
            _systemTray          = SystemTray;
            _regionProvider      = RegionProvider;
            _mainWindow          = MainWindow;
            _sourcePicker        = SourcePicker;
            this.DiskWriter      = DiskWriter;
            this.ClipboardWriter = ClipboardWriter;
            this.ImgurWriter     = ImgurWriter;

            ScreenShotCommand = new DelegateCommand(() => CaptureScreenShot());

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

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

            ScreenshotRegionCommand = new DelegateCommand(async() => await ScreenshotRegion());

            ScreenshotWindowCommand = new DelegateCommand(async() => await ScreenshotWindow());

            ScreenshotScreenCommand = new DelegateCommand(async() => await ScreenshotScreen());
        }
Exemplo n.º 9
0
        public RecordingViewModel(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) : 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;

            RecordCommand = new DelegateCommand(OnRecordExecute);

            PauseCommand = new DelegateCommand(OnPauseExecute, false);

            SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
        }
Exemplo n.º 10
0
 public DealController(IDealProvider dealProvider, IMapper mapper, IDealObjectProvider dealObjectProvider, IUserProvider userProvider, IRegionProvider regionProvider)
 {
     _dealProvider       = dealProvider;
     _mapper             = mapper;
     _dealObjectProvider = dealObjectProvider;
     _userProvider       = userProvider;
     _regionProvider     = regionProvider;
 }
Exemplo n.º 11
0
        public RegionSourceProvider(
            IRegionProvider RegionProvider,
            IIconSet Icons) : base()
        {
            _regionProvider = RegionProvider;

            Source = RegionProvider.VideoSource;
            Icon   = Icons.Region;
        }
Exemplo n.º 12
0
        public WindowSourceProvider(LanguageManager Loc,
                                    IVideoSourcePicker VideoSourcePicker,
                                    IRegionProvider RegionProvider,
                                    IIconSet Icons) : base(Loc)
        {
            _videoSourcePicker = VideoSourcePicker;
            _regionProvider    = RegionProvider;

            Icon = Icons.Window;
        }
Exemplo n.º 13
0
 public UserController(ISessionProvider sessionProvider, IHashGenerator hashGenerator, IUserManager userManager, IUserProvider userProvider,
                       IRegionProvider regionProvider, IMapper mapper)
 {
     _sessionProvider = sessionProvider;
     _hashGenerator   = hashGenerator;
     _userManager     = userManager;
     _userProvider    = userProvider;
     _regionProvider  = regionProvider;
     _mapper          = mapper;
 }
        public RegionService()
        {
            // 创建对象构建器(Spring.NET)
            string springObjectFile = RegionsConfigurationView.Instance.Configuration.Keys["SpringObjectFile"].Value;

            SpringObjectBuilder objectBuilder = SpringObjectBuilder.Create(RegionsConfiguration.ApplicationName, springObjectFile);

            // 创建数据提供器
            this.provider = objectBuilder.GetObject <IRegionProvider>(typeof(IRegionProvider));
        }
Exemplo n.º 15
0
        public RegionSourceProvider(LanguageManager loc,
                                    IRegionProvider regionProvider,
                                    IIconSet icons) : base(loc)
        {
            _regionProvider = regionProvider;

            Source = regionProvider.VideoSource;
            Icon   = icons.Region;

            regionProvider.SelectorHidden += RequestUnselect;
        }
Exemplo n.º 16
0
        public RegionSourceProvider(ILocalizationProvider Loc,
                                    IRegionProvider RegionProvider,
                                    IVideoSourcePicker VideoSourcePicker,
                                    IIconSet Icons) : base(Loc)
        {
            _videoSourcePicker = VideoSourcePicker;
            _regionProvider    = RegionProvider;

            Source = RegionProvider.VideoSource;
            Icon   = Icons.Region;
        }
Exemplo n.º 17
0
        public RegionSourceProvider(LanguageManager Loc,
                                    IRegionProvider RegionProvider,
                                    IIconSet Icons) : base(Loc)
        {
            _regionProvider = RegionProvider;

            Source = RegionProvider.VideoSource;
            Icon   = Icons.Region;

            RegionProvider.SelectorHidden += RequestUnselect;
        }
Exemplo n.º 18
0
        public WindowSourceProvider(LanguageManager Loc,
                                    IVideoSourcePicker VideoSourcePicker,
                                    IRegionProvider RegionProvider,
                                    IIconSet Icons,
                                    IPlatformServices PlatformServices) : base(Loc)
        {
            _videoSourcePicker = VideoSourcePicker;
            _regionProvider    = RegionProvider;
            _platformServices  = PlatformServices;

            Icon = Icons.Window;
        }
Exemplo n.º 19
0
        public WindowSourceProvider(LanguageManager loc,
                                    IVideoSourcePicker videoSourcePicker,
                                    IRegionProvider regionProvider,
                                    IIconSet icons,
                                    IPlatformServices platformServices) : base(loc)
        {
            _videoSourcePicker = videoSourcePicker;
            _regionProvider    = regionProvider;
            _platformServices  = platformServices;

            Icon = icons.Window;
        }
Exemplo n.º 20
0
        public RegionSourceProvider(ILocalizationProvider Loc,
                                    IRegionProvider RegionProvider,
                                    IVideoSourcePicker VideoSourcePicker,
                                    IIconSet Icons) : base(Loc)
        {
            _videoSourcePicker = VideoSourcePicker;
            _regionProvider    = RegionProvider;

            Source = RegionProvider.VideoSource;
            Icon   = Icons.Region;

            RegionProvider.SelectorHidden += RequestUnselect;
        }
Exemplo n.º 21
0
        public RegionSourceProvider(ILocalizationProvider Loc,
                                    IRegionProvider RegionProvider,
                                    IIconSet Icons,
                                    IPlatformServices PlatformServices) : base(Loc)
        {
            _regionProvider   = RegionProvider;
            _platformServices = PlatformServices;

            Source = RegionProvider.VideoSource;
            Icon   = Icons.Region;

            RegionProvider.SelectorHidden += RequestUnselect;
        }
Exemplo n.º 22
0
 public RememberByName(Settings Settings,
                       VideoViewModel VideoViewModel,
                       AudioSource AudioSource,
                       IRegionProvider RegionProvider,
                       IWebCamProvider WebCamProvider,
                       ScreenShotViewModel ScreenShotViewModel)
 {
     _settings            = Settings;
     _videoViewModel      = VideoViewModel;
     _audioSource         = AudioSource;
     _regionProvider      = RegionProvider;
     _webCamProvider      = WebCamProvider;
     _screenShotViewModel = ScreenShotViewModel;
 }
Exemplo n.º 23
0
        public VideoViewModel(IRegionProvider RegionProvider,
                              IEnumerable <IImageWriterItem> ImageWriters,
                              IEnumerable <IVideoWriterProvider> VideoWriterProviders,
                              IEnumerable <IVideoSourceProvider> VideoSourceProviders,
                              Settings Settings,
                              LanguageManager LanguageManager) : base(Settings, LanguageManager)
        {
            AvailableVideoWriterKinds = new ReadOnlyObservableCollection <IVideoWriterProvider>(_videoWriterKinds);
            AvailableVideoWriters     = new ReadOnlyObservableCollection <IVideoWriterItem>(_videoWriters);

            AvailableVideoSourceKinds = new ReadOnlyObservableCollection <IVideoSourceProvider>(_videoSourceKinds);
            AvailableVideoSources     = new ReadOnlyObservableCollection <IVideoItem>(_videoSources);

            AvailableImageWriters = new ReadOnlyObservableCollection <IImageWriterItem>(_imageWriters);

            _regionProvider = RegionProvider;

            foreach (var imageWriter in ImageWriters)
            {
                _imageWriters.Add(imageWriter);
            }

            foreach (var videoWriterProvider in VideoWriterProviders)
            {
                _videoWriterKinds.Add(videoWriterProvider);
            }

            foreach (var videoSourceProvider in VideoSourceProviders)
            {
                _videoSourceKinds.Add(videoSourceProvider);
            }

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }

            if (AvailableVideoWriterKinds.Count > 0)
            {
                SelectedVideoWriterKind = AvailableVideoWriterKinds[0];
            }

            if (AvailableVideoSourceKinds.Count > 0)
            {
                SelectedVideoSourceKind = AvailableVideoSourceKinds[0];
            }
        }
Exemplo n.º 24
0
        public RecordingModel(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();
                }
            };
        }
Exemplo n.º 25
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();
                }
            };
        }
Exemplo n.º 26
0
        public ScreenShotViewModel(VideoViewModel VideoViewModel,
                                   RecentViewModel RecentViewModel,
                                   ISystemTray SystemTray,
                                   LanguageManager Loc,
                                   Settings Settings,
                                   IRegionProvider RegionProvider,
                                   IMainWindow MainWindow) : base(Settings, Loc)
        {
            _videoViewModel  = VideoViewModel;
            _recentViewModel = RecentViewModel;
            _systemTray      = SystemTray;
            _regionProvider  = RegionProvider;
            _mainWindow      = MainWindow;

            ScreenShotCommand = new DelegateCommand(() => CaptureScreenShot());

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

            ScreenShotDesktopCommand = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.DesktopWindow)));
        }
Exemplo n.º 27
0
 public MyRecordingViewModel(AudioSource audioSource) : base(new Settings(), LanguageManager.Instance)
 {
     _audioSource      = audioSource;
     VideoSourcePicker = new VideoSourcePicker();
     //_audioSource = new BassAudioSource(Settings.Audio);
     RegionProvider         = new RegionSelector(VideoSourcePicker);
     _webcamOverlay         = new WebcamOverlay(new WebCamProvider(), Settings);
     _previewWindow         = new PreviewWindowService();
     FullScreenProvider     = new FullScreenSourceProvider(LanguageManager, new FullScreenItem());
     ScreenSourceProvider   = new ScreenSourceProvider(LanguageManager, VideoSourcePicker);
     WindowSourceProvider   = new WindowSourceProvider(LanguageManager, VideoSourcePicker, new RegionSelector(VideoSourcePicker));
     RegionSourceProvider   = new RegionSourceProvider(LanguageManager, RegionProvider);
     NoVideoSourceProvider  = new NoVideoSourceProvider(LanguageManager);
     DeskDuplSourceProvider = new DeskDuplSourceProvider(LanguageManager, VideoSourcePicker);
     ImageWriters           = new IImageWriterItem[4] {
         new EditorWriter(), new ClipboardWriter(SystemTray, LanguageManager), null, null
     };
     SharpAviWriterProvider  = new SharpAviWriterProvider();
     DiscardWriterProvider   = new DiscardWriterProvider();
     FFmpegWriterProvider    = new FFmpegWriterProvider(new FFmpegSettings());
     GifWriterProvider       = new GifWriterProvider(LanguageManager, new GifItem(new GifSettings()));
     StreamingWriterProvider = new StreamingWriterProvider();
     _videoViewModel         = new VideoViewModel(
         RegionProvider,
         ImageWriters,
         Settings,
         LanguageManager,
         FullScreenProvider,
         ScreenSourceProvider,
         WindowSourceProvider,
         RegionSourceProvider,
         NoVideoSourceProvider,
         DeskDuplSourceProvider,
         FFmpegWriterProvider,
         SharpAviWriterProvider,
         GifWriterProvider,
         StreamingWriterProvider,
         DiscardWriterProvider
         );
 }
Exemplo n.º 28
0
        public ScreenShotViewModel(VideoSourcesViewModel VideoSourcesViewModel,
                                   ISystemTray SystemTray,
                                   LanguageManager Loc,
                                   Settings Settings,
                                   IRegionProvider RegionProvider,
                                   IMainWindow MainWindow,
                                   DiskWriter DiskWriter,
                                   ClipboardWriter ClipboardWriter,
                                   ImageUploadWriter ImgurWriter,
                                   IVideoSourcePicker SourcePicker,
                                   IAudioPlayer AudioPlayer,
                                   IEnumerable <IImageWriterItem> ImageWriters) : base(Settings, Loc)
        {
            _videoSourcesViewModel = VideoSourcesViewModel;
            _systemTray            = SystemTray;
            _regionProvider        = RegionProvider;
            _mainWindow            = MainWindow;
            _sourcePicker          = SourcePicker;
            _audioPlayer           = AudioPlayer;
            this.DiskWriter        = DiskWriter;
            this.ClipboardWriter   = ClipboardWriter;
            this.ImgurWriter       = ImgurWriter;

            AvailableImageWriters = ImageWriters.ToList();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }

            ScreenShotCommand        = new DelegateCommand(() => CaptureScreenShot());
            ScreenShotActiveCommand  = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.ForegroundWindow)));
            ScreenShotDesktopCommand = new DelegateCommand(async() => await SaveScreenShot(ScreenShotWindow(Window.DesktopWindow)));
            ScreenshotRegionCommand  = new DelegateCommand(async() => await ScreenshotRegion());
            ScreenshotWindowCommand  = new DelegateCommand(async() => await ScreenshotWindow());
            ScreenshotScreenCommand  = new DelegateCommand(async() => await ScreenshotScreen());
        }
Exemplo n.º 29
0
 public RegionItem(IRegionProvider RegionSelector, IPlatformServices PlatformServices)
 {
     _selector         = RegionSelector;
     _platformServices = PlatformServices;
 }
Exemplo n.º 30
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;
                }
            };
        }