public void GetColorName(IThemeInfo themeInfo) { if (themeInfo != null) { theme = themeInfo.Theme; } }
/// <summary> /// Retrieve an existing theme entry by its Uri source. /// Returns null if theme is not present. /// </summary> /// <param name="name"></param> /// <returns></returns> public IThemeInfo GetThemeInfo(string name) { IThemeInfo ret = null; _Dic.TryGetValue(name, out ret); return(ret); }
/// <summary> /// Adds more resource files into the standard themes available /// through the theme settings interface. /// </summary> /// <param name="themeName"></param> /// <param name="additionalResource"></param> /// <param name="themes"></param> public void AddThemeResources(string themeName , List <Uri> additionalResource , IThemeInfos themes) { var theme = themes.GetThemeInfo(themeName); theme.AddResources(additionalResource); _defaultTheme = themes.GetThemeInfo("Dark"); }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { // Get path string filePath = Path; if (string.IsNullOrEmpty(filePath)) { IThemeInfo themeObject = UIContext.EditedObject as IThemeInfo; if (themeObject != null) { // Get the specific theme path for the current theme object filePath = themeObject.GetThemePath(); } else { // Use the general theme path filePath = "~/App_Themes/"; } } // Setup the file system browser if (!String.IsNullOrEmpty(filePath)) { string absoluteFilePath = string.Empty; try { absoluteFilePath = Server.MapPath(filePath); } catch (Exception ex) { selFile.Visible = false; ShowError(ex.Message); return; } // Create folder if does not exist if (!Directory.Exists(absoluteFilePath)) { Directory.CreateDirectory(absoluteFilePath); } // Setup the browser var config = new FileSystemDialogConfiguration(); config.StartingPath = filePath; config.AllowedExtensions = AllowedExtensions; config.NewTextFileExtension = NewTextFileExtension; config.ShowFolders = false; config.AllowZipFolders = true; config.AllowManage = true; selFile.Config = config; } }
/// <summary> /// This function assumes that themes and their resources have /// been added, previously. /// /// Use this method to define a default theme which can always be /// used as a backup whenever a certain theme is not defined etc... /// </summary> /// <param name="Themes"></param> /// <param name="defaultThemeName"></param> public void SetDefaultTheme(IThemeInfos Themes , string defaultThemeName) { var theme = Themes.GetThemeInfo(defaultThemeName); if (theme == null) { throw new System.ArgumentOutOfRangeException(defaultThemeName); } _defaultTheme = theme; }
/// <summary> /// Remove an existing theme entry by its Uri source. /// </summary> /// <param name="name"></param> /// <returns></returns> public IThemeInfo RemoveThemeInfo(string name) { IThemeInfo ret = null; if (_Dic.TryGetValue(name, out ret) == true) { _Dic.Remove(name); return(ret); } return(ret); }
private void SetTheme(IThemeInfo theme , Color AccentColor) { try { _currentTheme = theme; SetThemeSourceAndAccentColor(theme.ThemeSources, AccentColor); _currentThemeName = theme.DisplayName; ThemeSources = new List <Uri>(theme.ThemeSources); } catch {} }
/// <summary> /// Resets the standard themes available through the theme settings interface. /// </summary> /// <param name="themes"></param> public void SetDefaultThemes(IThemeInfos themes) { themes.RemoveAllThemeInfos(); // Add theming models themes.AddThemeInfo("Dark", new List <Uri> { new Uri("/Mlib;component/Themes/DarkTheme.xaml", UriKind.RelativeOrAbsolute) }); themes.AddThemeInfo("Light", new List <Uri> { new Uri("/Mlib;component/Themes/LightTheme.xaml", UriKind.RelativeOrAbsolute) }); _defaultTheme = themes.GetThemeInfo("Dark"); }
/// <summary> /// Standard Constructor /// </summary> public ThemeViewModel() { var settings = GetService <ISettingsManager>(); // add the default themes _ListOfThemes = new Dictionary <string, IThemeInfo>(); foreach (var item in settings.Themes.GetThemeInfos()) { var list = new List <string>(); foreach (var subitem in item.ThemeSources) { list.Add(subitem.ToString()); } _ListOfThemes.Add(item.DisplayName, item); } // Lets make sure there is a default _ListOfThemes.TryGetValue(GetService <IAppearanceManager>().GetDefaultTheme().DisplayName, out _DefaultTheme); // and something sensible is selected _SelectedTheme = _DefaultTheme; }
/// <summary> /// Hidden class constructor /// </summary> protected ThemeDefinitionViewModel() { _model = null; _IsSelected = false; }
/// <summary> /// Class constructor /// </summary> /// <param name="model"></param> public ThemeDefinitionViewModel(IThemeInfo model) : this() { _model = model; }
/// <summary> /// Copy constructor from <see cref="IThemeInfo"/> parameter. /// </summary> /// <param name="theme"></param> public ThemeDefinitionViewModel(IThemeInfo theme) : this() { this.DisplayName = theme.DisplayName; this.ThemeSources = new List <Uri>(theme.ThemeSources); }
/// <summary> /// Copy constructor from <see cref="IThemeInfo"/> parameter. /// </summary> /// <param name="theme"></param> public ThemeInfo(IThemeInfo theme) : this() { this.DisplayName = theme.DisplayName; this.ThemeSources = new List <Uri>(theme.ThemeSources); }
/// <summary> /// Add another theme entry by its name and Uri source. /// </summary> /// <param name="theme">The <see cref="IThemeInfo"/> based object instance containing /// the unique name definition and collection of Uri based resources to be loaded for /// this theme.</param> public void AddThemeInfo(IThemeInfo theme) { _Dic.Add(theme.DisplayName, theme); }