Ejemplo n.º 1
0
        /// <summary>
        /// Update the viewmodel variables for theme and color to reflect those in use
        /// </summary>
        private void SyncThemeAndColor()
        {
            // synchronizes the selected viewmodel theme with the actual theme used by the appearance manager.
            SelectedTheme = _themes.FirstOrDefault(l => l.Source.Equals(AppearanceManager.Current.ThemeSource));

            // and make sure accent color is up-to-date
            SelectedAccentColor = AppearanceManager.Current.AccentColor;

            //write settings to the config file so that they will be loaded next time
            Properties.Settings.Default.Theme  = SelectedTheme?.DisplayName;
            Properties.Settings.Default.Accent = SelectedAccentColor.ToString();
            Properties.Settings.Default.Save();
        }
Ejemplo n.º 2
0
        private void AsyncSaveTheme()
        {
            var t = Task.Factory.StartNew(() => {
                var opc = new Modulos.Accounts.Model.mOpcoes
                {
                    Identificador = AccountOn.Identificador,
                    Thema         = SelectedThemeMode.ToString(),
                    Color         = SelectedAccentColor.ToString()
                };

                AccountOn.Color = opc.Color;
                AccountOn.Thema = opc.Thema;

                if (AccountOn.Identificador.ToLower() != "System".ToLower())
                {
                    new Modulos.Accounts.Model.mData().GravarOpcoes(opc);
                }
            });
        }
Ejemplo n.º 3
0
        private async void AsyncAccountTheme()
        {
            var opc = new Account.Model.mOpcoes
            {
                Identificador = Account.Logged.Identificador,
                Thema         = SelectedThemeMode.ToString(),
                Color         = SelectedAccentColor.ToString()
            };

            Account.Logged.Color = opc.Color;
            Account.Logged.Thema = opc.Thema;

            var t = Task.Run(() => {
                if (Account.Logged.Identificador.ToLower() != "System".ToLower())
                {
                    new Account.Model.mData().GravarOpcoes(opc);
                }
            });

            await t;
        }