Ejemplo n.º 1
0
        public StateViewModel(IRecordDirectoryObserver recordObserver,
                              IEventAggregator eventAggregator,
                              IAppConfiguration appConfiguration,
                              ICaptureService captureService,
                              IOverlayService overlayService,
                              IUpdateCheck updateCheck,
                              IAppVersionProvider appVersionProvider,
                              IWebVersionProvider webVersionProvider,
                              LoginManager loginManager,
                              IRTSSService rTSSService,
                              ILogger <StateViewModel> logger)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _recordObserver     = recordObserver;
            _eventAggregator    = eventAggregator;
            _appConfiguration   = appConfiguration;
            _captureService     = captureService;
            _overlayService     = overlayService;
            _updateCheck        = updateCheck;
            _appVersionProvider = appVersionProvider;
            _logger             = logger;

            IsCaptureModeActive = false;
            IsOverlayActive     = _appConfiguration.IsOverlayActive && rTSSService.IsRTSSInstalled();

            _captureService.IsCaptureModeActiveStream
            .Subscribe(state => IsCaptureModeActive = state);

            _captureService.IsLoggingActiveStream
            .Subscribe(state => IsLoggingActive = state);

            _overlayService.IsOverlayActiveStream
            .Subscribe(state => IsOverlayActive = state);

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state =>
            {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });


            Task.Run(async() =>
            {
                var(updateAvailable, updateVersion) = await _updateCheck.IsUpdateAvailable();
                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    IsUpdateAvailable   = updateAvailable;
                    UpdateHyperlinkText = $"New version available on GitHub: v{updateVersion}";
                    RaisePropertyChanged(nameof(IsUpdateAvailable));
                });
            });

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
Ejemplo n.º 2
0
        public StateViewModel(IRecordDirectoryObserver recordObserver,
                              IEventAggregator eventAggregator,
                              IAppConfiguration appConfiguration,
                              ICaptureService captureService,
                              IOverlayService overlayService,
                              IUpdateCheck updateCheck,
                              IAppVersionProvider appVersionProvider,
                              IWebVersionProvider webVersionProvider)
        {
            _recordObserver      = recordObserver;
            _eventAggregator     = eventAggregator;
            _appConfiguration    = appConfiguration;
            _captureService      = captureService;
            _overlayService      = overlayService;
            _updateCheck         = updateCheck;
            _appVersionProvider  = appVersionProvider;
            IsDirectoryObserving = true;
            IsCaptureModeActive  = false;
            IsOverlayActive      = _appConfiguration.IsOverlayActive && !string.IsNullOrEmpty(RTSSUtils.GetRTSSFullPath());

            UpdateHyperlinkText = $"New version available on GitHub: v{webVersionProvider.GetWebVersion()}";

            _recordObserver.HasValidSourceStream
            .Subscribe(state => IsDirectoryObserving = state);

            _captureService.IsCaptureModeActiveStream
            .Subscribe(state => IsCaptureModeActive = state);

            _overlayService.IsOverlayActiveStream
            .Subscribe(state => IsOverlayActive = state);
        }
Ejemplo n.º 3
0
        public AboutViewModel()
        {
            IAppVersionProvider versionProvider = DependencyService.Get <IAppVersionProvider>();

            Version = $"Fructika {versionProvider.Version}";

            OpenTwitterCommand = new Command(() => Device.OpenUri(new Uri("https://twitter.com/fructika")));
        }
Ejemplo n.º 4
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider = appVersionProvider;
            _fileSystem = fileSystem;
            _commandLineWrapper = commandLineWrapper;
            _processWrapper = processWrapper;
            _packageSource = nugetConfig.PackageSource;
            _appPackageId = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Ejemplo n.º 5
0
        public AppUpdater(NuGetConfig nugetConfig, IAppVersionProvider appVersionProvider, IExtendedFileSystem fileSystem, ICommandLineWrapper commandLineWrapper, IProcessWrapper processWrapper)
        {
            _appVersionProvider       = appVersionProvider;
            _fileSystem               = fileSystem;
            _commandLineWrapper       = commandLineWrapper;
            _processWrapper           = processWrapper;
            _packageSource            = nugetConfig.PackageSource;
            _appPackageId             = nugetConfig.AppPackageId;
            _packageRepositoryFactory = nugetConfig.RepositoryFactory;

            _oldVersionDir = Path.Combine(_fileSystem.AppDirectory, ".old");
        }
Ejemplo n.º 6
0
        public StateViewModel(IRecordDirectoryObserver recordObserver,
                              IEventAggregator eventAggregator,
                              IAppConfiguration appConfiguration,
                              ICaptureService captureService,
                              IOverlayService overlayService,
                              IUpdateCheck updateCheck,
                              IAppVersionProvider appVersionProvider,
                              IWebVersionProvider webVersionProvider,
                              LoginManager loginManager,
                              IRTSSService rTSSService)
        {
            _recordObserver     = recordObserver;
            _eventAggregator    = eventAggregator;
            _appConfiguration   = appConfiguration;
            _captureService     = captureService;
            _overlayService     = overlayService;
            _updateCheck        = updateCheck;
            _appVersionProvider = appVersionProvider;
            IsCaptureModeActive = false;
            IsOverlayActive     = _appConfiguration.IsOverlayActive && rTSSService.IsRTSSInstalled();

            _captureService.IsCaptureModeActiveStream
            .Subscribe(state => IsCaptureModeActive = state);

            _captureService.IsLoggingActiveStream
            .Subscribe(state => IsLoggingActive = state);

            _overlayService.IsOverlayActiveStream
            .Subscribe(state => IsOverlayActive = state);

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state => {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });


            Task.Run(async() =>
            {
                var(updateAvailable, updateVersion) = await _updateCheck.IsUpdateAvailable();
                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    IsUpdateAvailable   = updateAvailable;
                    UpdateHyperlinkText = $"New version available on GitHub: v{updateVersion}";
                    RaisePropertyChanged(nameof(IsUpdateAvailable));
                });
            });
        }
Ejemplo n.º 7
0
        public CloudViewModel(IStatisticProvider statisticProvider, IRecordManager recordManager,
                              IEventAggregator eventAggregator, IAppConfiguration appConfiguration, ILogger <CloudViewModel> logger, IAppVersionProvider appVersionProvider, LoginManager loginManager)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            _statisticProvider  = statisticProvider;
            _recordManager      = recordManager;
            _eventAggregator    = eventAggregator;
            _appConfiguration   = appConfiguration;
            _logger             = logger;
            _appVersionProvider = appVersionProvider;
            _loginManager       = loginManager;
            ClearTableCommand   = new DelegateCommand(OnClearTable);
            CopyURLCommand      = new DelegateCommand(() => Clipboard.SetText(_shareUrl));
            SwitchToDownloadDirectoryCommand = new DelegateCommand(OnSwitchToDownloadDirectory);
            _cloudFolderChanged  = eventAggregator.GetEvent <PubSubEvent <AppMessages.CloudFolderChanged> >();
            _selectCloudFolder   = eventAggregator.GetEvent <PubSubEvent <AppMessages.SelectCloudFolder> >();
            UploadRecordsCommand = new DelegateCommand(async() =>
            {
                await UploadRecords();
                OnClearTable();
            });

            DownloadRecordsCommand = new DelegateCommand(async() =>
            {
                await DownloadCaptureCollection(DownloadIDString);
            });


            SubscribeToUpdateSession();

            CloudEntries.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                  ((sender, eventArg) => OnCloudEntriesChanged());

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state =>
            {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });

            stopwatch.Stop();
            _logger.LogInformation(this.GetType().Name + " {initializationTime}s initialization time", Math.Round(stopwatch.ElapsedMilliseconds * 1E-03, 1));
        }
Ejemplo n.º 8
0
 public RecordManager(ILogger <RecordManager> logger,
                      IAppConfiguration appConfiguration,
                      IRecordDirectoryObserver recordObserver,
                      IAppVersionProvider appVersionProvider,
                      ISensorService sensorService,
                      ISystemInfo systemInfo,
                      ProcessList processList,
                      IRTSSService rTSSService)
 {
     _logger             = logger;
     _appConfiguration   = appConfiguration;
     _recordObserver     = recordObserver;
     _appVersionProvider = appVersionProvider;
     _sensorService      = sensorService;
     _systemInfo         = systemInfo;
     _processList        = processList;
     _rTSSService        = rTSSService;
 }
Ejemplo n.º 9
0
        public CloudViewModel(IStatisticProvider statisticProvider, IRecordManager recordManager,
                              IEventAggregator eventAggregator, IAppConfiguration appConfiguration, ILogger <CloudViewModel> logger, IAppVersionProvider appVersionProvider, LoginManager loginManager)
        {
            _statisticProvider   = statisticProvider;
            _recordManager       = recordManager;
            _eventAggregator     = eventAggregator;
            _appConfiguration    = appConfiguration;
            _logger              = logger;
            _appVersionProvider  = appVersionProvider;
            _loginManager        = loginManager;
            ClearTableCommand    = new DelegateCommand(OnClearTable);
            CopyURLCommand       = new DelegateCommand(() => Clipboard.SetText(_shareUrl));
            _cloudFolderChanged  = eventAggregator.GetEvent <PubSubEvent <AppMessages.CloudFolderChanged> >();
            UploadRecordsCommand = new DelegateCommand(async() =>
            {
                await UploadRecords();
                OnClearTable();
            });

            DownloadRecordsCommand = new DelegateCommand(async() =>
            {
                await DownloadCaptureCollection(DownloadIDString);
            });


            SubscribeToUpdateSession();

            CloudEntries.CollectionChanged += new NotifyCollectionChangedEventHandler
                                                  ((sender, eventArg) => OnCloudEntriesChanged());

            IsLoggedIn = loginManager.State.Token != null;

            _eventAggregator.GetEvent <PubSubEvent <AppMessages.LoginState> >().Subscribe(state =>
            {
                IsLoggedIn = state.IsLoggedIn;
                RaisePropertyChanged(nameof(IsLoggedIn));
            });
        }
Ejemplo n.º 10
0
 public UpdateCheck(IAppVersionProvider appVersionProvider, IWebVersionProvider webVersionProvider)
 {
     _appVersionProvider = appVersionProvider;
     _webVersionProvider = webVersionProvider;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will determine what the current version of the application is.
 /// The default is to use the assembly version of the entry assembly.
 /// </summary>
 public AppUpdaterBuilder CurrentVersionProvidedBy(IAppVersionProvider appVersionProvider)
 {
     _versionProvider = appVersionProvider;
     return this;
 }
Ejemplo n.º 12
0
 public DebugViewModel(ContextManager contextManager, IAppVersionProvider appVersionProvider)
 {
     InitializeDispatcherFromCurrentThread();
     ContextManager = contextManager;
     _appVersionProvider = appVersionProvider;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Control how the <see cref="AppUpdater"/> will determine what the current version of the application is.
 /// The default is to use the assembly version of the entry assembly.
 /// </summary>
 public AppUpdaterBuilder CurrentVersionProvidedBy(IAppVersionProvider appVersionProvider)
 {
     _versionProvider = appVersionProvider;
     return(this);
 }
Ejemplo n.º 14
0
 public VersionController(IAppVersionProvider appVersionProvider)
 {
     _appVersionProvider = appVersionProvider;
 }