public NativeThemeInfo( string name, FileVersionInfo version, FileInfo path, UxThemeLoadParams loadParams = null) { BaseName = name; Name = name + " (" + version.GetWindowsName() + ")"; Version = version; Path = path; LoadParams = loadParams ?? new UxThemeLoadParams(); }
public static SafeThemeFileHandle LoadTheme( string path, UxThemeLoadParams loadParams = null) { UxThemeExNativeMethods.UxOpenThemeFileEx( path, loadParams?.IsHighContrast ?? false, loadParams?.CustomColors, out var themeFile).ThrowIfFailed(); return(themeFile); }
public static NativeThemeInfo FromPath(string themePath, UxThemeLoadParams loadParams = null) { string name = System.IO.Path.GetFileName(themePath); var version = FileVersionInfo.GetVersionInfo(themePath); var path = new FileInfo(themePath); if (!path.Exists) { throw new ArgumentException(); } return(new NativeThemeInfo(name, version, path, loadParams)); }
public async Task SetThemeAsync(string path, UxThemeLoadParams loadParams = null) { if (path != null) { SetNativeTheme(await Task.Run(() => LoadTheme(path, loadParams))); } else { SetNativeTheme(SafeThemeFileHandle.Zero); } CurrentOverride = path; UxThemeExNativeMethods.UxBroadcastThemeChange(); }
public bool Matches(string themePath, UxThemeLoadParams loadParams) { return (string.Equals(Path.FullName, themePath, StringComparison.OrdinalIgnoreCase) && LoadParams == loadParams); }