Пример #1
0
        private void LoadUserConfig()
        {
            if (File.Exists(CORE.USER_CONFIG_PATH))
            {
                using (Stream UserConfigStream = File.OpenRead(CORE.USER_CONFIG_PATH))
                {
                    try { CORE.UpdateUserConfiguration(UserConfigStream.Deserialize <UserConfigurationObject>(SerializeType: SerializeType.XML)); }
                    catch { }
                }
            }
            if (UserConfigurationObject.Equals(CORE.UserConfiguration, null))
            {
                CORE.UpdateUserConfiguration(new UserConfigurationObject());

                // Enable all available Database Extensions
                foreach (IDatabaseExtension DatabaseExtension in CORE.DatabaseExtensions)
                {
                    CORE.UserConfiguration.EnabledExtensions.Add(new EnabledExtensionObject(DatabaseExtension)
                    {
                        Enabled = true
                    });
                }

                // Enable the first site
                foreach (var o in CORE.SiteExtensions.Select((sExt, idx) => new { Index = idx, Value = sExt }))
                {
                    CORE.UserConfiguration.EnabledExtensions.Add(new EnabledExtensionObject(o.Value)
                    {
                        Enabled = Equals(o.Index, 0)
                    });
                }
                SaveUserConfiguration();
            }
        }
Пример #2
0
 private void UserConfiguration_PropertyChanged(Object sender, PropertyChangedEventArgs e)
 {
     if (HandlePropertyChange)
     {
         UserConfigurationObject UserConfiguration = sender as UserConfigurationObject;
         switch (e.PropertyName)
         {
         case "Theme":
             App.ApplyTheme(UserConfiguration.Theme);
             break;
         }
     }
 }
Пример #3
0
        public SettingsViewModel()
            : base(false)
        {
            SiteExtensionObjects     = new ObservableCollection <ExtensionObject>();
            DatabaseExtensionObjects = new ObservableCollection <ExtensionObject>();
            AuthenticationDialog     = new AuthenticationDialogViewModel();
            if (!IsInDesignMode)
            {
                UserConfiguration = new UserConfigurationObject();
                DisablePropertyChange();

                ActiveDownloadsTimer = new Timer(state =>
                {   // Monitor the ContentDownloadManager ActiveDownloadKeys property
                    App.RunOnUiThread(new Action(() => { ActiveDownloadKeys = App.ContentDownloadManager.ActiveKeys; }));
                }, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(3));
            }
        }
Пример #4
0
 public void UpdateUserConfiguration(UserConfigurationObject UserConfiguration)
 {
     this.UserConfiguration = UserConfiguration;
 }