本文整理汇总了C#中Theme.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Theme.ToString方法的具体用法?C# Theme.ToString怎么用?C# Theme.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Change
public void Change(Theme theme)
{
var uri = new Uri(string.Format(@"pack://application:,,,/Themes/Mukyutter.{0}Color.xaml", theme.ToString()));
var dic = new ResourceDictionary { Source = uri };
dic.Keys.OfType<string>()
.Where(key => this.app.Resources.Contains(key))
.ForEach(key => this.app.Resources[key] = dic[key]);
this._current = theme;
}
示例2: GenerateCaptcha
public static MvcHtmlString GenerateCaptcha(this HtmlHelper helper, Theme theme = Theme.Clean, string callBack = null)
{
const string htmlInjectString = @"<div id=""recaptcha_div""></div>
<script type=""text/javascript"">
Recaptcha.create(""{0}"", ""recaptcha_div"", {{ theme: ""{1}"" {2}}});
</script>";
var publicKey = ConfigurationManager.AppSettings["ReCaptcha.PublicKey"];
if (string.IsNullOrWhiteSpace(publicKey))
throw new InvalidKeyException("ReCaptcha.PublicKey missing from appSettings");
if (!string.IsNullOrWhiteSpace(callBack))
callBack = string.Concat(", callback: ", callBack);
var html = string.Format(htmlInjectString, publicKey, theme.ToString().ToLower(), callBack);
return MvcHtmlString.Create(html);
}
示例3: SetTheme
public void SetTheme(Theme theme)
{
this.Theme = theme;
string themeName = theme == Ext.Net.Theme.Default ? "blue" : theme.ToString().ToLowerInvariant();
base.AddScript("Ext.net.ResourceMgr.setTheme(\"{0}\", \"{1}\");", this.GetThemeUrl(theme), themeName);
}
示例4: GetThemeUrl
public virtual string GetThemeUrl(Theme theme)
{
ResourceLocationType type = this.RenderStyles;
string themeName = theme == Ext.Net.Theme.Default ? "" : ("-" + theme.ToString().ToLowerInvariant());
switch (type)
{
case ResourceLocationType.Embedded:
return this.GetWebResourceUrl(ResourceManager.ASSEMBLYSLUG + ".extjs.resources.css.ext-all" + themeName + "-embedded.css");
case ResourceLocationType.File:
return this.ConvertToFilePath(ResourceManager.ASSEMBLYSLUG + ".extjs.resources.css.ext-all" + themeName + ".css");
#if ISPRO
case ResourceLocationType.CDN:
return ResourceManager.CDNPath.ConcatWith("/extjs/resources/css/ext-all" + themeName + ".css");
#endif
}
return "";
}
示例5: SetThemeIntoRegister
public static void SetThemeIntoRegister(Theme selectedTheme)
{
RegistrySettingsHelper.SetString("Theme", selectedTheme.ToString());
}
示例6: SetTheme
public static void SetTheme(Theme theme)
{
string themeName = theme == Ext.Net.Theme.Default ? "blue" : theme.ToString().ToLowerInvariant();
ResourceManager.AddInstanceScript("Ext.net.ResourceMgr.setTheme(\"{0}\", \"{1}\");", MvcResourceManager.GetThemeUrl(theme), themeName);
}
示例7: UpdateGtkTheme
internal static void UpdateGtkTheme ()
{
if (DefaultTheme == null)
SetupGtkTheme ();
string current_theme = IdeApp.Preferences.UserInterfaceThemeName;
if (!Platform.IsLinux) {
UserInterfaceTheme = IdeApp.Preferences.UserInterfaceThemeName == "Dark" ? Theme.Dark : Theme.Light;
if (current_theme != UserInterfaceTheme.ToString ()) // Only theme names allowed on Win/Mac
current_theme = UserInterfaceTheme.ToString ();
}
var use_bundled_theme = false;
// Use the bundled gtkrc only if the Xamarin theme is installed
if (File.Exists (Path.Combine (Gtk.Rc.ModuleDir, "libxamarin.so")) || File.Exists (Path.Combine (Gtk.Rc.ModuleDir, "libxamarin.dll")))
use_bundled_theme = true;
// on Windows we can't rely on Gtk.Rc.ModuleDir to be valid
// and test additionally the default installation dir
if (!use_bundled_theme && Platform.IsWindows) {
var gtkBasePath = Environment.GetEnvironmentVariable ("GTK_BASEPATH");
if (String.IsNullOrEmpty (gtkBasePath))
gtkBasePath = "C:\\Program Files (x86)\\GtkSharp\\2.12\\";
if (File.Exists (Path.Combine (gtkBasePath, "lib\\gtk-2.0\\2.10.0\\engines\\libxamarin.dll")))
use_bundled_theme = true;
}
if (use_bundled_theme) {
if (!Directory.Exists (UserProfile.Current.ConfigDir))
Directory.CreateDirectory (UserProfile.Current.ConfigDir);
if (Platform.IsWindows) {
// HACK: Gtk Bug: Rc.ReparseAll () and the include "[rcfile]" gtkrc statement are broken on Windows.
// We must provide our own XDG folder structure to switch bundled themes.
var rc_themes = UserProfile.Current.ConfigDir.Combine ("share", "themes");
var rc_theme_light = rc_themes.Combine ("Light", "gtk-2.0", "gtkrc");
var rc_theme_dark = rc_themes.Combine ("Dark", "gtk-2.0", "gtkrc");
if (!Directory.Exists (rc_theme_light.ParentDirectory))
Directory.CreateDirectory (rc_theme_light.ParentDirectory);
if (!Directory.Exists (rc_theme_dark.ParentDirectory))
Directory.CreateDirectory (rc_theme_dark.ParentDirectory);
string gtkrc = PropertyService.EntryAssemblyPath.Combine ("gtkrc");
File.Copy (gtkrc + ".win32", rc_theme_light, true);
File.Copy (gtkrc + ".win32-dark", rc_theme_dark, true);
var themeDir = UserProfile.Current.ConfigDir;
if (!themeDir.IsAbsolute)
themeDir = themeDir.ToAbsolute (Environment.CurrentDirectory);
Environment.SetEnvironmentVariable ("GTK_DATA_PREFIX", themeDir);
// set the actual theme and reset the environment only after Gtk has been fully
// initialized. See SetupGtkTheme ().
if (Gtk.Settings.Default != null) {
LoggingService.LogInfo ("GTK: Using Gtk theme from {0}", Path.Combine (Gtk.Rc.ThemeDir, current_theme));
Gtk.Settings.Default.ThemeName = current_theme;
Environment.SetEnvironmentVariable ("GTK_DATA_PREFIX", DefaultGtkDataFolder);
}
} else if (Platform.IsMac) {
var gtkrc = "gtkrc.mac";
if (IdeApp.Preferences.UserInterfaceTheme == Theme.Dark)
gtkrc += "-dark";
gtkrc = PropertyService.EntryAssemblyPath.Combine (gtkrc);
LoggingService.LogInfo ("GTK: Using gtkrc from {0}", gtkrc);
// Generate a dummy rc file and use that to include the real rc. This allows changing the rc
// on the fly. All we have to do is rewrite the dummy rc changing the include and call ReparseAll
var rcFile = UserProfile.Current.ConfigDir.Combine ("gtkrc");
File.WriteAllText (rcFile, "include \"" + gtkrc + "\"");
Environment.SetEnvironmentVariable ("GTK2_RC_FILES", rcFile);
Gtk.Rc.ReparseAll ();
// reset the environment only after Gtk has been fully initialized. See SetupGtkTheme ().
if (Gtk.Settings.Default != null)
Environment.SetEnvironmentVariable ("GTK2_RC_FILES", DefaultGtk2RcFiles);
}
} else if (Gtk.Settings.Default != null && current_theme != Gtk.Settings.Default.ThemeName) {
LoggingService.LogInfo ("GTK: Using Gtk theme from {0}", Path.Combine (Gtk.Rc.ThemeDir, current_theme));
Gtk.Settings.Default.ThemeName = current_theme;
}
// let Gtk realize the new theme
// Style is being updated by DefaultWorkbench.OnStyleSet ()
// This ensures that the theme and all styles have been loaded when
// the Styles.Changed event is raised.
//GLib.Timeout.Add (50, delegate { UpdateStyles(); return false; });
}
示例8: CanChangeTheme
private bool CanChangeTheme(Theme theme)
{
return theme.ToString() != ThemeHelper.CurrentTheme;
}
示例9: CreateThemeResourceUri
private static Uri CreateThemeResourceUri(Theme theme)
{
var param = new Dictionary<string, string>
{
{ "theme", theme.ToString() },
};
return themeTemplate.BindByName(templateBaseUri, param);
}
示例10: ChangeTheme
public ActionResult ChangeTheme(Theme theme)
{
ThemeManager.SetCurrentTheme(theme.ToString());
return RedirectToAction("Index");
}