コード例 #1
0
#pragma warning restore RECS0165 // Asynchronous methods should return a Task instead of void
        protected override void OnDeactivate(bool close)
        {
            base.OnDeactivate(close);
            HotKeyViewModel.RegisterHotKeys();
            _spotifyController.TokenUpdated -= SpotifyControllerOnTokenUpdated;
            PropertyChanged -= SettingsViewModel_PropertyChanged;
        }
コード例 #2
0
#pragma warning disable RECS0165 // Asynchronous methods should return a Task instead of void
        protected override async void OnActivate()

        {
            base.OnActivate();
            HotKeyViewModel.UnregisterHotKeys();
            _spotifyController.TokenUpdated += SpotifyControllerOnTokenUpdated;
            await UpdateLoggedIn();

            //TODO custom decorator would be ideal here
            PropertyChanged += SettingsViewModel_PropertyChanged;
        }
コード例 #3
0
        public SettingsViewModel(AppContracts contracts,
                                 ICoverService coverService, ILog logger, HotKeyViewModel hotKeyViewModel,
                                 ISpotifyController spotifyController, AutorunService autorunService, JsonPersister <AppSettings> persister)
        {
            _settings          = persister.Instance;
            _contracts         = contracts;
            _coverService      = coverService;
            _logger            = logger;
            _spotifyController = spotifyController;
            _autorunService    = autorunService;
            _persister         = persister;

            HotKeyViewModel = hotKeyViewModel;
            DisplayName     = $"Settings - {_contracts.ApplicationName}";
            CacheSize       = Helper.MakeNiceSize(_coverService.CacheSize());
        }