Ejemplo n.º 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Global exception handling
            Current.DispatcherUnhandledException += AppDispatcherUnhandledException;

            string procName = Process.GetCurrentProcess().ProcessName;

            // get the list of all processes by that name

            Process[] processes = Process.GetProcessesByName(procName);

            if (processes.Length > 1)
            {
                //MessageBox.Show(TranslationStrings.LabelApplicationAlreadyRunning);
                CommandProcessor processor = new CommandProcessor();
                processor.Parse(new[] { "/c", "do", "Restore" });
                Shutdown(-1);
                return;
            }

            ThemeManager.AddAccent("Astro", new Uri("pack://application:,,,/CameraControl;component/Resources/AstroAccent.xaml"));
            ThemeManager.AddAppTheme("Black", new Uri("pack://application:,,,/CameraControl;component/Resources/AstroTheme.xaml"));

            ServiceProvider.Branding = Branding.LoadBranding();
            if (ServiceProvider.Branding.ShowStartupScreen)
            {
                _startUpWindow = new StartUpWindow();
                _startUpWindow.Show();
            }

            Task.Factory.StartNew(InitApplication);
        }
Ejemplo n.º 2
0
        // Personalization
        private void UpdateThemeColor()
        {
            Color AppliedThemeColor = settings_modelview.AppliedThemeColor;
            bool  UseDarkTheme      = settings_modelview.UseDarkTheme;

            Accent new_accent = Utils.ThemeColorToAccent(AppliedThemeColor);

            ThemeManager.AddAccent(new_accent.Name, new_accent.Resources.Source);
            ThemeManager.ChangeAppStyle(Application.Current, new_accent, ThemeManager.GetAppTheme(UseDarkTheme ? "BaseDark" : "BaseLight"));

            // Update all charts to dark or light theme
            var all_plotmodels = this.FindChildren <PlotView>().ToList();

            for (int x = 0; x < all_plotmodels.Count; x++)
            {
                PlotView plot = all_plotmodels[x];

                PlotModel model = plot.Model;
                if (model != null)
                {
                    Utils.ApplyThemeToPlot(model, UseDarkTheme);
                    plot.Model.InvalidatePlot(true);
                }
            }

            var all_datetimeupdown = this.FindChildren <DateTimeUpDown>().ToList();

            for (int x = 0; x < all_datetimeupdown.Count; x++)
            {
                all_datetimeupdown[x].Foreground = UseDarkTheme ? Brushes.White : Brushes.Black;
            }
        }
Ejemplo n.º 3
0
                public void loadStyles()
                {
                    list_Accents.Clear();
                    list_Themes.Clear();

                    String currentDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                    String accentsDir = Path.Combine(currentDir, DataEx.dir_Accents);
                    String themesDir  = Path.Combine(currentDir, DataEx.dir_Themes);

                    foreach (String accentXaml in Directory.GetFiles(accentsDir, "*.xaml", SearchOption.TopDirectoryOnly))
                    {
                        String accentName = accentXaml.Replace(accentsDir, String.Empty).Replace(".xaml", String.Empty);

                        ThemeManager.AddAccent(accentName, new Uri(accentXaml, UriKind.Absolute));
                        list_Accents.Add(accentName);
                    }

                    foreach (String themeXaml in Directory.GetFiles(themesDir, "*.xaml", SearchOption.TopDirectoryOnly))
                    {
                        String themeName = themeXaml.Replace(themesDir, String.Empty).Replace(".xaml", String.Empty);

                        ThemeManager.AddAppTheme(themeName, new Uri(themeXaml, UriKind.Absolute));
                        list_Themes.Add(themeName);
                    }
                }
Ejemplo n.º 4
0
        public static void ApplyColor(Color color, string accentName = null)
        {
            // create a runtime accent resource dictionary

            var resDictName = accentName ?? $"ApplicationAccent_{color.ToString().Replace("#", string.Empty)}.xaml";

            var resourceDictionary = new ResourceDictionary();

            resourceDictionary.Add("HighlightColor", color);
            resourceDictionary.Add("AccentBaseColor", color);
            resourceDictionary.Add("AccentColor", Color.FromArgb((byte)(204), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor2", Color.FromArgb((byte)(153), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor3", Color.FromArgb((byte)(102), color.R, color.G, color.B));
            resourceDictionary.Add("AccentColor4", Color.FromArgb((byte)(51), color.R, color.G, color.B));

            resourceDictionary.Add("HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["HighlightColor"]));
            resourceDictionary.Add("AccentBaseColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentBaseColor"]));
            resourceDictionary.Add("AccentColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("AccentColorBrush2", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("AccentColorBrush3", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"]));
            resourceDictionary.Add("AccentColorBrush4", GetSolidColorBrush((Color)resourceDictionary["AccentColor4"]));

            resourceDictionary.Add("WindowTitleColorBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));

            resourceDictionary.Add("ProgressBrush", new LinearGradientBrush(
                                       new GradientStopCollection(new[]
            {
                new GradientStop((Color)resourceDictionary["HighlightColor"], 0),
                new GradientStop((Color)resourceDictionary["AccentColor3"], 1)
            }),
                                       // StartPoint="1.002,0.5" EndPoint="0.001,0.5"
                                       startPoint: new Point(1.002, 0.5), endPoint: new Point(0.001, 0.5)));

            resourceDictionary.Add("CheckmarkFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("RightArrowFill", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));

            resourceDictionary.Add("IdealForegroundColor", IdealTextColor(color));
            resourceDictionary.Add("IdealForegroundColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));
            resourceDictionary.Add("IdealForegroundDisabledBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"], 0.4));
            resourceDictionary.Add("AccentSelectedColorBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            resourceDictionary.Add("MetroDataGrid.HighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MetroDataGrid.HighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));
            resourceDictionary.Add("MetroDataGrid.MouseOverHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor3"]));
            resourceDictionary.Add("MetroDataGrid.FocusBorderBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightBrush", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("MetroDataGrid.InactiveSelectionHighlightTextBrush", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor"]));
            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.OnSwitchMouseOverBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["AccentColor2"]));
            resourceDictionary.Add("MahApps.Metro.Brushes.ToggleSwitchButton.ThumbIndicatorCheckedBrush.Win10", GetSolidColorBrush((Color)resourceDictionary["IdealForegroundColor"]));

            // applying theme to MahApps
            ThemeManager.AddAccent(resDictName, resourceDictionary);
            var newAccent = ThemeManager.GetAccent(resDictName);
            // detect current application theme
            Tuple <AppTheme, Accent> applicationTheme = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current, newAccent, applicationTheme.Item1);
        }
Ejemplo n.º 5
0
 public void OnContraste(Window window)
 {
     ThemeManager.AddAccent("AltoContraste", new Uri("pack://application:,,,/Skin/Skin.xaml"));
     ThemeManager.AddAppTheme("FondoAltoContraste", new Uri("pack://application:,,,/Skin/Tema.xaml"));
     ThemeManager.ChangeAppStyle(window,
                                 ThemeManager.GetAccent("AltoContraste"),
                                 ThemeManager.GetAppTheme("FondoAltoContraste"));
 }
Ejemplo n.º 6
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //add Axis theme
            ThemeManager.AddAccent("Axis Theme", new Uri("pack://application:,,,/FileShufflerv2;component/Resources/AxisTheme.xaml"));


            base.OnStartup(e);
        }
Ejemplo n.º 7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("AccentBaseColorBrush", new Uri("pack://application:,,,/BattleshipUIRework;component/Styles/AppStyle.xaml"));
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Current);

            ThemeManager.ChangeAppStyle(Current, ThemeManager.GetAccent("AccentBaseColorBrush"), theme.Item1);
            base.OnStartup(e);
        }
Ejemplo n.º 8
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("EdikateAccent", new Uri("pack://application:,,,/Edikate.TimeManager.Host;component/Styles/EdikateAccent.xaml"));
            Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("EdikateAccent"), appStyle.Item1);
            base.OnStartup(e);
        }
Ejemplo n.º 9
0
        private void ApplyTheme()
        {
            ThemeManager.AddAccent("CustomBlue", new Uri("pack://application:,,,/Themes/ShitBrown.xaml"));
            var accent = ThemeManager.GetAccent("CustomBlue");
            var theme  = ThemeManager.GetAppTheme("BaseLight");

            ThemeManager.ChangeAppStyle(Application.Current.Resources, accent, theme);
        }
Ejemplo n.º 10
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("Dark", new Uri("pack://application:,,,/GoogleTranslate.Desktop;component/CustomThemes.xaml"));
            var theme = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("Dark"),
                                        theme.Item1);
            base.OnStartup(e);
        }
Ejemplo n.º 11
0
        private void SetCustomAccentColor()
        {
            var name = "Custom";

            ThemeManager.AddAccent(name, new Uri("pack://application:,,,/UI;component/Views/Resources/Accent.xaml"));

            var theme = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(name), theme.Item1);
        }
Ejemplo n.º 12
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ThemeManager.AddAccent("DefaultAccent", new Uri("/Themes/DefaultAccent.xaml", UriKind.Relative));
            ThemeManager.ChangeAppStyle(this, ThemeManager.Accents.First(x => x.Name == "DefaultAccent"), ThemeManager.AppThemes.First(x => x.Name == "BaseLight"));
            Common.SetEncodings();
            Common.SetCultures();

#if !DEBUG
            System.Threading.Thread.Sleep(2000);
#endif
        }
Ejemplo n.º 13
0
        private void AppOnStartup(object sender, StartupEventArgs e)
        {
            foreach (var proc in Process.GetProcessesByName("CappuChat"))
            {
                proc.Kill();
            }

            var serverConfigurationController = new ConfigurationController <ServerConfiguration>();

            if (!serverConfigurationController.TryReadConfiguration(out var serverConfiguration))
            {
                MessageBox.Show("Could not retrieve Configuration to download files.");
            }

            var chatClientPath = $"{Environment.CurrentDirectory}\\CappuChat.exe";

            string[] arguments =
            {
                $"-assemblyPath=\"{chatClientPath}\" ",
                $"-host=\"{serverConfiguration.Host}\" ",
                $"-ftpuser=\"{serverConfiguration.FtpUser}\" ",
                $"-ftppassword=\"{serverConfiguration.FtpPassword}\" "
            };

            var updaterArguments = new UpdaterArguments(arguments);
            var updaterViewModel = new UpdaterViewModel(updaterArguments);

            var window = new MainWindow
            {
                DataContext           = updaterViewModel,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            var colorConfigurationController = new ConfigurationController <ColorConfiguration>();
            var colorConfiguration           = colorConfigurationController.ReadConfiguration(new ColorConfiguration
            {
                Color = "Steel"
            });

            ThemeManager.AddAccent("Orgadata", new Uri("Styles/OrgadataTheme.xaml"));

            var foundAccent = ThemeManager.Accents.FirstOrDefault(accent =>
                                                                  accent.Name.Equals(colorConfiguration.Color, StringComparison.CurrentCultureIgnoreCase));
            var theme = ThemeManager.DetectAppStyle(Current);

            ThemeManager.ChangeAppStyle(Current, foundAccent, theme.Item1);

            window.Show();

            Task.Run(async() =>
            {
                await updaterViewModel.Update().ConfigureAwait(false);
            });
        }
Ejemplo n.º 14
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries
            ThemeManager.AddAccent("CustomAccent1", new Uri("pack://application:,,,/UniVoting.LiveView;component/CustomAccents/CustomAccent.xaml"));

            // create custom accents
            ThemeManagerHelper.CreateAppStyleBy(Colors.Red);
            ThemeManagerHelper.CreateAppStyleBy(Colors.GreenYellow);
            ThemeManagerHelper.CreateAppStyleBy(Colors.Indigo, true);
            base.OnStartup(e);
        }
Ejemplo n.º 15
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("CustomLime", new Uri("pack://application:,,,/CSGODemosManager;component/Resources/Accents/CustomLime.xaml"));
            ThemeManager.AddAppTheme("Dark", new Uri("pack://application:,,,/CSGODemosManager;component/Resources/Accents/ThemeDark.xaml"));
            ThemeManager.AddAppTheme("Light", new Uri("pack://application:,,,/CSGODemosManager;component/Resources/Accents/ThemeLight.xaml"));
            Accent   accent = ThemeManager.GetAccent("CustomLime");
            AppTheme theme  = ThemeManager.GetAppTheme(Settings.Default.Theme);

            ThemeManager.ChangeAppStyle(Current, accent, theme);
            base.OnStartup(e);
        }
Ejemplo n.º 16
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("GtMpRed", new Uri("pack://application:,,,/Resources/Accents/GtMpRed.xaml"));
            ThemeManager.AddAppTheme("GtMpRed", new Uri("pack://application:,,,/Resources/Themes/GtMpRed.xaml"));

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Current,
                                        ThemeManager.GetAccent("GtMpRed"),
                                        ThemeManager.GetAppTheme("GtMpRed"));

            base.OnStartup(e);
        }
Ejemplo n.º 17
0
        private void ThemeCustomizations()
        {
            // Custom MahApps Light Theme based on Blue
            ThemeManager.AddAccent("MahLight", new Uri("Styles/MahLightAccents.xaml", UriKind.RelativeOrAbsolute));

            Uri resourceUri = null;

            // Add Dark Menu Customizations
            if (mmApp.Configuration.ApplicationTheme == Themes.Dark)
            {
                resourceUri = new Uri("Styles/MahMenuCustomizations.xaml", UriKind.RelativeOrAbsolute);
                Current.Resources.MergedDictionaries.Add(
                    new ResourceDictionary()
                {
                    Source = resourceUri
                });

                var dragablzLightStyles = new Uri("Styles/DragablzGeneric.xaml", UriKind.RelativeOrAbsolute);
                Current.Resources.MergedDictionaries.Add(
                    new ResourceDictionary()
                {
                    Source = dragablzLightStyles
                });

                resourceUri = new Uri("Styles/MahDarkResources.xaml", UriKind.RelativeOrAbsolute);
                Current.Resources.MergedDictionaries.Add(
                    new ResourceDictionary()
                {
                    Source = resourceUri
                });
            }
            else
            {
                var dragablzLightStyles = new Uri("Styles/DragablzGenericLight.xaml", UriKind.RelativeOrAbsolute);
                Current.Resources.MergedDictionaries.Add(
                    new ResourceDictionary()
                {
                    Source = dragablzLightStyles
                });

                resourceUri = new Uri("Styles/MahLightResources.xaml", UriKind.RelativeOrAbsolute);
                Current.Resources.MergedDictionaries.Add(
                    new ResourceDictionary()
                {
                    Source = resourceUri
                });
            }



            mmApp.SetTheme(mmApp.Configuration.ApplicationTheme, App.Current.MainWindow as MetroWindow);
        }
Ejemplo n.º 18
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries
            ThemeManager.AddAccent("CustomAccent1", new Uri("pack://application:,,,/SoundOryc.Desktop;component/View/CustomAccent.xaml"));

            // get the theme from the current application
            AppTheme theme = ThemeManager.DetectAppStyle(Application.Current).Item1;

            // now use the custom accent
            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CustomAccent1"), theme);

            base.OnStartup(e);
        }
Ejemplo n.º 19
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries to the ThemeManager
            // you should replace MahAppsMetroThemesSample with your application name
            // and correct place where your custom accent lives
            ThemeManager.AddAccent("CustomAccent", new Uri("pack://application:,,,/Base/Programa/Estilos/Colores.xaml"));
            // get the current app style (theme and accent) from the application
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Application.Current);

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("CustomAccent"), theme.Item1);
            base.OnStartup(e);
        }
Ejemplo n.º 20
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ThemeManager.AddAccent("AnySenseAccent", new Uri("pack://application:,,,/AnySenseStudio;component/styles/AnySenseAccent.xaml"));

            // get the theme from the current application
            var theme = ThemeManager.DetectAppStyle(Application.Current);

            // now use the custom accent
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("AnySenseAccent"),
                                        theme.Item1);
        }
Ejemplo n.º 21
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("orchestra", new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Clean/CleanWindow.xaml"));
            // get the current app style (theme and accent) from the application
            // you can then use the current theme and custom accent instead set a new theme
            Tuple <AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);

            // now set the Green accent and dark theme
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("Yellow"),
                                        ThemeManager.GetAppTheme("BaseDark")); // or appStyle.Item1

            base.OnStartup(e);
        }
Ejemplo n.º 22
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("CustomerAccent", new Uri("pack://application:,,,/FoodTrace.Forms;component/Styles/CustomerAccent.xaml"));

            // get the current app style (theme and accent) from the application
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Application.Current);

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("CustomerAccent"),
                                        theme.Item1);

            base.OnStartup(e);
        }
Ejemplo n.º 23
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries
            ThemeManager.AddAccent("CustomAccent1", new Uri("pack://application:,,,/MahAppsMetroThemesSample;component/CustomAccents/CustomAccent1.xaml"));
            ThemeManager.AddAccent("CustomAccent2", new Uri("pack://application:,,,/MahAppsMetroThemesSample;component/CustomAccents/CustomAccent2.xaml"));
            ThemeManager.AddAppTheme("CustomTheme", new Uri("pack://application:,,,/MahAppsMetroThemesSample;component/CustomAccents/CustomTheme.xaml"));

            // create custom accents
            ThemeManagerHelper.CreateAppStyleBy(Colors.Red);
            ThemeManagerHelper.CreateAppStyleBy(Colors.GreenYellow);
            ThemeManagerHelper.CreateAppStyleBy(Colors.Indigo, true);

            base.OnStartup(e);
        }
Ejemplo n.º 24
0
        protected override void OnStartup(StartupEventArgs e)
        {
            ThemeManager.AddAccent("CustomAccent1", new Uri(Environment.CurrentDirectory + "/content/CustomAccent.xaml"));

            // get the current app style (theme and accent) from the application
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Current);

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Current,
                                        ThemeManager.GetAccent("CustomAccent1"),
                                        ThemeManager.AppThemes.First(x => string.Equals(x.Name, "BaseLight")));

            base.OnStartup(e);
        }
Ejemplo n.º 25
0
        private void SetStyle()
        {
            if (TryFindResource("AccentColorBrush") is SolidColorBrush accentBrush)
            {
                accentBrush.Color.CreateAccentColors();
            }

            ThemeManager.AddAccent("CustomFluentTheme", new Uri("pack://application:,,,/EtasaDesktop;component/Resources/Theme/Ribbon.xaml"));
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Application.Current);

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("CustomFluentTheme"),
                                        theme.Item1);
        }
Ejemplo n.º 26
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries
            ThemeManager.AddAppTheme("LightTheme", new Uri(@"pack://*****:*****@"pack://application:,,,/Resources\Themes\DarkTheme.xaml"));
            ThemeManager.AddAccent("LightThemeAccent", new Uri(@"pack://*****:*****@"pack://application:,,,/Resources\Themes\DarkThemeAccent.xaml"));

            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent(Settings.Default.LightTheme ? "LightThemeAccent" : "DarkThemeAccent"),
                                        ThemeManager.GetAppTheme(Settings.Default.LightTheme ? "LightTheme" : "DarkTheme"));

            base.OnStartup(e);
        }
Ejemplo n.º 27
0
        public MainWindow()
        {
            InitializeComponent();

#if false
            ThemeManager.AddAccent("HsGrayAccent", new Uri("Style/GrayAccent.xaml"));
            ThemeManager.AddAppTheme("HsDarkTheme", new Uri("Style/HsDarkTheme.xaml"));

            // load theme & accent from sqlite
            string accentName = "HsGrayAccent", themeName = "HsDarkTheme";
            var    appTheme  = MahApps.Metro.ThemeManager.GetAppTheme(themeName);
            var    appAccent = MahApps.Metro.ThemeManager.GetAccent(accentName);
            ThemeManager.ChangeAppStyle(Application.Current, appAccent, appTheme);
#endif
        }
Ejemplo n.º 28
0
 private void BtnSacuvajPromene_Click(object sender, RoutedEventArgs e)
 {
     ThemeManager.AddAccent("Yellow", new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Yellow.xaml"));
     ThemeManager.AddAccent("Green", new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Green.xaml"));
     ThemeManager.AddAppTheme("BaseDark", new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml"));
     ThemeManager.AddAppTheme("BaseLight", new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"));
     if (cbBojaBG.IsChecked == true)
     {
         ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Yellow"), ThemeManager.GetAppTheme("BaseDark"));
     }
     else
     {
         ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent("Green"), ThemeManager.GetAppTheme("BaseLight"));
     }
     this.Close();
 }
Ejemplo n.º 29
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries to the ThemeManager
            // you should replace FluentRibbonThemesSample with your application name
            // and correct place where your custom accent lives
            ThemeManager.AddAccent("CustomAccent1", new Uri(@"E:\4VS\workSpace\Information\InfoDemoOne\CustomAccent1.xaml"));

            // get the current app style (theme and accent) from the application
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Application.Current);

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("CustomAccent1"),
                                        theme.Item1);
            base.OnStartup(e);
        }
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            // add custom accent and theme resource dictionaries to the ThemeManager
            // you should replace MahAppsMetroThemesSample with your application name
            // and correct place where your custom accent lives
            ThemeManager.AddAccent("CustomAccent1", new Uri("pack://application:,,,/Stroller;component/Resources/Style.xaml"));

            // get the current app style (theme and accent) from the application
            Tuple <AppTheme, Accent> theme = ThemeManager.DetectAppStyle(Application.Current);

            // now change app style to the custom accent and current theme
            ThemeManager.ChangeAppStyle(Application.Current,
                                        ThemeManager.GetAccent("CustomAccent1"),
                                        theme.Item1);

            DisplayRootViewFor <IMain>();
        }