コード例 #1
0
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            try
            {
                // Add default themings for Dark and Light
                appearance.SetDefaultThemes(settings.Themes);

                // Add additional Dark and Light resources to those theme resources added above
                appearance.AddThemeResources("Dark", new List <Uri>
                {
                    new Uri("/MWindowDialogLib;component/Themes/DarkIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/BindToMLib;component/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/FolderBrowser;component/Themes/MetroDark.xaml", UriKind.RelativeOrAbsolute)

//                   ,new Uri("/PDF Binder;component/Themes/MWindowLib/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/PDF Binder;component/Themes/Dark/DarkIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/PDF Binder;component/Themes/WatermarkControlsLib/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }


            try
            {
                appearance.AddThemeResources("Light", new List <Uri>
                {
                    new Uri("/MWindowDialogLib;component/Themes/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/BindToMLib;component/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/FolderBrowser;component/Themes/MetroDark.xaml", UriKind.RelativeOrAbsolute)

//                   ,new Uri("/PDF Binder;component/Themes/MWindowLib/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/PDF Binder;component/Themes/Light/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/PDF Binder;component/Themes/WatermarkControlsLib/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }


            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }
        }
コード例 #2
0
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            try
            {
                // Add default themings for Dark and Light
                appearance.SetDefaultThemes(settings.Themes);

                // Add additional Dark resources to those theme resources added above
                appearance.AddThemeResources("Dark", new List <Uri>
                {
                    new Uri("/ColorPickerLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/NumericUpDownLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MWindowLib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/ThemedDemo;component/BindToMLib/NumericUpDownLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/ThemedDemo;component/BindToMLib/MWindowLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/ThemedDemo;component/BindToMLib/ColorPickerLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }

            try
            {
                // Add additional Light resources to those theme resources added above
                appearance.AddThemeResources("Light", new List <Uri>
                {
                    new Uri("/ColorPickerLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/NumericUpDownLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MWindowLib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/ThemedDemo;component/BindToMLib/NumericUpDownLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/ThemedDemo;component/BindToMLib/MWindowLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/ThemedDemo;component/BindToMLib/ColorPickerLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }

            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }
        }
コード例 #3
0
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            var themeInfos = settings.Themes;

            for (int i = 0; i < _WpfThemes.GetLength(0); i++)
            {
                var        item         = _WpfThemes[i];
                List <Uri> WpfResources = null;
                switch (item[1])
                {
                case "Light":
                    WpfResources = new List <Uri>(LightResources);
                    break;

                case "Dark":
                    WpfResources = new List <Uri>(DarkResources);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("WPF theme base:" + item[1] + " not supported.");
                }

                try
                {
                    // Combine resources into one consistent model
                    var theme = new ThemeDefinition(item[0], WpfResources, item[2]);
                    themeInfos.AddThemeInfo(theme);
                }
                catch (Exception exc)
                {
                    Debug.WriteLine(exc.StackTrace);
                }
            }

            appearance.SetDefaultTheme(themeInfos, "Light");             // configure a default WPF theme

            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }
        }
コード例 #4
0
ファイル: AppLifeCycleViewModel.cs プロジェクト: mcswaip1/fsc
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            try
            {
                // Add default themings for Dark and Light
                appearance.SetDefaultThemes(settings.Themes);

                // Add additional Dark resources to those theme resources added above
                appearance.AddThemeResources("Dark", new List <Uri>
                {
                    ////new Uri("/FolderBrowser;component/Themes/MetroDark.xaml", UriKind.RelativeOrAbsolute)
                    new Uri("/FolderBrowser;component/Themes/MetroDark.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/UserNotification;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/InplaceEditBoxLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MWindowDialogLib;component/Themes/DarkIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/DropDownButtonLib;component/Themes/MetroDark.xaml", UriKind.RelativeOrAbsolute)

                    // MWindowDialogLib is only used here so we can use a local BindToMLib version
                    , new Uri("/FolderBrowserDemo;component/BindToMLib/MWindowDialogLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/BindToMLib;component/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }

            try
            {
                // Add additional Light resources to those theme resources added above
                appearance.AddThemeResources("Light", new List <Uri>
                {
                    new Uri("/UserNotification;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/InplaceEditBoxLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MWindowDialogLib;component/Themes/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/DropDownButtonLib;component/Themes/MetroLight.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/FolderBrowser;component/Themes/MetroLight.xaml", UriKind.RelativeOrAbsolute)

                    // MWindowDialogLib is only used here so we can use a local BindToMLib version
                    , new Uri("/FolderBrowserDemo;component/BindToMLib/MWindowDialogLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/BindToMLib;component/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }

            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }
        }
コード例 #5
0
ファイル: App.xaml.cs プロジェクト: johnmbaughman/Locult
        /// <summary>
        /// This is the first bit of code being executed when the application is invoked (main entry point).
        ///
        /// Use the <paramref name="e"/> parameter to evaluate command line options.
        /// Invoking a program with an associated file type extension (eg.: *.txt) in Explorer
        /// results, for example, in executing this function with the path and filename being
        /// supplied in <paramref name="e"/>.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // Set shutdown mode here (and reset further below) to enable showing custom dialogs (messageboxes)
                // durring start-up without shutting down application when the custom dialogs (messagebox) closes
                ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
            }
            catch
            {
            }

            AppLifeCycleViewModel lifeCycle = null;
            AppViewModel          app       = null;
            var settings = GetService <ISettingsManager>();

            try
            {
                // Create a general settings model to make sure the app is at least governed by default settings
                // if there are no customized settings on first ever start-up of application
                SettingDefaults.CreateGeneralSettings(settings);
                settings.Options.SetUndirty();

                lifeCycle = new AppLifeCycleViewModel();
                lifeCycle.LoadConfigOnAppStartup();       // Load application configuration

                var selectedLanguage = settings.Options.GetOptionValue <string>("Options", "LanguageSelected");
                Thread.CurrentThread.CurrentCulture   = new CultureInfo(selectedLanguage);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage);

                app = new AppViewModel(lifeCycle);
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }

            try
            {
                Application.Current.MainWindow = mMainWin = new MainWindow();
                ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;

                AppCore.CreateAppDataFolder();

                if (mMainWin != null && app != null)
                {
                    mMainWin.Loaded += mMainWin_Loaded;

                    mMainWin.Closing += OnClosing;

                    // When the ViewModel asks to be closed, close the window.
                    // Source: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
                    mMainWin.Closed += delegate
                    {
                        // Save session data and close application
                        OnClosed(Workspace, mMainWin);

                        var dispose = Workspace as IDisposable;
                        if (dispose != null)
                        {
                            Workspace.Dispose();
                            Workspace = null;
                        }
                    };

                    ConstructMainWindowSession(app, mMainWin);
                    mMainWin.Show();
                }
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }
        }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: johnmbaughman/Locult
        /// <summary>
        /// This is the first bit of code being executed when the application is invoked (main entry point).
        ///
        /// Use the <paramref name="e"/> parameter to evaluate command line options.
        /// Invoking a program with an associated file type extension (eg.: *.txt) in Explorer
        /// results, for example, in executing this function with the path and filename being
        /// supplied in <paramref name="e"/>.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // Set shutdown mode here (and reset further below) to enable showing custom dialogs (messageboxes)
                // durring start-up without shutting down application when the custom dialogs (messagebox) closes
                ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
            }
            catch
            {
            }

            var settings = GetService <ISettingsManager>(); // add the default themes

            try                                             // Program message box service for Modern UI (Metro Light and Dark)
            {
                var msgBox = GetService <IMessageBoxService>();
                msgBox.Style = MsgBoxStyle.WPFThemed;

                // Add theming models
                settings.Themes.AddThemeInfo("dark", new Uri("/LocultMetro;component/Themes/ModernUIDark.xaml", UriKind.RelativeOrAbsolute));   // AppearanceManager.DarkThemeSource );
                settings.Themes.AddThemeInfo("light", new Uri("/LocultMetro;component/Themes/ModernUILight.xaml", UriKind.RelativeOrAbsolute)); // AppearanceManager.LightThemeSource
            }
            catch
            {
            }

            // Create a general settings model to make sure the app is at least governed by defaults
            // if there are no customized settings on first ever start-up of application
            var options = settings.Options;

            SettingDefaults.CreateGeneralSettings(settings);
            MetroSettingsDefaults.CreateAppearanceSettings(options, settings);

            settings.Options.SetUndirty();

            AppLifeCycleViewModel lifeCycle = null;
            AppViewModel          app       = null;

            try
            {
                lifeCycle = new AppLifeCycleViewModel();
                lifeCycle.LoadConfigOnAppStartup();

                var selectedLanguage = settings.Options.GetOptionValue <string>("Options", "LanguageSelected");
                Thread.CurrentThread.CurrentCulture   = new CultureInfo(selectedLanguage);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage);

                app = new AppViewModel(lifeCycle);

                if (settings.Options.GetOptionValue <string>("Appearance", "ThemeDisplayName") == "dark")
                {
                    AppearanceManager.Current.DarkThemeCommand.Execute(null);
                }
                else
                {
                    settings.Options.SetOptionValue("Appearance", "ThemeDisplayName", "light");
                    AppearanceManager.Current.LightThemeCommand.Execute(null);
                }
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }


            // Create the optional appearance viewmodel and apply
            // current settings to start-up with correct colors etc...
            var appearSettings = new AppearanceViewModel(settings.Themes);

            try
            {
                appearSettings.ApplyOptionsFromModel(settings.Options);
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }

            try
            {
                // Register this settings page viewmodel and view
                var reslocService = GetService <IResourceLocator>();
                app.PageManager.AddSettingsPageViewModel(reslocService.GetNewPageTemplateModel(
                                                             Assembly.GetAssembly(typeof(SettingsAppearance)).GetName().Name,
                                                             "Views/DataTemplates.xaml",
                                                             "AppAppearanceSettingsTemplate",
                                                             appearSettings,
                                                             "Appearance", 1000));
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }

            try
            {
                Application.Current.MainWindow = mMainWin = new MainWindow();
                ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;

                AppCore.CreateAppDataFolder();

                if (mMainWin != null && app != null)
                {
                    mMainWin.Loaded += mMainWin_Loaded;

                    mMainWin.Closing += OnClosing;

                    // When the ViewModel asks to be closed, close the window.
                    // Source: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
                    mMainWin.Closed += delegate
                    {
                        // Save session data and close application
                        OnClosed(Workspace, mMainWin);

                        var dispose = Workspace as IDisposable;
                        if (dispose != null)
                        {
                            dispose.Dispose();
                            Workspace = null;
                        }
                    };

                    ConstructMainWindowSession(app, mMainWin);
                    mMainWin.Show();
                }

                double fontSize         = (double)settings.Options.GetOptionValue <int>("Appearance", "DefaultFontSize");
                double keyFixedFontSize = (double)settings.Options.GetOptionValue <int>("Appearance", "FixedFontSize");

                Application.Current.Resources[AppearanceManager.KeyDefaultFontSize] = fontSize;
                Application.Current.Resources[AppearanceManager.KeyFixedFontSize]   = keyFixedFontSize;
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }
        }
コード例 #7
0
        /// <summary>
        /// This is the first bit of code being executed when the application is invoked (main entry point).
        ///
        /// Use the <paramref name="e"/> parameter to evaluate command line options.
        /// Invoking a program with an associated file type extension (eg.: *.txt) in Explorer
        /// results, for example, in executing this function with the path and filename being
        /// supplied in <paramref name="e"/>.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // Set shutdown mode here (and reset further below) to enable showing custom dialogs (messageboxes)
                // durring start-up without shutting down application when the custom dialogs (messagebox) closes
                ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
            }
            catch
            {
            }

            var settings = GetService <ISettingsManager>(); // add the default themes

            try
            {
                // Customize services specific items for this application
                // Program message box service for Modern UI (Metro Light and Dark)
                var msgBox = GetService <IMessageBoxService>();
                msgBox.Style = MsgBoxStyle.WPFThemed;

                // Add theming models
                settings.Themes.AddThemeInfo("dark", new Uri("/SettingsModelWPFDemo;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute));   // AppearanceManager.DarkThemeSource );
                settings.Themes.AddThemeInfo("light", new Uri("/SettingsModelWPFDemo;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)); // AppearanceManager.LightThemeSource

                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;
                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }

            AppLifeCycleViewModel lifeCycle = null;
            AppViewModel          app       = null;

            try
            {
                lifeCycle = new AppLifeCycleViewModel();
                lifeCycle.LoadConfigOnAppStartup();

                var selectedLanguage = settings.Options.GetOptionValue <string>("Options", "LanguageSelected");

                try
                {
                    Thread.CurrentThread.CurrentCulture   = new CultureInfo(selectedLanguage);
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(selectedLanguage);
                }
                catch
                {
                }

                app = new AppViewModel(lifeCycle,
                                       settings.Options.GetOptionValue <bool>("Options", "ReloadOpenFilesFromLastSession"),
                                       settings.SessionData.LastActiveSolution);

                if (settings.Options.GetOptionValue <string>("Appearance", "ThemeDisplayName") == "Dark")
                {
                    AppearanceManager.Current.DarkThemeCommand.Execute(null);
                }
                else
                {
                    AppearanceManager.Current.LightThemeCommand.Execute(null);
                }

                // Create the optional appearance viewmodel and apply
                // current settings to start-up with correct colors etc...
                var appearSettings = new AppearanceViewModel(settings.Themes);
                appearSettings.ApplyOptionsFromModel(settings.Options);
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }

            try
            {
                Application.Current.MainWindow = mMainWin = new MainWindow();
                ShutdownMode = System.Windows.ShutdownMode.OnLastWindowClose;

                AppCore.CreateAppDataFolder();

                if (mMainWin != null && app != null)
                {
                    mMainWin.Closing += OnClosing;

                    // When the ViewModel asks to be closed, close the window.
                    // Source: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
                    mMainWin.Closed += delegate
                    {
                        // Save session data and close application
                        OnClosed(Workspace, mMainWin);

                        var dispose = Workspace as IDisposable;
                        if (dispose != null)
                        {
                            dispose.Dispose();
                            Workspace = null;
                        }
                    };

                    ConstructMainWindowSession(app, mMainWin);
                    mMainWin.Show();
                }
            }
            catch (Exception exp)
            {
                Logger.Error(exp);
            }
        }
コード例 #8
0
ファイル: AppLifeCycleViewModel.cs プロジェクト: RyanFu/MLib
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            try
            {
                try
                {
                    settings.Themes.RemoveAllThemeInfos();
                    settings.Themes.AddThemeInfo("Generic", new List <Uri> {
                    });

                    // Add default MLib themings for Dark and Light
                    appearance.SetDefaultThemes(settings.Themes, false);

                    // Adding Generic theme (which is really based on Light theme in MLib)
                    // but other components may have another theme definition for Generic
                    // so this is how it can be tested ...
                    appearance.AddThemeResources("Generic", new List <Uri>
                    {
                        new Uri("/MLib;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute)
                        , new Uri("/MWindowLib;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute)
                        , new Uri("/MWindowDialogLib;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute)
                        , new Uri("/BindToMLib;component/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    }, settings.Themes);
                }
                catch (Exception exp)
                {
                    Debug.WriteLine(exp);
                }

                // Add additional Dark and Light resources to those theme resources added above
                appearance.AddThemeResources("Dark", new List <Uri>
                {
                    new Uri("/MWindowDialogLib;component/Themes/DarkIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/BindToMLib;component/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)

                    //,new Uri("/MWindowLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    //,new Uri("/MDemo;component/Themes/MWindowLib/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MDemo;component/Themes/Dark/DarkIcons.xaml", UriKind.RelativeOrAbsolute)
                    //,new Uri("/MDemo;component/Themes/MWindowDialogLib/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MDemo;component/Demos/Views/Dialogs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }

            try
            {
                appearance.AddThemeResources("Light", new List <Uri>
                {
                    new Uri("/MWindowDialogLib;component/Themes/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MWindowDialogLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/BindToMLib;component/LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    //,new Uri("/MWindowLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    //,new Uri("/MDemo;component/Themes/MWindowLib/LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/MDemo;component/Themes/Light/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    //,new Uri("/MDemo;component/Themes/MWindowDialogLib/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/MDemo;component/Demos/Views/Dialogs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
            }


            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
            }
        }
コード例 #9
0
        private void CreateDefaultsSettings(ISettingsManager settings
                                            , IAppearanceManager appearance)
        {
            try
            {
                // Add default themings for Dark and Light
                appearance.SetDefaultThemes(settings.Themes);

                // Add additional Dark resources to those theme resources added above
                appearance.AddThemeResources("Dark", new List <Uri>
                {
                    new Uri("/MWindowLib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/MWindowLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/Xceed.Wpf.AvalonDock.Themes.VS2013;component/DarkTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/AvalonDock_Dark_LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/AehnlichViewLib;component/Themes/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/AehnlichViewLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/AehnlichViewLib_Dark_LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/SuggestBoxLib;component/Themes/DarkBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/SuggestionLibDarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
                // Ignore issues in theme definition stage to ensure app starts up
            }

            try
            {
                // Add additional Light resources to those theme resources added above
                appearance.AddThemeResources("Light", new List <Uri>
                {
                    new Uri("/MWindowLib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/MWindowLib/DarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/Xceed.Wpf.AvalonDock.Themes.VS2013;component/LightTheme.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/AvalonDock_Dark_LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/AehnlichViewLib;component/Themes/LightIcons.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/AehnlichViewLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/AehnlichViewLib_Dark_LightBrushs.xaml", UriKind.RelativeOrAbsolute)

                    , new Uri("/SuggestBoxLib;component/Themes/LightBrushs.xaml", UriKind.RelativeOrAbsolute)
                    , new Uri("/Aehnlich;component/BindToMLib/SuggestionLibDarkLightBrushs.xaml", UriKind.RelativeOrAbsolute)
                }, settings.Themes);
            }
            catch
            {
                // Ignore issues in theme definition stage to ensure app starts up
            }

            try
            {
                // Create a general settings model to make sure the app is at least governed by defaults
                // if there are no customized settings on first ever start-up of application
                var options = settings.Options;

                SettingDefaults.CreateGeneralSettings(options);
                SettingDefaults.CreateAppearanceSettings(options, settings);

                settings.Options.SetUndirty();
            }
            catch
            {
                // Ignore issues in theme definition stage to ensure app starts up
            }
        }