Exemple #1
0
        /// <summary>
        /// Saves this instance.
        /// </summary>
        public void Save()
        {
            _log.Info($"{Resources.Saving} {Resources.Themes}");

            Properties.Settings.Default.AccentName   = _accent;
            Properties.Settings.Default.SwatchName   = _swatch;
            Properties.Settings.Default.UseDarkTheme = _isDark;

            Properties.Settings.Default.Save();
        }
Exemple #2
0
 private void Log()
 {
     if (Count != 1)
     {
         _log.Info($"API Call for {Type} returned {Count} Entries");
     }
     else
     {
         _log.Info($"API Call for {Type} returned {Count} Entry");
     }
 }
Exemple #3
0
        private async Task <YouTubeService> GetService()
        {
            if (_service == null)
            {
                _log.Info(Resources.YoutubeLoad);

                UserCredential credential;
                using (var stream = new FileStream(@"Resources\client_secret.json", FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
                        GoogleClientSecrets.Load(stream).Secrets,
                        new[]
                    {
                        YouTubeService.Scope.YoutubeReadonly,
                        YouTubeService.Scope.Youtube
                    },
                        "user",
                        CancellationToken.None,
                        new FileDataStore(GetType().ToString())
                        );
                }

                var result = new YouTubeService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName       = GetType().ToString()
                });

                _log.Info(Resources.YoutubeLoaded);
                _service = result;
                return(result);
            }
            else
            {
                return(_service);
            }
        }
Exemple #4
0
 public void Load()
 {
     _log.Info($"{Resources.Loading} {GetType().Name}");
     Thread.CurrentThread.CurrentCulture = Properties.Settings.Default.StartUpCulture;
 }
Exemple #5
0
 /// <summary>
 /// Saves this instance.
 /// </summary>
 public void Save()
 {
     _log.Info($"{Resources.Saving} {Resources.Options}");
     _manager.Save();
 }