Esempio n. 1
0
        private async Task <UserPreferences> CreateDefaultPreferencesAsync()
        {
            var filePreferences = new FilePreferences(showRecentFiles: true, new List <RecentFile>());

            var defaultsPreferences = new DefaultsPreferences(
                Messages.DefaultDefaultSeasonTitle,
                Messages.DefaultDefaultSeasonOriginalTitle,
                this.CreateDefaultKinds(),
                new List <Tag>(),
                CultureInfo.GetCultureInfo("uk-UA"),
                ListSortOrder.ByTitle,
                ListSortOrder.ByYear,
                ListSortDirection.Ascending,
                ListSortDirection.Ascending);

            string appName = Assembly.GetExecutingAssembly()?.GetName().Name ?? String.Empty;

            var loggingPreferences = new LoggingPreferences(
                Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                    appName,
                    $"{appName}.log"),
                (int)LogEventLevel.Warning);

            var preferences = new UserPreferences(filePreferences, defaultsPreferences, loggingPreferences);

            await BlobCache.UserAccount.InsertObject(PreferencesKey, preferences);

            return(preferences);
        }
Esempio n. 2
0
 public UserPreferences(
     UIPreferences ui,
     FilePreferences file,
     DefaultsPreferences defaults,
     LoggingPreferences logging)
 {
     this.UI       = ui;
     this.File     = file;
     this.Defaults = defaults;
     this.Logging  = logging;
 }
Esempio n. 3
0
        private async Task <UserPreferences> CreateDefaultPreferencesAsync()
        {
            var filePreferences = new FilePreferences(showRecentFiles: true, new List <RecentFile>());

            var defaultsPreferences = new DefaultsPreferences(
                Messages.DefaultSeasonTitle, Messages.DefaultSeasonOriginalTitle, this.CreateDefaultKinds(), "uk-UA");

            var loggingPreferences = new LoggingPreferences(
                $"{Assembly.GetExecutingAssembly().GetName().Name}.log",
                (int)LogEventLevel.Information);

            var preferences = new UserPreferences(filePreferences, defaultsPreferences, loggingPreferences);

            await BlobCache.UserAccount.InsertObject(PreferencesKey, preferences);

            this.Log().Debug("No preferences found. Created default preferences.");

            return(preferences);
        }
Esempio n. 4
0
            internal void Cleanse()
            {
                if (Arguments == null)
                {
                    Arguments = new List <string>();
                }
                if (LoggingPreferences == null)
                {
                    LoggingPreferences = new Dictionary <string, LogLevel>();
                }
                if (PerformanceLoggingPreferences == null)
                {
                    PerformanceLoggingPreferences = new LoggingPreferencesPerformance();
                }
                if (UserProfilePreferences == null)
                {
                    UserProfilePreferences = new Dictionary <string, object>();
                }

                Arguments              = Arguments.Where(argument => !argument.StartsWith("!")).ToList();
                LoggingPreferences     = new Dictionary <string, LogLevel>(LoggingPreferences.Where(pair => !pair.Key.StartsWith("!")).ToDictionary(pair => pair.Key, pair => pair.Value));
                UserProfilePreferences = new Dictionary <string, object>(UserProfilePreferences.Where(pair => !pair.Key.StartsWith("!")).ToDictionary(pair => pair.Key, pair => pair.Value));
                ChromeLogPath          = ChromeLogPath ?? System.IO.Path.Combine(System.IO.Path.GetTempPath(), "Chrome_debug.log");
            }