From eaa8a3ca6c43f947d7e57d712b20c0e4c3b051c8 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Sun, 23 May 2021 19:30:21 +0200 Subject: [PATCH] removal of TaskDialog usage... --- docs/Changelog.md | 13 +- docs/Manual.md | 21 +- .../RatingExtension/RatingExtension.cs | 31 +- .../RatingExtension/RatingExtension.csproj | 6 +- .../RatingExtension/ScriptDevelopment.cs | 42 + src/Misc/App.cs | 70 +- src/Misc/CSharpScriptHost.cs | 14 +- src/Misc/Commands.cs | 127 +- src/Misc/Extension.cs | 6 +- src/Misc/ExtensionMethods.cs | 70 +- src/Misc/Global.cs | 13 + src/Misc/GlobalHotkey.cs | 8 +- src/Misc/Help.cs | 73 +- src/Misc/Misc.cs | 38 +- src/Misc/Msg.cs | 39 + src/Misc/PowerShell.cs | 69 +- src/Misc/Program.cs | 10 +- src/Misc/Terminal.cs | 50 + src/Misc/Theme.cs | 2 +- src/Misc/UpdateCheck.cs | 26 +- src/Native/Native.cs | 266 +-- src/Native/TaskDialog.cs | 674 ------ src/Release.ps1 | 4 +- src/Resources/theme.txt | 10 + src/Scripts/C-Sharp/delete-current-file.cs | 63 + src/Scripts/C-Sharp/key-binding.cs | 4 +- .../C-Sharp/observe-property-and-draw-text.cs | 10 +- src/Scripts/C-Sharp/pause-when-minimize.cs | 20 +- src/Scripts/C-Sharp/rate-file.cs | 84 + ...tems.cs => switch-profile-context-menu.cs} | 12 +- src/WPF/CommandPaletteWindow.xaml.cs | 4 +- src/WPF/ConfWindow.xaml.cs | 33 +- src/WPF/EverythingWindow.xaml.cs | 7 +- src/WPF/InputWindow.xaml.cs | 15 +- src/WPF/SetupWindow.xaml.cs | 12 +- src/WinForms/MainForm.cs | 352 +-- src/WinForms/TaskDialog/CheckBoxRendererEx.vb | 70 - src/WinForms/TaskDialog/ColorHSL.vb | 164 -- src/WinForms/TaskDialog/Mathf.vb | 116 - src/WinForms/TaskDialog/Misc.vb | 69 - src/WinForms/TaskDialog/Msg.vb | 82 - .../My Project/Application.Designer.vb | 13 - .../TaskDialog/My Project/Application.myapp | 10 - .../TaskDialog/My Project/AssemblyInfo.vb | 35 - .../My Project/Resources.Designer.vb | 63 - .../TaskDialog/My Project/Resources.resx | 117 - .../My Project/Settings.Designer.vb | 73 - .../TaskDialog/My Project/Settings.settings | 7 - src/WinForms/TaskDialog/StockIcon.vb | 144 -- src/WinForms/TaskDialog/Symbol.vb | 2059 ----------------- src/WinForms/TaskDialog/TaskDialog.sln | 25 - src/WinForms/TaskDialog/TaskDialog.vb | 486 ---- src/WinForms/TaskDialog/TaskDialog.vbproj | 131 -- .../TaskDialog/TaskDialogBaseForm.Designer.vb | 247 -- .../TaskDialog/TaskDialogBaseForm.resx | 120 - src/WinForms/TaskDialog/TaskDialogBaseForm.vb | 1603 ------------- src/mpv.net.csproj | 12 +- src/mpv.net.sln | 6 - src/mpv/{Core.cs => CorePlayer.cs} | 150 +- 59 files changed, 1035 insertions(+), 7065 deletions(-) create mode 100644 src/Extensions/RatingExtension/ScriptDevelopment.cs create mode 100644 src/Misc/Global.cs create mode 100644 src/Misc/Msg.cs create mode 100644 src/Misc/Terminal.cs delete mode 100644 src/Native/TaskDialog.cs create mode 100644 src/Scripts/C-Sharp/delete-current-file.cs create mode 100644 src/Scripts/C-Sharp/rate-file.cs rename src/Scripts/C-Sharp/{dynamic-context-menu-items.cs => switch-profile-context-menu.cs} (73%) delete mode 100644 src/WinForms/TaskDialog/CheckBoxRendererEx.vb delete mode 100644 src/WinForms/TaskDialog/ColorHSL.vb delete mode 100644 src/WinForms/TaskDialog/Mathf.vb delete mode 100644 src/WinForms/TaskDialog/Misc.vb delete mode 100644 src/WinForms/TaskDialog/Msg.vb delete mode 100644 src/WinForms/TaskDialog/My Project/Application.Designer.vb delete mode 100644 src/WinForms/TaskDialog/My Project/Application.myapp delete mode 100644 src/WinForms/TaskDialog/My Project/AssemblyInfo.vb delete mode 100644 src/WinForms/TaskDialog/My Project/Resources.Designer.vb delete mode 100644 src/WinForms/TaskDialog/My Project/Resources.resx delete mode 100644 src/WinForms/TaskDialog/My Project/Settings.Designer.vb delete mode 100644 src/WinForms/TaskDialog/My Project/Settings.settings delete mode 100644 src/WinForms/TaskDialog/StockIcon.vb delete mode 100644 src/WinForms/TaskDialog/Symbol.vb delete mode 100644 src/WinForms/TaskDialog/TaskDialog.sln delete mode 100644 src/WinForms/TaskDialog/TaskDialog.vb delete mode 100644 src/WinForms/TaskDialog/TaskDialog.vbproj delete mode 100644 src/WinForms/TaskDialog/TaskDialogBaseForm.Designer.vb delete mode 100644 src/WinForms/TaskDialog/TaskDialogBaseForm.resx delete mode 100644 src/WinForms/TaskDialog/TaskDialogBaseForm.vb rename src/mpv/{Core.cs => CorePlayer.cs} (92%) diff --git a/docs/Changelog.md b/docs/Changelog.md index 79c49eb..39f2b18 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -5,15 +5,20 @@ - There is an issue with the `window-scale` mpv property, it does not work correctly in mpv either, so I've removed support for it and added my own implementation `script-message mpv.net window-scale`. -- The previous Beta replaced the CS-Script library with my own - C# scripting implementation. +- The CS-Script library was replaced with my own C# scripting implementation. - If a player window border is near to a screen border and the window size changes, the player windows sticks to that near screen border location. Furthermore the `remember-position` option remembers a near screen border position instead of remembering the window center position. - High DPI multi monitor fix. -- `start-size` option has new options, see in config editor and manual. -- Improved `cycle-audio` OSD info. +- `start-size` option has new options, see config editor and manual. +- Improved `script-message mpv.net cycle-audio` OSD info. +- The logic for finding the config directory has changed, see manual. +- The native TaskDialog/MessageBox was replaced with the themed VB.NET + implementation of StaxRip. +- The dotnet script and extension host was redesigned, existing scripts + and extensions must be fixed. All example scripts were updated and + a new script delete-current-file.cs was added. 5.4.8.8 Beta (2021-05-09) diff --git a/docs/Manual.md b/docs/Manual.md index 553684e..a6eae1f 100644 --- a/docs/Manual.md +++ b/docs/Manual.md @@ -108,21 +108,28 @@ Or use the [support thread](https://forum.videohelp.com/threads/392514-mpv-net-a Settings -------- -When mpv.net finds no config folder on startup it will ask for a location. +mpv.net searches the config folder at: -If a folder named portable_config next to the mpvnet.exe exists, -all config will be loaded from this folder only. +1. startup\portable_config +2. %APPDATA%\mpv.net -```Text -\portable_config\ -``` +In order to use a custom directory create following file: + +startup\settings-directory.txt + +Put your custom directory in that file. + +The custom directory path can be relative to the startup directory path. + +This custom directory is only used if the portable_config and %APPDATA% directory does not exist. mpv specific settings are stored in the file mpv.conf, if no mpv.conf file exists mpv.net generates it with the following defaults: [mpv.conf defaults](../../../tree/master/src/Resources/mpv.conf.txt) -mpv.net specific settings are stored in the file mpvnet.conf. +mpv.net specific settings are stored in the file mpvnet.conf, +these options are documented [here](#mpvnet-specific-options). Input and context menu diff --git a/src/Extensions/RatingExtension/RatingExtension.cs b/src/Extensions/RatingExtension/RatingExtension.cs index 542681e..806121f 100644 --- a/src/Extensions/RatingExtension/RatingExtension.cs +++ b/src/Extensions/RatingExtension/RatingExtension.cs @@ -18,16 +18,19 @@ using System.ComponentModel.Composition; using System.IO; using System.Threading; using System.Windows.Forms; + using Microsoft.VisualBasic.FileIO; using mpvnet; -using static mpvnet.Core; +using static mpvnet.Global; -namespace RatingExtension // the assembly name must end with 'Extension' +namespace RatingExtension // the assembly name must end with 'Extension'! { [Export(typeof(IExtension))] public class RatingExtension : IExtension { + //Script script = new Script(); + // dictionory to store the filename and the rating Dictionary Dic = new Dictionary(); @@ -36,8 +39,8 @@ namespace RatingExtension // the assembly name must end with 'Extension' public RatingExtension() // plugin initialization { - core.ClientMessage += ClientMessage; //handles keys defined in input.conf - core.Shutdown += Shutdown; // handles MPV_EVENT_SHUTDOWN + Core.ClientMessage += ClientMessage; //handles keys defined in input.conf + Core.Shutdown += Shutdown; // handles MPV_EVENT_SHUTDOWN } // handles MPV_EVENT_SHUTDOWN @@ -48,7 +51,7 @@ namespace RatingExtension // the assembly name must end with 'Extension' string filepath = i.Key; int rating = i.Value; - if (String.IsNullOrEmpty(filepath) || !File.Exists(filepath)) + if (string.IsNullOrEmpty(filepath) || !File.Exists(filepath)) return; string basename = Path.GetFileNameWithoutExtension(filepath); @@ -77,7 +80,7 @@ namespace RatingExtension // the assembly name must end with 'Extension' if (int.TryParse(args[1], out int rating)) { - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); if (!File.Exists(path)) return; @@ -87,7 +90,7 @@ namespace RatingExtension // the assembly name must end with 'Extension' else { Dic[path] = rating; - core.commandv("show-text", $"Rating: {rating}"); + Core.commandv("show-text", $"Rating: {rating}"); } } else if (args[1] == "about") @@ -99,26 +102,26 @@ namespace RatingExtension // the assembly name must end with 'Extension' { if (rating == 0) { - FileToDelete = core.get_property_string("path"); + FileToDelete = Core.get_property_string("path"); DeleteTime = DateTime.Now; - core.commandv("show-text", "Press 1 to delete file", "5000"); + Core.commandv("show-text", "Press 1 to delete file", "5000"); } else { TimeSpan ts = DateTime.Now - DeleteTime; - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); if (FileToDelete == path && ts.TotalSeconds < 5 && File.Exists(FileToDelete)) { - core.command("playlist-remove current"); - int pos = core.get_property_int("playlist-pos"); + Core.command("playlist-remove current"); + int pos = Core.get_property_int("playlist-pos"); if (pos == -1) { - int count = core.get_property_int("playlist-count"); + int count = Core.get_property_int("playlist-count"); if (count > 0) - core.set_property_int("playlist-pos", count - 1); + Core.set_property_int("playlist-pos", count - 1); } Thread.Sleep(2000); diff --git a/src/Extensions/RatingExtension/RatingExtension.csproj b/src/Extensions/RatingExtension/RatingExtension.csproj index 1615c2c..3299d6d 100644 --- a/src/Extensions/RatingExtension/RatingExtension.csproj +++ b/src/Extensions/RatingExtension/RatingExtension.csproj @@ -15,7 +15,7 @@ true - C:\Users\frank\OneDrive\Settings\mpv.net\extensions\RatingExtension\ + bin\ DEBUG;TRACE full AnyCPU @@ -24,7 +24,7 @@ MinimumRecommendedRules.ruleset - C:\Users\frank\OneDrive\Settings\mpv.net\extensions\RatingExtension\ + bin\ TRACE true pdbonly @@ -38,6 +38,7 @@ + @@ -49,6 +50,7 @@ + diff --git a/src/Extensions/RatingExtension/ScriptDevelopment.cs b/src/Extensions/RatingExtension/ScriptDevelopment.cs new file mode 100644 index 0000000..1eb06c7 --- /dev/null +++ b/src/Extensions/RatingExtension/ScriptDevelopment.cs @@ -0,0 +1,42 @@ + +//// This script adds dynamic menu items for profile switching. + +//// In input.conf add a menu item called 'Profiles' + +//using mpvnet; +//using System.ComponentModel; +//using System.Linq; + +//class Script +//{ +// MainForm MainForm; +// CorePlayer Core; + +// public Script() +// { +// Core = Global.Core; +// MainForm = MainForm.Instance; +// MainForm.ContextMenu.Opening += ContextMenu_Opening; +// } + +// void ContextMenu_Opening(object sender, CancelEventArgs e) +// { +// MenuItem menuItem = MainForm.FindMenuItem("My Menu"); + +// if (menuItem == null) +// { +// Terminal.WriteError("Profiles menu item not found.", "switch-profile-context-menu.cs"); +// return; +// } + +// menuItem.DropDownItems.Clear(); +// var editionTracks = Core.MediaTracks.Where(track => track.Type == "e"); + +// foreach (int i in new[] {1, 2, 3}) +// { +// MenuItem mi = new MenuItem(i.ToString()); +// mi.Action = () => { Core.commandv("show-text", i.ToString()); }; +// menuItem.DropDownItems.Add(mi); +// } +// } +//} diff --git a/src/Misc/App.cs b/src/Misc/App.cs index bd250c3..345a83d 100644 --- a/src/Misc/App.cs +++ b/src/Misc/App.cs @@ -6,15 +6,13 @@ using System.IO; using System.Windows.Forms; using System.Threading.Tasks; -using static mpvnet.Core; -using static TaskDialog.Msg; +using static mpvnet.Global; namespace mpvnet { public static class App { - public static string RegPath { get; } = @"HKCU\Software\" + Application.ProductName; - public static string ConfPath { get => core.ConfigFolder + "mpvnet.conf"; } + public static string ConfPath { get => Core.ConfigFolder + "mpvnet.conf"; } public static string ProcessInstance { get; set; } = "single"; public static string DarkMode { get; set; } = "always"; public static string DarkTheme { get; set; } = "dark"; @@ -43,8 +41,8 @@ namespace mpvnet public static void Init() { - string dummy = core.ConfigFolder; - var dummy2 = core.Conf; + string dummy = Core.ConfigFolder; + var dummy2 = Core.Conf; foreach (var i in Conf) ProcessProperty(i.Key, i.Value, true); @@ -53,7 +51,7 @@ namespace mpvnet { try { - string filePath = core.ConfigFolder + "mpvnet-debug.log"; + string filePath = Core.ConfigFolder + "mpvnet-debug.log"; if (File.Exists(filePath)) File.Delete(filePath); @@ -72,16 +70,16 @@ namespace mpvnet string themeContent = null; - if (File.Exists(core.ConfigFolder + "theme.conf")) - themeContent = File.ReadAllText(core.ConfigFolder + "theme.conf"); + if (File.Exists(Core.ConfigFolder + "theme.conf")) + themeContent = File.ReadAllText(Core.ConfigFolder + "theme.conf"); Theme.Init( themeContent, Properties.Resources.theme, IsDarkMode ? DarkTheme : LightTheme); - core.Shutdown += Shutdown; - core.Initialized += Initialized; + Core.Shutdown += Shutdown; + Core.Initialized += Initialized; } public static void RunTask(Action action) @@ -99,34 +97,32 @@ namespace mpvnet get { return "Copyright (C) 2000-2021 mpv.net/mpv/mplayer\n" + $"mpv.net {Application.ProductVersion} ({File.GetLastWriteTime(Application.ExecutablePath).ToShortDateString()})\n" + - $"{core.get_property_string("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-1.dll").ToShortDateString()})\nffmpeg {core.get_property_string("ffmpeg-version")}\nMIT License"; + $"{Core.get_property_string("mpv-version")} ({File.GetLastWriteTime(Folder.Startup + "mpv-1.dll").ToShortDateString()})\nffmpeg {Core.get_property_string("ffmpeg-version")}\nMIT License"; } } public static void ShowException(object obj) { - if (obj is Exception e) - { - if (IsStartedFromTerminal) - ConsoleHelp.WriteError(e.ToString()); - else - Msg.ShowException(e); - } + if (IsStartedFromTerminal) + Terminal.WriteError(obj.ToString()); else { - if (IsStartedFromTerminal) - ConsoleHelp.WriteError(obj.ToString()); + if (obj is Exception e) + Msg.ShowException(e); else - MsgError(obj.ToString()); + Msg.ShowError(obj.ToString()); } } - public static void ShowError(string title, string msg) + public static void ShowError(string title, string msg = null) { if (IsStartedFromTerminal) { - ConsoleHelp.WriteError(title); - ConsoleHelp.WriteError(msg); + if (title != null) + Terminal.WriteError(title); + + if (msg != null) + Terminal.WriteError(msg); } else Msg.ShowError(title, msg); @@ -136,8 +132,8 @@ namespace mpvnet { if (RememberVolume) { - core.set_property_int("volume", RegistryHelp.GetInt("Volume", 70)); - core.set_property_string("mute", RegistryHelp.GetString("Mute", "no")); + Core.set_property_int("volume", RegistryHelp.GetInt("volume", 70)); + Core.set_property_string("mute", RegistryHelp.GetString("mute", "no")); } } @@ -145,8 +141,8 @@ namespace mpvnet { if (RememberVolume) { - RegistryHelp.SetValue(RegPath, "Volume", core.get_property_int("volume")); - RegistryHelp.SetValue(RegPath, "Mute", core.get_property_string("mute")); + RegistryHelp.SetInt("volume", Core.get_property_int("volume")); + RegistryHelp.SetString("mute", Core.get_property_string("mute")); } } @@ -185,31 +181,31 @@ namespace mpvnet case "minimum-aspect-ratio": MinimumAspectRatio = value.ToFloat(); return true; case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true; case "light-theme": LightTheme = value.Trim('\'', '"'); return true; - case "video-file-extensions": VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; - case "audio-file-extensions": AudioTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; - case "image-file-extensions": ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; + case "video-file-extensions": CorePlayer.VideoTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; + case "audio-file-extensions": CorePlayer.AudioTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; + case "image-file-extensions": CorePlayer.ImageTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true; default: if (writeError) - ConsoleHelp.WriteError($"unknown mpvnet.conf property: {name}"); + Terminal.WriteError($"unknown mpvnet.conf property: {name}"); return false; } } public static void ShowSetup() { - int value = RegistryHelp.GetInt(Folder.Startup); + int value = RegistryHelp.GetInt("location: " + Folder.Startup); if (value != 1) { if (Msg.ShowQuestion("Would you like to setup mpv.net?", "The setup allows to create a start menu shortcut, file associations and " + - "adding mpv.net to the Path environment variable.") == MsgResult.OK) + "adding mpv.net to the Path environment variable.") == DialogResult.OK) Commands.Execute("show-setup-dialog"); else - MsgInfo("The setup dialog can be found in the context menu at:\n\nTools > Setup"); + Msg.ShowInfo("The setup dialog can be found at:\n\nContext Menu > Tools > Setup"); - RegistryHelp.SetValue(RegistryHelp.ApplicationKey, Folder.Startup, 1); + RegistryHelp.SetInt("location: " + Folder.Startup, 1); } } } diff --git a/src/Misc/CSharpScriptHost.cs b/src/Misc/CSharpScriptHost.cs index f3bf744..0145124 100644 --- a/src/Misc/CSharpScriptHost.cs +++ b/src/Misc/CSharpScriptHost.cs @@ -33,7 +33,14 @@ namespace mpvnet Compile(outputFile, file); if (File.Exists(outputFile)) - References.Add(Assembly.LoadFile(outputFile).CreateInstance("Script")); + { + object instance = Assembly.LoadFile(outputFile).CreateInstance("Script"); + + if (instance != null) + References.Add(instance); + else + Terminal.WriteError("Failed to initialize script.", outputFile.FileName()); + } } public static void Compile(string outputFile, string file) @@ -42,6 +49,7 @@ namespace mpvnet CompilerParameters parameters = new CompilerParameters(); string[] dependencies = { + Folder.Startup + "mpvnet.exe", "Microsoft.VisualBasic.dll", "System.Core.dll", "System.Data.dll", "System.dll", "System.Drawing.dll", "System.Web.dll", "System.Windows.Forms.dll", "System.Xaml.dll", "System.Xml.dll", "System.Xml.Linq.dll", @@ -55,10 +63,10 @@ namespace mpvnet CompilerResults results = provider.CompileAssemblyFromFile(parameters, file); var errors = results.Errors.Cast().Select(i => "Line Number " + - i.Line + "\r\n" + "Error Number: " + i.ErrorNumber + "\r\n" + i.ErrorText); + i.Line + "\n" + "Error Number: " + i.ErrorNumber + "\n" + i.ErrorText); if (errors.Count() > 0) - ConsoleHelp.WriteError(string.Join("\r\n\r\n", errors), Path.GetFileName(file)); + Terminal.WriteError(string.Join("\n\n", errors), Path.GetFileName(file)); } static string GetMD5(string code) diff --git a/src/Misc/Commands.cs b/src/Misc/Commands.cs index ba4d649..3704857 100644 --- a/src/Misc/Commands.cs +++ b/src/Misc/Commands.cs @@ -10,8 +10,7 @@ using System.Windows; using VB = Microsoft.VisualBasic; -using static mpvnet.NewLine; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -23,21 +22,19 @@ namespace mpvnet { case "add-files-to-playlist": OpenFiles("append"); break; // deprecated 2019 case "cycle-audio": CycleAudio(); break; - case "execute-mpv-command": ExecuteMpvCommand(); break; + case "execute-mpv-command": Msg.ShowError("Command was removed, reset input.conf."); break; case "load-audio": LoadAudio(); break; case "load-sub": LoadSubtitle(); break; - case "manage-file-associations": // deprecated 2019 - case "open-conf-folder": ProcessHelp.ShellExecute(core.ConfigFolder); break; + case "open-conf-folder": ProcessHelp.ShellExecute(Core.ConfigFolder); break; case "open-files": OpenFiles(args); break; case "open-optical-media": Open_DVD_Or_BD_Folder(); break; case "open-url": OpenURL(); break; case "playlist-first": PlaylistFirst(); break; case "playlist-last": PlaylistLast(); break; case "scale-window": ScaleWindow(float.Parse(args[0], CultureInfo.InvariantCulture)); break; - case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break; case "shell-execute": ProcessHelp.ShellExecute(args[0]); break; case "show-about": ShowDialog(typeof(AboutWindow)); break; - case "show-audio-devices": ShowTextWithEditor("audio-device-list", core.get_property_osd_string("audio-device-list")); break; + case "show-audio-devices": ShowTextWithEditor("audio-device-list", Core.get_property_osd_string("audio-device-list")); break; case "show-command-palette": ShowDialog(typeof(CommandPaletteWindow)); break; case "show-commands": ShowCommands(); break; case "show-conf-editor": ShowDialog(typeof(ConfWindow)); break; @@ -46,15 +43,16 @@ namespace mpvnet case "show-history": ShowHistory(); break; case "show-info": ShowInfo(); break; case "show-input-editor": ShowDialog(typeof(InputWindow)); break; - case "show-keys": ShowTextWithEditor("input-key-list", core.get_property_string("input-key-list").Replace(",", BR)); break; + case "show-keys": ShowTextWithEditor("input-key-list", Core.get_property_string("input-key-list").Replace(",", BR)); break; case "show-media-search": ShowDialog(typeof(EverythingWindow)); break; - case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break; case "show-playlist": ShowPlaylist(); break; + case "show-profiles": ShowTextWithEditor("profile-list", mpvHelp.GetProfiles()); break; case "show-properties": ShowProperties(); break; case "show-protocols": ShowTextWithEditor("protocol-list", mpvHelp.GetProtocols()); break; case "show-setup-dialog": ShowDialog(typeof(SetupWindow)); break; case "show-text": ShowText(args[0], Convert.ToInt32(args[1]), Convert.ToInt32(args[2])); break; case "update-check": UpdateCheck.CheckOnline(true); break; + case "window-scale": WindowScale(float.Parse(args[0], CultureInfo.InvariantCulture)); break; default: Msg.ShowError($"No command '{id}' found."); break; } @@ -85,7 +83,7 @@ namespace mpvnet InvokeOnMainThread(new Action(() => { using (var d = new OpenFileDialog() { Multiselect = true }) if (d.ShowDialog() == DialogResult.OK) - core.LoadFiles(d.FileNames, loadFolder, append); + Core.LoadFiles(d.FileNames, loadFolder, append); })); } @@ -99,18 +97,18 @@ namespace mpvnet if (dialog.ShowDialog() == DialogResult.OK) { - core.command("stop"); + Core.command("stop"); Thread.Sleep(500); if (Directory.Exists(dialog.SelectedPath + "\\BDMV")) { - core.set_property_string("bluray-device", dialog.SelectedPath); - core.LoadFiles(new[] { @"bd://" }, false, false); + Core.set_property_string("bluray-device", dialog.SelectedPath); + Core.LoadFiles(new[] { @"bd://" }, false, false); } else { - core.set_property_string("dvd-device", dialog.SelectedPath); - core.LoadFiles(new[] { @"dvd://" }, false, false); + Core.set_property_string("dvd-device", dialog.SelectedPath); + Core.LoadFiles(new[] { @"dvd://" }, false, false); } } } @@ -119,31 +117,31 @@ namespace mpvnet public static void PlaylistFirst() { - int pos = core.get_property_int("playlist-pos"); + int pos = Core.get_property_int("playlist-pos"); if (pos != 0) - core.set_property_int("playlist-pos", 0); + Core.set_property_int("playlist-pos", 0); } public static void PlaylistLast() { - int pos = core.get_property_int("playlist-pos"); - int count = core.get_property_int("playlist-count"); + int pos = Core.get_property_int("playlist-pos"); + int count = Core.get_property_int("playlist-count"); if (pos < count - 1) - core.set_property_int("playlist-pos", count - 1); + Core.set_property_int("playlist-pos", count - 1); } public static void ShowHistory() { - if (File.Exists(core.ConfigFolder + "history.txt")) - ProcessHelp.ShellExecute(core.ConfigFolder + "history.txt"); + if (File.Exists(Core.ConfigFolder + "history.txt")) + ProcessHelp.ShellExecute(Core.ConfigFolder + "history.txt"); else { if (Msg.ShowQuestion("Create history.txt file in config folder?", - "mpv.net will write the date, time and filename of opened files to it.") == MsgResult.OK) + "mpv.net will write the date, time and filename of opened files to it.") == DialogResult.OK) - File.WriteAllText(core.ConfigFolder + "history.txt", ""); + File.WriteAllText(Core.ConfigFolder + "history.txt", ""); } } @@ -153,19 +151,19 @@ namespace mpvnet { string performer, title, album, genre, date, duration, text = ""; long fileSize = 0; - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); if (path.Contains("://")) - path = core.get_property_string("media-title"); + path = Core.get_property_string("media-title"); - int width = core.get_property_int("video-params/w"); - int height = core.get_property_int("video-params/h"); + int width = Core.get_property_int("video-params/w"); + int height = Core.get_property_int("video-params/h"); if (File.Exists(path)) { fileSize = new FileInfo(path).Length; - if (AudioTypes.Contains(path.Ext())) + if (CorePlayer.AudioTypes.Contains(path.Ext())) { using (MediaInfo mediaInfo = new MediaInfo(path)) { @@ -185,11 +183,11 @@ namespace mpvnet text += "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n"; text += "Type: " + path.Ext().ToUpper(); - core.commandv("show-text", text, "5000"); + Core.commandv("show-text", text, "5000"); return; } } - else if (ImageTypes.Contains(path.Ext())) + else if (CorePlayer.ImageTypes.Contains(path.Ext())) { using (MediaInfo mediaInfo = new MediaInfo(path)) { @@ -199,16 +197,16 @@ namespace mpvnet "Size: " + mediaInfo.GetInfo(MediaInfoStreamKind.General, "FileSize/String") + "\n" + "Type: " + path.Ext().ToUpper(); - core.commandv("show-text", text, "5000"); + Core.commandv("show-text", text, "5000"); return; } } } - TimeSpan position = TimeSpan.FromSeconds(core.get_property_number("time-pos")); - TimeSpan duration2 = TimeSpan.FromSeconds(core.get_property_number("duration")); - string videoFormat = core.get_property_string("video-format").ToUpper(); - string audioCodec = core.get_property_string("audio-codec-name").ToUpper(); + TimeSpan position = TimeSpan.FromSeconds(Core.get_property_number("time-pos")); + TimeSpan duration2 = TimeSpan.FromSeconds(Core.get_property_number("duration")); + string videoFormat = Core.get_property_string("video-format").ToUpper(); + string audioCodec = Core.get_property_string("audio-codec-name").ToUpper(); text = path.FileName() + "\n" + FormatTime(position.TotalMinutes) + ":" + @@ -222,7 +220,7 @@ namespace mpvnet text += $"{videoFormat}\n{audioCodec}"; - core.commandv("show-text", text, "5000"); + Core.commandv("show-text", text, "5000"); string FormatTime(double value) => ((int)value).ToString("00"); } catch (Exception e) @@ -230,19 +228,6 @@ namespace mpvnet App.ShowException(e); } } - - public static void ExecuteMpvCommand() // deprecated 2019 - { - InvokeOnMainThread(new Action(() => { - string command = VB.Interaction.InputBox("Enter a mpv command to be executed.", "Execute Command", RegistryHelp.GetString("RecentExecutedCommand")); - - if (string.IsNullOrEmpty(command)) - return; - - RegistryHelp.SetValue(App.RegPath, "RecentExecutedCommand", command); - core.command(command, false); - })); - } public static void OpenURL() { @@ -256,7 +241,7 @@ namespace mpvnet return; } - core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); + Core.LoadFiles(new [] { clipboard }, false, Control.ModifierKeys.HasFlag(Keys.Control)); })); } @@ -265,7 +250,7 @@ namespace mpvnet InvokeOnMainThread(new Action(() => { using (var d = new OpenFileDialog()) { - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); if (File.Exists(path)) d.InitialDirectory = Path.GetDirectoryName(path); @@ -274,7 +259,7 @@ namespace mpvnet if (d.ShowDialog() == DialogResult.OK) foreach (string filename in d.FileNames) - core.commandv("sub-add", filename); + Core.commandv("sub-add", filename); } })); } @@ -284,40 +269,40 @@ namespace mpvnet InvokeOnMainThread(new Action(() => { using (var d = new OpenFileDialog()) { - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); if (File.Exists(path)) d.InitialDirectory = Path.GetDirectoryName(path); d.Multiselect = true; if (d.ShowDialog() == DialogResult.OK) foreach (string i in d.FileNames) - core.commandv("audio-add", i); + Core.commandv("audio-add", i); } })); } public static void CycleAudio() { - MediaTrack[] audioTracks = core.MediaTracks.Where(track => track.Type == "a").ToArray(); + MediaTrack[] audioTracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray(); int len = audioTracks.Length; if (len < 1) { - core.commandv("show-text", "No audio tracks"); + Core.commandv("show-text", "No audio tracks"); return; } - int aid = core.get_property_int("aid"); + int aid = Core.get_property_int("aid"); if (len > 1) { if (++aid > len) aid = 1; - core.commandv("set", "aid", aid.ToString()); + Core.commandv("set", "aid", aid.ToString()); } - core.commandv("show-text", aid + "/" + len + ": " + audioTracks[aid - 1].Text.Substring(3), "5000"); + Core.commandv("show-text", aid + "/" + len + ": " + audioTracks[aid - 1].Text.Substring(3), "5000"); } public static void ShowCommands() @@ -341,13 +326,13 @@ namespace mpvnet } }"; - string json = core.get_property_string("command-list"); + string json = Core.get_property_string("command-list"); ShowTextWithEditor("command-list", PowerShell.InvokeAndReturnString(code, "json", json)); } public static void ShowProperties() { - var props = core.get_property_string("property-list").Split(',').OrderBy(prop => prop); + var props = Core.get_property_string("property-list").Split(',').OrderBy(prop => prop); ShowTextWithEditor("property-list", string.Join(BR, props)); } @@ -358,9 +343,9 @@ namespace mpvnet ProcessHelp.ShellExecute(file); } - public static void ScaleWindow(float factor) => core.RaiseScaleWindow(factor); + public static void ScaleWindow(float factor) => Core.RaiseScaleWindow(factor); - public static void WindowScale(float value) => core.RaiseWindowScale(value); + public static void WindowScale(float value) => Core.RaiseWindowScale(value); public static void ShowText(string text, int duration = 0, int fontSize = 0) { @@ -368,12 +353,12 @@ namespace mpvnet return; if (duration == 0) - duration = core.get_property_int("osd-duration"); + duration = Core.get_property_int("osd-duration"); if (fontSize == 0) - fontSize = core.get_property_int("osd-font-size"); + fontSize = Core.get_property_int("osd-font-size"); - core.command("show-text \"${osd-ass-cc/0}{\\\\fs" + fontSize + + Core.command("show-text \"${osd-ass-cc/0}{\\\\fs" + fontSize + "}${osd-ass-cc/1}" + text + "\" " + duration); } @@ -384,13 +369,13 @@ namespace mpvnet if (args?.Length == 1) duration = Convert.ToInt32(args[0]); - var size = core.get_property_number("osd-font-size"); - core.set_property_number("osd-font-size", 40); - core.command("show-text ${playlist} " + duration); + var size = Core.get_property_number("osd-font-size"); + Core.set_property_number("osd-font-size", 40); + Core.command("show-text ${playlist} " + duration); App.RunTask(() => { Thread.Sleep(6000); - core.set_property_number("osd-font-size", size); + Core.set_property_number("osd-font-size", size); }); } } diff --git a/src/Misc/Extension.cs b/src/Misc/Extension.cs index 520f625..f2a879d 100644 --- a/src/Misc/Extension.cs +++ b/src/Misc/Extension.cs @@ -6,7 +6,7 @@ using System.ComponentModel.Composition.Hosting; using System.IO; using System.Linq; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -33,14 +33,14 @@ namespace mpvnet if (knownExtensions.Contains(Path.GetFileName(extDir))) catalog.Catalogs.Add(new DirectoryCatalog(extDir, Path.GetFileName(extDir) + ".dll")); else - ConsoleHelp.WriteError("Failed to load extension:\n\n" + extDir + + Terminal.WriteError("Failed to load extension:\n\n" + extDir + "\n\nOnly extensions that ship with mpv.net are allowed in \\extensions" + "\n\nUser extensions have to use \\extensions" + "\n\nNever copy or install a new mpv.net version over a old mpv.net version."); } } - dir = core.ConfigFolder + "extensions"; + dir = Core.ConfigFolder + "extensions"; if (Directory.Exists(dir)) foreach (string extDir in Directory.GetDirectories(dir)) diff --git a/src/Misc/ExtensionMethods.cs b/src/Misc/ExtensionMethods.cs index 40adc11..2b0468a 100644 --- a/src/Misc/ExtensionMethods.cs +++ b/src/Misc/ExtensionMethods.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.IO; -public static class Extensions +public static class TestStringExtension { public static bool ContainsEx(this string instance, string value) { @@ -19,11 +19,14 @@ public static class Extensions return false; } +} +public static class ConvertToStringExtension +{ public static string ToUpperEx(this string instance) { if (instance != null) - return instance.ToUpper(); + return instance.ToUpperInvariant(); return ""; } @@ -31,11 +34,48 @@ public static class Extensions public static string ToLowerEx(this string instance) { if (instance != null) - return instance.ToLower(); + return instance.ToLowerInvariant(); return ""; } + public static string TrimEx(this string instance) + { + if (instance == null) + return ""; + + return instance.Trim(); + } +} + +public static class ConvertStringExtension +{ + public static int ToInt(this string instance) + { + int.TryParse(instance, out int result); + return result; + } + + public static float ToFloat(this string instance) + { + float.TryParse(instance.Replace(",", "."), NumberStyles.Float, + CultureInfo.InvariantCulture, out float result); + + return result; + } +} + +public static class PathStringExtension +{ + // return extension with lower case and without dot. + public static string Ext(this string instance) + { + if (instance == null) + return ""; + + return Path.GetExtension(instance).TrimStart('.').ToLower(); + } + public static string FileName(this string instance) { if (string.IsNullOrEmpty(instance)) @@ -54,25 +94,23 @@ public static class Extensions return instance; } - public static string Ext(this string instance) + // Ensure trailing directory separator char + public static string AddSep(this string instance) { - if (instance == null) + if (string.IsNullOrEmpty(instance)) return ""; - return Path.GetExtension(instance).TrimStart('.').ToLower(); + if (!instance.EndsWith(Path.DirectorySeparatorChar.ToString())) + instance = instance + Path.DirectorySeparatorChar; + + return instance; } - public static int ToInt(this string instance) + public static bool IsIdenticalFolder(this string instance, string testFolder) { - int.TryParse(instance, out int result); - return result; - } + if (string.IsNullOrEmpty(instance) || string.IsNullOrEmpty(testFolder)) + return false; - public static float ToFloat(this string instance) - { - float.TryParse(instance.Replace(",", "."), NumberStyles.Float, - CultureInfo.InvariantCulture, out float result); - - return result; + return instance.ToLowerInvariant().AddSep() == testFolder.ToLowerInvariant().AddSep(); } } diff --git a/src/Misc/Global.cs b/src/Misc/Global.cs new file mode 100644 index 0000000..61d3250 --- /dev/null +++ b/src/Misc/Global.cs @@ -0,0 +1,13 @@ + +using System; + +namespace mpvnet +{ + public class Global + { + public static string BR = Environment.NewLine; + public static string BR2 = Environment.NewLine + Environment.NewLine; + + public static CorePlayer Core { get; } = new CorePlayer(); + } +} diff --git a/src/Misc/GlobalHotkey.cs b/src/Misc/GlobalHotkey.cs index 43ddeb9..af8bfcd 100644 --- a/src/Misc/GlobalHotkey.cs +++ b/src/Misc/GlobalHotkey.cs @@ -5,7 +5,7 @@ using System.ComponentModel; using System.IO; using System.Runtime.InteropServices; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -18,7 +18,7 @@ namespace mpvnet public static void RegisterGlobalHotkeys(IntPtr hwnd) { HWND = hwnd; - string path = core.ConfigFolder + "global-input.conf"; + string path = Core.ConfigFolder + "global-input.conf"; if (!File.Exists(path)) return; @@ -82,14 +82,14 @@ namespace mpvnet bool success = RegisterHotKey(HWND, ID++, mod, vk); if (!success) - ConsoleHelp.WriteError(line + ": " + new Win32Exception().Message + "\n", "global-input.conf"); + Terminal.WriteError(line + ": " + new Win32Exception().Message + "\n", "global-input.conf"); } } public static void Execute(int id) { if (Commands.ContainsKey(id)) - core.command(Commands[id]); + Core.command(Commands[id]); } static int mpv_to_VK(string value) diff --git a/src/Misc/Help.cs b/src/Misc/Help.cs index c6200bd..054dbd2 100644 --- a/src/Misc/Help.cs +++ b/src/Misc/Help.cs @@ -7,8 +7,7 @@ using System.Windows.Forms; using Microsoft.Win32; -using static mpvnet.Core; -using static mpvnet.NewLine; +using static mpvnet.Global; namespace mpvnet { @@ -37,55 +36,6 @@ namespace mpvnet } } - public static class ConsoleHelp - { - public static int Padding { get; set; } - - public static void WriteError(object obj, string module = "mpv.net") - { - Write(obj, module, ConsoleColor.DarkRed, false); - } - - public static void Write(object obj, string module = "mpv.net") - { - Write(obj, module, ConsoleColor.Black, true); - } - - public static void Write(object obj, string module, ConsoleColor color) - { - Write(obj, module, color, false); - } - - public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor) - { - if (obj == null) - return; - - string value = obj.ToString(); - - if (!string.IsNullOrEmpty(module)) - module = "[" + module + "] "; - - if (useDefaultColor) - Console.ResetColor(); - else - Console.ForegroundColor = color; - - value = module + value; - - if (Padding > 0 && value.Length < Padding) - value = value.PadRight(Padding); - - if (color == ConsoleColor.Red || color == ConsoleColor.DarkRed) - Console.Error.WriteLine(value); - else - Console.WriteLine(value); - - Console.ResetColor(); - Trace.WriteLine(obj); - } - } - public class CursorHelp { static bool IsVisible = true; @@ -134,7 +84,7 @@ namespace mpvnet '' }"; - string json = core.get_property_string("profile-list"); + string json = Core.get_property_string("profile-list"); return PowerShell.InvokeAndReturnString(code, "json", json).Trim(); } @@ -146,19 +96,19 @@ namespace mpvnet $item.codec + ' - ' + $item.description }"; - string json = core.get_property_string("decoder-list"); + string json = Core.get_property_string("decoder-list"); return PowerShell.InvokeAndReturnString(code, "json", json).Trim(); } public static string GetProtocols() { - string list = core.get_property_string("protocol-list"); + string list = Core.get_property_string("protocol-list"); return string.Join(BR, list.Split(',').OrderBy(a => a)); } public static string GetDemuxers() { - string list = core.get_property_string("demuxer-lavf-list"); + string list = Core.get_property_string("demuxer-lavf-list"); return string.Join(BR, list.Split(',').OrderBy(a => a)); } } @@ -172,6 +122,17 @@ namespace mpvnet SetValue(ApplicationKey, name, value); } + public static void SetString(string name, string value) + { + SetValue(ApplicationKey, name, value); + } + + public static void SetValue(string name, object value) + { + using (RegistryKey regKey = GetRootKey(ApplicationKey).CreateSubKey(ApplicationKey.Substring(5), RegistryKeyPermissionCheck.ReadWriteSubTree)) + regKey.SetValue(name, value); + } + public static void SetValue(string path, string name, object value) { using (RegistryKey regKey = GetRootKey(path).CreateSubKey(path.Substring(5), RegistryKeyPermissionCheck.ReadWriteSubTree)) @@ -190,6 +151,8 @@ namespace mpvnet return !(value is int) ? defaultValue : (int)value; } + public static object GetValue(string name) => GetValue(ApplicationKey, name, null); + public static object GetValue(string path, string name, object defaultValue = null) { using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5))) diff --git a/src/Misc/Misc.cs b/src/Misc/Misc.cs index 85f318f..c004f37 100644 --- a/src/Misc/Misc.cs +++ b/src/Misc/Misc.cs @@ -13,16 +13,10 @@ using System.Windows.Forms; using Microsoft.Win32; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { - public static class NewLine - { - public static string BR = Environment.NewLine; - public static string BR2 = Environment.NewLine + Environment.NewLine; - } - public class Sys { public static bool IsDarkTheme { @@ -102,13 +96,13 @@ namespace mpvnet RegistryHelp.SetValue($@"HKCR\" + "." + ext, null, ExeFilenameNoExt + "." + ext); RegistryHelp.SetValue($@"HKCR\" + "." + ext + @"\OpenWithProgIDs", ExeFilenameNoExt + "." + ext, ""); - if (VideoTypes.Contains(ext)) + if (CorePlayer.VideoTypes.Contains(ext)) RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "video"); - if (AudioTypes.Contains(ext)) + if (CorePlayer.AudioTypes.Contains(ext)) RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "audio"); - if (ImageTypes.Contains(ext)) + if (CorePlayer.ImageTypes.Contains(ext)) RegistryHelp.SetValue(@"HKCR\" + "." + ext, "PerceivedType", "image"); RegistryHelp.SetValue($@"HKCR\" + ExeFilenameNoExt + "." + ext + @"\shell\open\command", null, $"\"{ExePath}\" \"%1\""); @@ -203,7 +197,7 @@ namespace mpvnet public static ObservableCollection Items { get { if (_Items is null) - _Items = GetItems(File.ReadAllText(core.InputConfPath)); + _Items = GetItems(File.ReadAllText(Core.InputConfPath)); return _Items; } @@ -212,6 +206,26 @@ namespace mpvnet public class Folder { - public static string Startup { get; } = Application.StartupPath + @"\"; + public static string Startup { get; } = Application.StartupPath.AddSep(); + public static string AppData { get; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).AddSep(); + + public static string CustomSettings { + get { + string linkFile = Startup + "settings-directory.txt"; + + if (File.Exists(linkFile)) + { + string linkTarget = File.ReadAllText(linkFile).Trim(); + + if (linkTarget.StartsWithEx(".")) + linkTarget = Startup + linkTarget; + + if (Directory.Exists(linkTarget)) + return linkTarget.AddSep(); + } + + return ""; + } + } } } diff --git a/src/Misc/Msg.cs b/src/Misc/Msg.cs new file mode 100644 index 0000000..d4cc5bc --- /dev/null +++ b/src/Misc/Msg.cs @@ -0,0 +1,39 @@ + +using System; +using System.Windows.Forms; + +public class Msg +{ + public static void ShowInfo(object title, object content = null) + { + Show(title, content, MessageBoxIcon.Information); + } + + public static void ShowError(object title, object content = null) + { + Show(title, content, MessageBoxIcon.Error); + } + + public static void ShowWarning(object title, object content = null) + { + Show(title, content, MessageBoxIcon.Warning); + } + + public static DialogResult ShowQuestion(object title, object content = null, + MessageBoxButtons buttons = MessageBoxButtons.OKCancel) + { + return Show(title, content, MessageBoxIcon.Question, buttons); + } + + public static void ShowException(Exception exception) + { + Show(exception, null, MessageBoxIcon.Error); + } + + public static DialogResult Show(object title, object content, MessageBoxIcon icon, + MessageBoxButtons buttons = MessageBoxButtons.OK) + { + string msg = (title?.ToString().TrimEx() + "\n\n" + content?.ToString().TrimEx()).Trim(); + return MessageBox.Show(msg, Application.ProductName, buttons, icon); + } +} diff --git a/src/Misc/PowerShell.cs b/src/Misc/PowerShell.cs index e700fd5..ea1582d 100644 --- a/src/Misc/PowerShell.cs +++ b/src/Misc/PowerShell.cs @@ -6,8 +6,7 @@ using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Threading; -using static mpvnet.Core; -using static mpvnet.NewLine; +using static mpvnet.Global; namespace mpvnet { @@ -90,7 +89,7 @@ namespace mpvnet var output = sender as PipelineReader; while (output.Count > 0) - ConsoleHelp.Write(output.Read(), Module); + Terminal.Write(output.Read(), Module); } public void Error_DataReady(object sender, EventArgs e) @@ -98,7 +97,7 @@ namespace mpvnet var output = sender as PipelineReader; while (output.Count > 0) - ConsoleHelp.WriteError(output.Read(), Module); + Terminal.WriteError(output.Read(), Module); } public void RedirectStreams(PSEventJob job) @@ -110,25 +109,25 @@ namespace mpvnet } } - public void commandv(params string[] args) => core.commandv(args); + public void commandv(params string[] args) => Core.commandv(args); - public void command(string command) => core.command(command); + public void command(string command) => Core.command(command); - public bool get_property_bool(string name) => core.get_property_bool(name); + public bool get_property_bool(string name) => Core.get_property_bool(name); - public void set_property_bool(string name, bool value) => core.set_property_bool(name, value); + public void set_property_bool(string name, bool value) => Core.set_property_bool(name, value); - public int get_property_int(string name) => core.get_property_int(name); + public int get_property_int(string name) => Core.get_property_int(name); - public void set_property_int(string name, int value) => core.set_property_int(name, value); + public void set_property_int(string name, int value) => Core.set_property_int(name, value); - public double get_property_number(string name) => core.get_property_number(name); + public double get_property_number(string name) => Core.get_property_number(name); - public void set_property_number(string name, double value) => core.set_property_number(name, value); + public void set_property_number(string name, double value) => Core.set_property_number(name, value); - public string get_property_string(string name) => core.get_property_string(name); + public string get_property_string(string name) => Core.get_property_string(name); - public void set_property_string(string name, string value) => core.set_property_string(name, value); + public void set_property_string(string name, string value) => Core.set_property_string(name, value); public void observe_property(string name, string type, ScriptBlock sb) { @@ -137,19 +136,19 @@ namespace mpvnet switch (type) { case "bool": case "boolean": - core.observe_property_bool(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); + Core.observe_property_bool(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); break; case "string": - core.observe_property_string(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); + Core.observe_property_string(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); break; case "int": case "integer": - core.observe_property_int(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); + Core.observe_property_int(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); break; case "float": case "double": - core.observe_property_double(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); + Core.observe_property_double(name, value => App.RunTask(() => PropertyChanged.Invoke(name, value))); break; case "nil": case "none": case "native": - core.observe_property(name, () => App.RunTask(() => PropertyChanged.Invoke(name, null))); + Core.observe_property(name, () => App.RunTask(() => PropertyChanged.Invoke(name, null))); break; default: App.ShowError("Invalid Type", "Valid types are: bool or boolean, string, int or integer, float or double, nil or none or native"); @@ -164,59 +163,59 @@ namespace mpvnet switch (name) { case "log-message": - core.LogMessageAsync += (level, msg) => Event.Invoke("log-message", new object[] { level, msg }); + Core.LogMessageAsync += (level, msg) => Event.Invoke("log-message", new object[] { level, msg }); break; case "end-file": - core.EndFileAsync += reason => Event.Invoke("end-file", new object[] { reason }); + Core.EndFileAsync += reason => Event.Invoke("end-file", new object[] { reason }); break; case "client-message": - core.ClientMessageAsync += args => Event.Invoke("client-message", args); + Core.ClientMessageAsync += args => Event.Invoke("client-message", args); break; case "shutdown": - core.Shutdown += () => Event.Invoke("shutdown", null); + Core.Shutdown += () => Event.Invoke("shutdown", null); break; case "get-property-reply": - core.GetPropertyReplyAsync += () => Event.Invoke("get-property-reply", null); + Core.GetPropertyReplyAsync += () => Event.Invoke("get-property-reply", null); break; case "set-property-reply": - core.SetPropertyReplyAsync += () => Event.Invoke("set-property-reply", null); + Core.SetPropertyReplyAsync += () => Event.Invoke("set-property-reply", null); break; case "command-reply": - core.CommandReplyAsync += () => Event.Invoke("command-reply", null); + Core.CommandReplyAsync += () => Event.Invoke("command-reply", null); break; case "start-file": - core.StartFileAsync += () => Event.Invoke("start-file", null); + Core.StartFileAsync += () => Event.Invoke("start-file", null); break; case "file-loaded": - core.FileLoadedAsync += () => Event.Invoke("file-loaded", null); + Core.FileLoadedAsync += () => Event.Invoke("file-loaded", null); break; case "idle": - core.IdleAsync += () => Event.Invoke("idle", null); + Core.IdleAsync += () => Event.Invoke("idle", null); break; case "video-reconfig": - core.VideoReconfigAsync += () => Event.Invoke("video-reconfig", null); + Core.VideoReconfigAsync += () => Event.Invoke("video-reconfig", null); break; case "audio-reconfig": - core.AudioReconfigAsync += () => Event.Invoke("audio-reconfig", null); + Core.AudioReconfigAsync += () => Event.Invoke("audio-reconfig", null); break; case "seek": - core.SeekAsync += () => Event.Invoke("seek", null); + Core.SeekAsync += () => Event.Invoke("seek", null); break; case "playback-restart": - core.PlaybackRestartAsync += () => Event.Invoke("playback-restart", null); + Core.PlaybackRestartAsync += () => Event.Invoke("playback-restart", null); break; } } @@ -224,13 +223,13 @@ namespace mpvnet void Output_DataAdded(object sender, DataAddedEventArgs e) { var output = sender as PSDataCollection; - ConsoleHelp.Write(output[e.Index], Module); + Terminal.Write(output[e.Index], Module); } void Error_DataAdded(object sender, DataAddedEventArgs e) { var error = sender as PSDataCollection; - ConsoleHelp.WriteError(error[e.Index], Module); + Terminal.WriteError(error[e.Index], Module); } } diff --git a/src/Misc/Program.cs b/src/Misc/Program.cs index 89892ea..9b09d8d 100644 --- a/src/Misc/Program.cs +++ b/src/Misc/Program.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Threading; using System.Diagnostics; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -23,7 +23,7 @@ namespace mpvnet if (App.IsStartedFromTerminal) Native.AttachConsole(-1 /*ATTACH_PARENT_PROCESS*/); - if (core.ConfigFolder == "") + if (Core.ConfigFolder == "") return; string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray(); @@ -31,11 +31,11 @@ namespace mpvnet if (args.Length >= 2 && args[0] == "--reg-file-assoc") { if (args[1] == "audio") - FileAssociation.Register(Core.AudioTypes); + FileAssociation.Register(CorePlayer.AudioTypes); else if (args[1] == "video") - FileAssociation.Register(Core.VideoTypes); + FileAssociation.Register(CorePlayer.VideoTypes); else if (args[1] == "image") - FileAssociation.Register(Core.ImageTypes); + FileAssociation.Register(CorePlayer.ImageTypes); else FileAssociation.Register(args.Skip(1).ToArray()); diff --git a/src/Misc/Terminal.cs b/src/Misc/Terminal.cs new file mode 100644 index 0000000..1063034 --- /dev/null +++ b/src/Misc/Terminal.cs @@ -0,0 +1,50 @@ + +using System; +using System.Diagnostics; + +namespace mpvnet +{ + public static class Terminal + { + static int Padding { get; } = 60; + + public static void WriteError(object obj, string module = "mpv.net") + { + Write(obj, module, ConsoleColor.DarkRed, false); + } + + public static void Write(object obj, string module = "mpv.net") + { + Write(obj, module, ConsoleColor.Black, true); + } + + public static void Write(object obj, string module, ConsoleColor color, bool useDefaultColor) + { + if (obj == null) + return; + + string value = obj.ToString(); + + if (!string.IsNullOrEmpty(module)) + module = "[" + module + "] "; + + if (useDefaultColor) + Console.ResetColor(); + else + Console.ForegroundColor = color; + + value = module + value; + + if (value.Length < Padding) + value = value.PadRight(Padding); + + if (color == ConsoleColor.Red || color == ConsoleColor.DarkRed) + Console.Error.WriteLine(value); + else + Console.WriteLine(value); + + Console.ResetColor(); + Trace.WriteLine(obj); + } + } +} diff --git a/src/Misc/Theme.cs b/src/Misc/Theme.cs index 087f577..afba4c3 100644 --- a/src/Misc/Theme.cs +++ b/src/Misc/Theme.cs @@ -45,7 +45,7 @@ namespace mpvnet if (!theme.Dictionary.ContainsKey(key)) { isKeyMissing = true; - ConsoleHelp.WriteError($"Theme '{activeTheme}' misses '{key}'"); + Terminal.WriteError($"Theme '{activeTheme}' misses '{key}'"); break; } } diff --git a/src/Misc/UpdateCheck.cs b/src/Misc/UpdateCheck.cs index 5ff386a..f04a7ed 100644 --- a/src/Misc/UpdateCheck.cs +++ b/src/Misc/UpdateCheck.cs @@ -7,8 +7,7 @@ using System.Reflection; using System.Text.RegularExpressions; using System.Windows.Forms; -using static mpvnet.Core; -using static TaskDialog.Msg; +using static mpvnet.Global; namespace mpvnet { @@ -16,7 +15,7 @@ namespace mpvnet { public static void DailyCheck() { - if (App.UpdateCheck && RegistryHelp.GetInt("UpdateCheckLast") + if (App.UpdateCheck && RegistryHelp.GetInt("last-update-check") != DateTime.Now.DayOfYear) CheckOnline(); @@ -28,26 +27,33 @@ namespace mpvnet { using (HttpClient client = new HttpClient()) { - RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "UpdateCheckLast", DateTime.Now.DayOfYear); + RegistryHelp.SetValue("last-update-check", DateTime.Now.DayOfYear); client.DefaultRequestHeaders.Add("User-Agent", "mpv.net"); var response = await client.GetAsync("https://api.github.com/repos/stax76/mpv.net/releases/latest"); response.EnsureSuccessStatusCode(); string content = await response.Content.ReadAsStringAsync(); Match match = Regex.Match(content, @"""mpv\.net-([\d\.]+)-portable\.zip"""); + + if (!match.Success) + { + App.ShowError("Update check is currently not available."); + return; + } + Version onlineVersion = Version.Parse(match.Groups[1].Value); Version currentVersion = Assembly.GetEntryAssembly().GetName().Version; if (onlineVersion <= currentVersion) { if (showUpToDateMessage) - MsgInfo($"{Application.ProductName} is up to date."); + Msg.ShowInfo($"{Application.ProductName} is up to date."); return; } - if ((RegistryHelp.GetString("UpdateCheckVersion") + if ((RegistryHelp.GetString("update-check-version") != onlineVersion.ToString() || showUpToDateMessage) && Msg.ShowQuestion( - $"New version {onlineVersion} is available, update now?") == MsgResult.OK) + $"New version {onlineVersion} is available, update now?") == DialogResult.OK) { string url = $"https://github.com/stax76/mpv.net/releases/download/{onlineVersion}/mpv.net-{onlineVersion}-portable.zip"; @@ -64,16 +70,16 @@ namespace mpvnet proc.Start(); } - core.command("quit"); + Core.command("quit"); } - RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "UpdateCheckVersion", onlineVersion.ToString()); + RegistryHelp.SetValue("update-check-version", onlineVersion.ToString()); } } catch (Exception ex) { if (showUpToDateMessage) - Msg.ShowException(ex); + App.ShowException(ex); } } } diff --git a/src/Native/Native.cs b/src/Native/Native.cs index 7e838b3..93d587f 100644 --- a/src/Native/Native.cs +++ b/src/Native/Native.cs @@ -3,153 +3,157 @@ using System; using System.Drawing; using System.Runtime.InteropServices; -public class Native +namespace mpvnet { - static Version Windows_10_1607 = new Version(10, 0, 14393); // Windows 10 1607 - - [DllImport("kernel32.dll")] - public static extern bool AttachConsole(int dwProcessId); - - [DllImport("kernel32.dll")] - public static extern bool FreeConsole(); - - [DllImport("kernel32.dll")] - public static extern IntPtr LoadLibrary(string path); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr FindWindowEx( - IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref COPYDATASTRUCT lParam); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern IntPtr PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern int RegisterWindowMessage(string id); - - [DllImport("user32.dll")] - public static extern bool AllowSetForegroundWindow(int dwProcessId); - - [DllImport("user32.dll")] - public static extern void ReleaseCapture(); - - [DllImport("user32.dll")] - public static extern int GetDpiForWindow(IntPtr hwnd); - - [DllImport("user32.dll")] - public static extern bool AdjustWindowRect(ref RECT lpRect, uint dwStyle, bool bMenu); - - [DllImport("user32.dll")] - public static extern bool AdjustWindowRectExForDpi( - ref RECT lpRect, uint dwStyle, bool bMenu, uint dwExStyle, uint dpi); - - [DllImport("user32.dll")] - public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags); - - [DllImport("user32.dll", EntryPoint = "GetWindowLong")] - static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex); - - [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] - static extern IntPtr GetWindowLong64(IntPtr hWnd, int nIndex); - - public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex) + public class Native { - if (IntPtr.Size == 8) - return GetWindowLong64(hWnd, nIndex); - else - return GetWindowLong32(hWnd, nIndex); - } + static Version Windows_10_1607 = new Version(10, 0, 14393); // Windows 10 1607 - [DllImport("gdi32.dll")] - public static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + [DllImport("kernel32.dll")] + public static extern bool AttachConsole(int dwProcessId); - [StructLayout(LayoutKind.Sequential)] - public struct RECT - { - public int Left; - public int Top; - public int Right; - public int Bottom; + [DllImport("kernel32.dll")] + public static extern bool FreeConsole(); - public RECT(Rectangle r) + [DllImport("kernel32.dll")] + public static extern IntPtr LoadLibrary(string path); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr FindWindowEx( + IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref COPYDATASTRUCT lParam); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern IntPtr PostMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Unicode)] + public static extern int RegisterWindowMessage(string id); + + [DllImport("user32.dll")] + public static extern bool AllowSetForegroundWindow(int dwProcessId); + + [DllImport("user32.dll")] + public static extern void ReleaseCapture(); + + [DllImport("user32.dll")] + public static extern int GetDpiForWindow(IntPtr hwnd); + + [DllImport("user32.dll")] + public static extern bool AdjustWindowRect(ref RECT lpRect, uint dwStyle, bool bMenu); + + [DllImport("user32.dll")] + public static extern bool AdjustWindowRectExForDpi( + ref RECT lpRect, uint dwStyle, bool bMenu, uint dwExStyle, uint dpi); + + [DllImport("user32.dll")] + public static extern bool SetWindowPos( + IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags); + + [DllImport("user32.dll", EntryPoint = "GetWindowLong")] + static extern IntPtr GetWindowLong32(IntPtr hWnd, int nIndex); + + [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")] + static extern IntPtr GetWindowLong64(IntPtr hWnd, int nIndex); + + public static IntPtr GetWindowLong(IntPtr hWnd, int nIndex) { - Left = r.Left; - Top = r.Top; - Right = r.Right; - Bottom = r.Bottom; + if (IntPtr.Size == 8) + return GetWindowLong64(hWnd, nIndex); + else + return GetWindowLong32(hWnd, nIndex); } - public RECT(int left, int top, int right, int bottom) + [DllImport("gdi32.dll")] + public static extern int GetDeviceCaps(IntPtr hdc, int nIndex); + + [StructLayout(LayoutKind.Sequential)] + public struct RECT { - Left = left; - Top = top; - Right = right; - Bottom = bottom; + public int Left; + public int Top; + public int Right; + public int Bottom; + + public RECT(Rectangle r) + { + Left = r.Left; + Top = r.Top; + Right = r.Right; + Bottom = r.Bottom; + } + + public RECT(int left, int top, int right, int bottom) + { + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + + public Rectangle ToRectangle() => Rectangle.FromLTRB(Left, Top, Right, Bottom); + public Size Size => new Size(Right - Left, Bottom - Top); + public int Width => Right - Left; + public int Height => Bottom - Top; } - public Rectangle ToRectangle() => Rectangle.FromLTRB(Left, Top, Right, Bottom); - public Size Size => new Size(Right - Left, Bottom - Top); - public int Width => Right - Left; - public int Height => Bottom - Top; - } - - [StructLayout(LayoutKind.Sequential)] - public struct COPYDATASTRUCT - { - public IntPtr dwData; - public int cbData; - [MarshalAs(UnmanagedType.LPTStr)] - public string lpData; - } - - public static int GetResizeBorder(int v) - { - switch (v) + [StructLayout(LayoutKind.Sequential)] + public struct COPYDATASTRUCT { - case 1 /* WMSZ_LEFT */ : return 3; - case 3 /* WMSZ_TOP */ : return 2; - case 2 /* WMSZ_RIGHT */ : return 3; - case 6 /* WMSZ_BOTTOM */ : return 2; - case 4 /* WMSZ_TOPLEFT */ : return 1; - case 5 /* WMSZ_TOPRIGHT */ : return 1; - case 7 /* WMSZ_BOTTOMLEFT */ : return 3; - case 8 /* WMSZ_BOTTOMRIGHT */ : return 3; - default: return -1; + public IntPtr dwData; + public int cbData; + [MarshalAs(UnmanagedType.LPTStr)] + public string lpData; } - } - public static void SubtractWindowBorders(IntPtr hwnd, ref RECT rc, int dpi) - { - RECT r = new RECT(0, 0, 0, 0); - AddWindowBorders(hwnd, ref r, dpi); - rc.Left -= r.Left; - rc.Top -= r.Top; - rc.Right -= r.Right; - rc.Bottom -= r.Bottom; - } + public static int GetResizeBorder(int v) + { + switch (v) + { + case 1 /* WMSZ_LEFT */ : return 3; + case 3 /* WMSZ_TOP */ : return 2; + case 2 /* WMSZ_RIGHT */ : return 3; + case 6 /* WMSZ_BOTTOM */ : return 2; + case 4 /* WMSZ_TOPLEFT */ : return 1; + case 5 /* WMSZ_TOPRIGHT */ : return 1; + case 7 /* WMSZ_BOTTOMLEFT */ : return 3; + case 8 /* WMSZ_BOTTOMRIGHT */ : return 3; + default: return -1; + } + } - public static void AddWindowBorders(IntPtr hwnd, ref RECT rc, int dpi) - { - uint windowStyle = (uint)GetWindowLong(hwnd, -16); // GWL_STYLE - uint windowStyleEx = (uint)GetWindowLong(hwnd, -20); // GWL_EXSTYLE + public static void SubtractWindowBorders(IntPtr hwnd, ref RECT rc, int dpi) + { + RECT r = new RECT(0, 0, 0, 0); + AddWindowBorders(hwnd, ref r, dpi); + rc.Left -= r.Left; + rc.Top -= r.Top; + rc.Right -= r.Right; + rc.Bottom -= r.Bottom; + } - if (Environment.OSVersion.Version >= Windows_10_1607) - AdjustWindowRectExForDpi(ref rc, windowStyle, false, windowStyleEx, (uint)dpi); - else - AdjustWindowRect(ref rc, windowStyle, false); - } + public static void AddWindowBorders(IntPtr hwnd, ref RECT rc, int dpi) + { + uint windowStyle = (uint)GetWindowLong(hwnd, -16); // GWL_STYLE + uint windowStyleEx = (uint)GetWindowLong(hwnd, -20); // GWL_EXSTYLE - public static int GetDPI(IntPtr hwnd) - { - if (Environment.OSVersion.Version >= Windows_10_1607) - return GetDpiForWindow(hwnd); - else - using (Graphics gx = Graphics.FromHwnd(hwnd)) - return GetDeviceCaps(gx.GetHdc(), 88 /*LOGPIXELSX*/); + if (Environment.OSVersion.Version >= Windows_10_1607) + AdjustWindowRectExForDpi(ref rc, windowStyle, false, windowStyleEx, (uint)dpi); + else + AdjustWindowRect(ref rc, windowStyle, false); + } + + public static int GetDPI(IntPtr hwnd) + { + if (Environment.OSVersion.Version >= Windows_10_1607) + return GetDpiForWindow(hwnd); + else + using (Graphics gx = Graphics.FromHwnd(hwnd)) + return GetDeviceCaps(gx.GetHdc(), 88 /*LOGPIXELSX*/); + } } } diff --git a/src/Native/TaskDialog.cs b/src/Native/TaskDialog.cs deleted file mode 100644 index 4428a21..0000000 --- a/src/Native/TaskDialog.cs +++ /dev/null @@ -1,674 +0,0 @@ - -using System; -using System.Runtime.InteropServices; -using System.Text; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; -using System.Threading; -using System.Windows.Forms; - -public class Msg -{ - static string ShownMessages; - - public static string SupportURL { get; set; } - - public static void Show(string mainInstruction, string content = null) - { - Msg.Show(mainInstruction, content, MsgIcon.Info, MsgButtons.Ok, MsgResult.None); - } - - public static void ShowError(string mainInstruction, string content = null) - { - try - { - using (TaskDialog td = new TaskDialog()) - { - td.AllowCancel = false; - - if (string.IsNullOrEmpty(content)) - { - if (mainInstruction.Length < 80) - td.MainInstruction = mainInstruction; - else - td.Content = mainInstruction; - } - else - { - td.MainInstruction = mainInstruction; - td.Content = content; - } - - td.MainIcon = MsgIcon.Error; - td.Footer = "[Copy Message](copymsg)"; - - if (!string.IsNullOrEmpty(Msg.SupportURL)) - td.Footer += $" [Contact Support]({SupportURL})"; - - td.Show(); - } - } - catch (Exception e) - { - MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e, - Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - public static void ShowException(Exception exception) - { - try - { - using (TaskDialog td = new TaskDialog()) - { - td.MainInstruction = exception.GetType().Name; - td.Content = exception.Message; - td.MainIcon = MsgIcon.Error; - td.ExpandedInformation = exception.StackTrace; - td.Footer = "[Copy Message](copymsg)"; - - if (!string.IsNullOrEmpty(Msg.SupportURL)) - td.Footer += $" [Contact Support]({SupportURL})"; - - td.Show(); - } - } - catch (Exception e) - { - MessageBox.Show(e.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - public static void ShowWarning( - string mainInstruction, - string content = null, - bool onlyOnce = false) - { - if (onlyOnce && Msg.ShownMessages != null && - Msg.ShownMessages.Contains(mainInstruction + content)) - return; - - Msg.Show(mainInstruction, content, MsgIcon.Warning, MsgButtons.Ok, MsgResult.None); - - if (!onlyOnce) - return; - - Msg.ShownMessages += mainInstruction + content; - } - - public static MsgResult ShowQuestion( - string mainInstruction, MsgButtons buttons = MsgButtons.OkCancel) - { - return Msg.Show(mainInstruction, null, MsgIcon.None, buttons, MsgResult.None); - } - - public static MsgResult ShowQuestion( - string mainInstruction, string content, MsgButtons buttons = MsgButtons.OkCancel) - { - return Msg.Show(mainInstruction, content, MsgIcon.None, buttons, MsgResult.None); - } - - public static MsgResult Show( - string mainInstruction, - string content, - MsgIcon icon, - MsgButtons buttons, - MsgResult defaultButton = MsgResult.None) - { - try - { - using (TaskDialog td = new TaskDialog()) - { - td.AllowCancel = false; - td.DefaultButton = defaultButton; - td.MainIcon = icon; - - if (content == null) - { - if (mainInstruction.Length < 80) - td.MainInstruction = mainInstruction; - else - td.Content = mainInstruction; - } - else - { - td.MainInstruction = mainInstruction; - td.Content = content; - } - if (buttons == MsgButtons.OkCancel) - { - td.AddButton("OK", MsgResult.OK); - td.AddButton("Cancel", MsgResult.Cancel); - } - else - td.CommonButtons = buttons; - return td.Show(); - } - } - catch (Exception e) - { - return (MsgResult)MessageBox.Show(e.GetType().Name + "\n\n" + e.Message + "\n\n" + e, - Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } -} - -public class TaskDialog : TaskDialogNative, IDisposable -{ - Dictionary IdValueDic; - Dictionary IdTextDic; - List CommandLinkShieldList; - IntPtr ButtonArray; - IntPtr RadioButtonArray; - T SelectedValueValue; - string SelectedTextValue; - int TimeoutValue; - int ExitTickCount; - bool Disposed; - List Buttons; - List RadioButtons; - TaskDialogNative.TASKDIALOGCONFIG Config; - - const int TDE_CONTENT = 0; - const int TDE_EXPANDED_INFORMATION = 1; - const int TDE_FOOTER = 2; - const int TDE_MAIN_INSTRUCTION = 3; - const int TDN_CREATED = 0; - const int TDN_NAVIGATED = 1; - const int TDN_BUTTON_CLICKED = 2; - const int TDN_HYPERLINK_CLICKED = 3; - const int TDN_TIMER = 4; - const int TDN_DESTROYED = 5; - const int TDN_RADIO_BUTTON_CLICKED = 6; - const int TDN_DIALOG_CONSTRUCTED = 7; - const int TDN_VERIFICATION_CLICKED = 8; - const int TDN_HELP = 9; - const int TDN_EXPANDO_BUTTON_CLICKED = 10; - const int TDM_NAVIGATE_PAGE = 1125; - const int TDM_CLICK_BUTTON = 1126; - const int TDM_SET_MARQUEE_PROGRESS_BAR = 1127; - const int TDM_SET_PROGRESS_BAR_STATE = 1128; - const int TDM_SET_PROGRESS_BAR_RANGE = 1129; - const int TDM_SET_PROGRESS_BAR_POS = 1130; - const int TDM_SET_PROGRESS_BAR_MARQUEE = 1131; - const int TDM_SET_ELEMENT_TEXT = 1132; - const int TDM_CLICK_RADIO_BUTTON = 1134; - const int TDM_ENABLE_BUTTON = 1135; - const int TDM_ENABLE_RADIO_BUTTON = 1136; - const int TDM_CLICK_VERIFICATION = 1137; - const int TDM_UPDATE_ELEMENT_TEXT = 1138; - const int TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = 1139; - const int TDM_UPDATE_ICON = 1140; - - public TaskDialog() - { - IdValueDic = new Dictionary(); - IdTextDic = new Dictionary(); - CommandLinkShieldList = new List(); - Buttons = new List(); - RadioButtons = new List(); - _SelectedID = -1; - Config = new TaskDialogNative.TASKDIALOGCONFIG(); - Config.cbSize = (uint)Marshal.SizeOf(Config); - Config.hwndParent = GetHandle(); - Config.hInstance = IntPtr.Zero; - Config.dwFlags = TaskDialogNative.TASKDIALOG_FLAGS.TDF_ALLOW_DIALOG_CANCELLATION; - Config.dwCommonButtons = MsgButtons.None; - Config.MainIcon = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION(0); - Config.FooterIcon = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION(0); - Config.cxWidth = 0U; - Config.cButtons = 0U; - Config.cRadioButtons = 0U; - Config.pButtons = IntPtr.Zero; - Config.pRadioButtons = IntPtr.Zero; - Config.nDefaultButton = 0; - Config.nDefaultRadioButton = 0; - Config.pszWindowTitle = ((AssemblyProductAttribute)Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), true)[0]).Product; - Config.pszMainInstruction = ""; - Config.pszContent = ""; - Config.pfCallback = new PFTASKDIALOGCALLBACK(this.DialogProc); - } - - public IntPtr GetHandle() - { - StringBuilder lpszFileName = new StringBuilder(260); - IntPtr foregroundWindow = TaskDialogNative.GetForegroundWindow(); - TaskDialogNative.GetWindowModuleFileName(foregroundWindow, lpszFileName, 260U); - - if (Path.GetFileName(lpszFileName.ToString().Replace(".vshost", "")) == - Path.GetFileName(Assembly.GetEntryAssembly().Location)) - - return foregroundWindow; - - return IntPtr.Zero; - } - - public bool AllowCancel { - set { - if (value) - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_ALLOW_DIALOG_CANCELLATION; - else - Config.dwFlags ^= TaskDialogNative.TASKDIALOG_FLAGS.TDF_ALLOW_DIALOG_CANCELLATION; - } - } - - public string MainInstruction { - get => Config.pszMainInstruction; - set => Config.pszMainInstruction = value; - } - - public string Content { - get => Config.pszContent; - set => Config.pszContent = ExpandMarkdownMarkup(value); - } - - public string ExpandedInformation { - get => Config.pszExpandedInformation; - set => Config.pszExpandedInformation = ExpandMarkdownMarkup(value); - } - - public string VerificationText { - get => Config.pszVerificationText; - set => Config.pszVerificationText = value; - } - - public MsgResult DefaultButton { - get => (MsgResult)Config.nDefaultButton; - set => Config.nDefaultButton = (int)value; - } - - public string Footer { - get => Config.pszFooter; - set => Config.pszFooter = ExpandMarkdownMarkup(value); - } - - public MsgIcon MainIcon { - set => Config.MainIcon = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION((int)value); - } - - int _SelectedID; - - public int SelectedID { - get => _SelectedID; - set { - foreach (var i in IdValueDic) - if (i.Key == value) - _SelectedID = value; - } - } - - public T SelectedValue { - get { - if (IdValueDic.ContainsKey(SelectedID)) - return IdValueDic[SelectedID]; - - return SelectedValueValue; - } - set => SelectedValueValue = value; - } - - public string SelectedText { - get { - if (IdTextDic.ContainsKey(SelectedID)) - return IdTextDic[SelectedID]; - - return SelectedTextValue; - } - set => SelectedTextValue = value; - } - - public bool CheckBoxChecked { - get => (Config.dwFlags & TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED) - == TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED; - set { - if (value) - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED; - else - Config.dwFlags ^= TaskDialogNative.TASKDIALOG_FLAGS.TDF_VERIFICATION_FLAG_CHECKED; - } - } - - public MsgButtons CommonButtons { - get => Config.dwCommonButtons; - set => Config.dwCommonButtons = value; - } - - public int Timeout { - get => Convert.ToInt32(TimeoutValue / 1000.0); - set { - TimeoutValue = value * 1000; - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_CALLBACK_TIMER; - } - } - - public void AddButton(string text, T value) - { - int n = 1000 + IdValueDic.Count + 1; - IdValueDic[n] = value; - Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text)); - } - - public string ExpandMarkdownMarkup(string value) - { - if (value.Contains("[")) - { - Regex regex = new Regex(@"\[(.+)\]\((.+)\)"); - - if (regex.Match(value).Success) - { - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_ENABLE_HYPERLINKS; - value = regex.Replace(value, "$1"); - } - } - - return value; - } - - public void AddCommand(string text) - { - object obj = text; - AddCommand(text, (T)obj); - } - - public void AddCommand(string text, T value) - { - int n = 1000 + IdValueDic.Count + 1; - IdValueDic[n] = value; - IdTextDic[n] = text; - Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text)); - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS; - } - - public void AddCommand(string text, string description, T value, bool setShield = false) - { - int n = 1000 + IdValueDic.Count + 1; - IdValueDic[n] = value; - - if (setShield) - CommandLinkShieldList.Add(n); - - if (!string.IsNullOrEmpty(description)) - text += "\n" + description; - - Buttons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text)); - Config.dwFlags |= TaskDialogNative.TASKDIALOG_FLAGS.TDF_USE_COMMAND_LINKS; - } - - public void AddRadioButton(string text, T value) - { - int n = 1000 + IdValueDic.Count + 1; - IdValueDic[n] = value; - RadioButtons.Add(new TaskDialogNative.TASKDIALOG_BUTTON(n, text)); - } - - public T Show() - { - MarshalDialogControlStructs(); - TaskDialogNative.TASKDIALOGCONFIG config = Config; - int hr = TaskDialogNative.TaskDialogIndirect( - config, out int dummy1, out int dummy2, out bool isChecked); - - if (hr < 0) - Marshal.ThrowExceptionForHR(hr); - - CheckBoxChecked = isChecked; - - if (SelectedValue is MsgResult) - SelectedValue = (T)(object)SelectedID; - - return SelectedValue; - } - - public int DialogProc(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData) - { - switch (msg) - { - case 0: //TDN_CREATED - foreach (var i in CommandLinkShieldList) - SendMessage(hwnd, TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, new IntPtr(i), new IntPtr(1)); - break; - case 2: //TDN_BUTTON_CLICKED - case 6: //TDN_RADIO_BUTTON_CLICKED - if (SelectedValue is MsgResult) - _SelectedID = wParam.ToInt32(); - else - SelectedID = wParam.ToInt32(); - break; - case 3: //TDN_HYPERLINK_CLICKED - string stringUni = Marshal.PtrToStringUni(lParam); - - if (stringUni.StartsWith("mailto") || stringUni.StartsWith("http")) - Process.Start(stringUni); - - if (stringUni == "copymsg") - { - Thread thread = new Thread((ThreadStart)(() => { - Clipboard.SetText(MainInstruction + "\r\n\r\n" + Content + "\r\n\r\n" + ExpandedInformation); - MessageBox.Show("Message was copied to clipboard.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); - })); - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - } - break; - case 4: //TDN_TIMER - if (ExitTickCount == 0) ExitTickCount = Environment.TickCount + Timeout * 1000; - if (Environment.TickCount > ExitTickCount) - TaskDialogNative.SendMessage(hwnd, 1126, new IntPtr(1), IntPtr.Zero); - break; - } - return 0; - } - - public void MarshalDialogControlStructs() - { - if (Buttons != null && Buttons.Count > 0) - { - ButtonArray = AllocateAndMarshalButtons(Buttons); - Config.pButtons = ButtonArray; - Config.cButtons = (uint)Buttons.Count; - } - - if (RadioButtons == null || RadioButtons.Count <= 0) - return; - - RadioButtonArray = AllocateAndMarshalButtons(RadioButtons); - Config.pRadioButtons = RadioButtonArray; - Config.cRadioButtons = (uint)RadioButtons.Count; - } - - public static IntPtr AllocateAndMarshalButtons(List structs) - { - var initialPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(TASKDIALOG_BUTTON)) * structs.Count); - var currentPtr = initialPtr; - - foreach (var button in structs) - { - Marshal.StructureToPtr(button, currentPtr, false); - currentPtr = (IntPtr)(currentPtr.ToInt64() + Marshal.SizeOf(button)); - } - - return initialPtr; - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - ~TaskDialog() - { - Dispose(false); - } - - protected void Dispose(bool disposing) - { - if (Disposed) - return; - - Disposed = true; - - if (ButtonArray != IntPtr.Zero) - { - Marshal.FreeHGlobal(ButtonArray); - ButtonArray = IntPtr.Zero; - } - - if (RadioButtonArray != IntPtr.Zero) - { - Marshal.FreeHGlobal(RadioButtonArray); - RadioButtonArray = IntPtr.Zero; - } - } -} - -public delegate int PFTASKDIALOGCALLBACK( - IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam, IntPtr lpRefData); - -public class TaskDialogNative -{ - [DllImport("comctl32", CharSet = CharSet.Unicode, SetLastError = true)] - public static extern int TaskDialogIndirect( - TaskDialogNative.TASKDIALOGCONFIG pTaskConfig, - out int pnButton, - out int pnRadioButton, - out bool pVerificationFlagChecked); - - [DllImport("user32.dll")] - public static extern IntPtr GetForegroundWindow(); - - [DllImport("user32.dll", CharSet = CharSet.Unicode)] - public static extern uint GetWindowModuleFileName( - IntPtr hwnd, StringBuilder lpszFileName, uint cchFileNameMax); - - [DllImport("user32.dll")] - public static extern IntPtr SendMessage( - IntPtr handle, int message, IntPtr wParam, IntPtr lParam); - - [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)] - public class TASKDIALOGCONFIG - { - public uint cbSize; - public IntPtr hwndParent; - public IntPtr hInstance; - public TaskDialogNative.TASKDIALOG_FLAGS dwFlags; - public MsgButtons dwCommonButtons; - public string pszWindowTitle; - public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION MainIcon; - public string pszMainInstruction; - public string pszContent; - public uint cButtons; - public IntPtr pButtons; - public int nDefaultButton; - public uint cRadioButtons; - public IntPtr pRadioButtons; - public int nDefaultRadioButton; - public string pszVerificationText; - public string pszExpandedInformation; - public string pszExpandedControlText; - public string pszCollapsedControlText; - public TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION FooterIcon; - public string pszFooter; - public PFTASKDIALOGCALLBACK pfCallback; - public IntPtr lpCallbackData; - public uint cxWidth; - } - - public enum TASKDIALOG_FLAGS - { - NONE = 0, - TDF_ENABLE_HYPERLINKS = 1, - TDF_USE_HICON_MAIN = 2, - TDF_USE_HICON_FOOTER = 4, - TDF_ALLOW_DIALOG_CANCELLATION = 8, - TDF_USE_COMMAND_LINKS = 16, - TDF_USE_COMMAND_LINKS_NO_ICON = 32, - TDF_EXPAND_FOOTER_AREA = 64, - TDF_EXPANDED_BY_DEFAULT = 128, - TDF_VERIFICATION_FLAG_CHECKED = 256, - TDF_SHOW_PROGRESS_BAR = 512, - TDF_SHOW_MARQUEE_PROGRESS_BAR = 1024, - TDF_CALLBACK_TIMER = 2048, - TDF_POSITION_RELATIVE_TO_WINDOW = 4096, - TDF_RTL_LAYOUT = 8192, - TDF_NO_DEFAULT_RADIO_BUTTON = 16384, - } - - [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)] - public struct TASKDIALOGCONFIG_ICON_UNION - { - [FieldOffset(0)] - public int hMainIcon; - [FieldOffset(0)] - public int pszIcon; - [FieldOffset(0)] - public IntPtr spacer; - - public TASKDIALOGCONFIG_ICON_UNION(int i) - { - this = new TaskDialogNative.TASKDIALOGCONFIG_ICON_UNION(); - spacer = IntPtr.Zero; - pszIcon = 0; - hMainIcon = i; - } - } - - [StructLayout(LayoutKind.Sequential, Pack = 4, CharSet = CharSet.Unicode)] - public struct TASKDIALOG_BUTTON - { - public int nButtonID; - [MarshalAs(UnmanagedType.LPWStr)] - public string pszButtonText; - - public TASKDIALOG_BUTTON(int n, string txt) - { - this = new TaskDialogNative.TASKDIALOG_BUTTON(); - nButtonID = n; - pszButtonText = txt; - } - } -} - -public enum MsgButtons -{ - None = 0, - Ok = 1, - Yes = 2, - No = 4, - YesNo = 6, - Cancel = 8, - OkCancel = 9, - YesNoCancel = 14, - Retry = 16, - RetryCancel = 24, - Close = 32, -} - -public enum MsgResult -{ - None, - OK, - Cancel, - Abort, - Retry, - Ignore, - Yes, - No, -} - -public enum MsgIcon -{ - None = 0, - SecurityShieldGray = 65527, - SecuritySuccess = 65528, - SecurityError = 65529, - SecurityWarning = 65530, - SecurityShieldBlue = 65531, - Shield = 65532, - Info = 65533, - Error = 65534, - Warning = 65535, -} diff --git a/src/Release.ps1 b/src/Release.ps1 index acd96bb..e86b013 100644 --- a/src/Release.ps1 +++ b/src/Release.ps1 @@ -34,7 +34,7 @@ if ($versionInfo.FilePrivatePart -eq 0) if ($LastExitCode) { throw $LastExitCode } $targetDir = $tmpDir + "\mpv.net-$($versionInfo.FileVersion)-portable" - Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml + Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude 'System.Management.Automation.xml', 'settings-directory.txt' & $7z a -tzip -mx9 "$targetDir.zip" -r "$targetDir\*" if ($LastExitCode) { throw $LastExitCode } @@ -45,7 +45,7 @@ if ($versionInfo.FilePrivatePart -eq 0) else { $targetDir = "$tmpDir\mpv.net-$($versionInfo.FileVersion)-portable-beta" - Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude System.Management.Automation.xml + Copy-Item $PSScriptRoot\bin $targetDir -Recurse -Exclude 'System.Management.Automation.xml', 'settings-directory.txt' & $7z a -t7z -mx9 "$targetDir.7z" -r "$targetDir\*" if ($LastExitCode) { throw $LastExitCode } UploadBeta "$targetDir.7z" diff --git a/src/Resources/theme.txt b/src/Resources/theme.txt index adb671a..7b1d86b 100644 --- a/src/Resources/theme.txt +++ b/src/Resources/theme.txt @@ -12,6 +12,11 @@ menu-highlight = #505050 menu-border = #FFFFFF menu-checked = #5A5A5A +button-foreground = #DDDDDD +button-background = #505050 +button-hover = #555555 +button-border = #707070 + [light] @@ -25,3 +30,8 @@ menu-background = #DFDFDF menu-highlight = #BFBFBF menu-border = #6A6A6A menu-checked = #AAAAAA + +button-foreground = #000000 +button-background = #BBBBBB +button-hover = #CCCCCC +button-border = #6A6A6A diff --git a/src/Scripts/C-Sharp/delete-current-file.cs b/src/Scripts/C-Sharp/delete-current-file.cs new file mode 100644 index 0000000..1e6eecd --- /dev/null +++ b/src/Scripts/C-Sharp/delete-current-file.cs @@ -0,0 +1,63 @@ + +// C# Script that deletes the current file + +// In input.conf add: + +// KP0 script-message delete-current-file ask #menu: Script > Delete current file > Ask +// KP1 script-message delete-current-file confirm #menu: Script > Delete current file > Confirm + +using System; +using System.IO; +using System.Threading; + +using Microsoft.VisualBasic.FileIO; + +using mpvnet; + +class Script +{ + string FileToDelete; + DateTime DeleteTime; + CorePlayer Core; + + public Script() + { + Core = Global.Core; + Core.ClientMessage += ClientMessage; + } + + void ClientMessage(string[] args) + { + if (args == null || args.Length != 2 || args[0] != "delete-current-file") + return; + + if (args[1] == "ask") + { + FileToDelete = Core.get_property_string("path"); + DeleteTime = DateTime.Now; + Core.commandv("show-text", "Press 1 to delete file", "5000"); + } + else if (args[1] == "confirm") + { + TimeSpan ts = DateTime.Now - DeleteTime; + string path = Core.get_property_string("path"); + + if (FileToDelete == path && ts.TotalSeconds < 5 && File.Exists(FileToDelete)) + { + Core.command("playlist-remove current"); + int pos = Core.get_property_int("playlist-pos"); + + if (pos == -1) + { + int count = Core.get_property_int("playlist-count"); + + if (count > 0) + Core.set_property_int("playlist-pos", count - 1); + } + + Thread.Sleep(2000); + FileSystem.DeleteFile(FileToDelete, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin); + } + } + } +} diff --git a/src/Scripts/C-Sharp/key-binding.cs b/src/Scripts/C-Sharp/key-binding.cs index e9e718a..af414ce 100644 --- a/src/Scripts/C-Sharp/key-binding.cs +++ b/src/Scripts/C-Sharp/key-binding.cs @@ -11,7 +11,7 @@ class Script { string content = "ctrl+w script-message my-message-1 my-argument-1"; string sectionName = Assembly.GetExecutingAssembly().GetName().Name; - Core core = Core.core; + CorePlayer core = Global.Core; core.commandv("define-section", sectionName, content, "force"); core.commandv("enable-section", sectionName); core.ClientMessage += ClientMessage; @@ -22,7 +22,7 @@ class Script switch (args[0]) { case "my-message-1": - Msg.Show(args[1]); + Msg.ShowInfo(args[1]); break; } } diff --git a/src/Scripts/C-Sharp/observe-property-and-draw-text.cs b/src/Scripts/C-Sharp/observe-property-and-draw-text.cs index 87383f8..8a03e73 100644 --- a/src/Scripts/C-Sharp/observe-property-and-draw-text.cs +++ b/src/Scripts/C-Sharp/observe-property-and-draw-text.cs @@ -6,16 +6,16 @@ using mpvnet; class Script { - Core core; - + CorePlayer Core; + public Script() { - core = Core.core; - core.observe_property_bool("fullscreen", FullscreenChange); + Core = Global.Core; + Core.observe_property_bool("fullscreen", FullscreenChange); } void FullscreenChange(bool value) { - core.commandv("show-text", "fullscreen: " + value); + Core.commandv("show-text", "fullscreen: " + value); } } diff --git a/src/Scripts/C-Sharp/pause-when-minimize.cs b/src/Scripts/C-Sharp/pause-when-minimize.cs index 175b5ab..0981dc8 100644 --- a/src/Scripts/C-Sharp/pause-when-minimize.cs +++ b/src/Scripts/C-Sharp/pause-when-minimize.cs @@ -8,28 +8,28 @@ using mpvnet; class Script { - MainForm Form; - Core core; + MainForm MainForm; + CorePlayer Core; bool WasPlaying; bool WasPaused; public Script() { - core = Core.core; - Form = MainForm.Instance; - Form.Resize += Form_Resize; + Core = Global.Core; + MainForm = MainForm.Instance; + MainForm.Resize += Form_Resize; } - private void Form_Resize(object sender, EventArgs e) + void Form_Resize(object sender, EventArgs e) { - if (Form.WindowState == FormWindowState.Minimized) + if (MainForm.WindowState == FormWindowState.Minimized) { - WasPlaying = !core.get_property_bool("pause"); + WasPlaying = !Core.get_property_bool("pause"); if (WasPlaying) { - core.set_property_bool("pause", true, true); + Core.set_property_bool("pause", true, true); WasPaused = true; } } @@ -37,7 +37,7 @@ class Script { if (WasPaused) { - core.set_property_bool("pause", false, true); + Core.set_property_bool("pause", false, true); WasPaused = false; } } diff --git a/src/Scripts/C-Sharp/rate-file.cs b/src/Scripts/C-Sharp/rate-file.cs new file mode 100644 index 0000000..f9a91ce --- /dev/null +++ b/src/Scripts/C-Sharp/rate-file.cs @@ -0,0 +1,84 @@ + +// This script writes a rating to the filename of rated videos when mpv.net shuts down. + +// In input.conf add: + +// KP0 script-message rate-file 0 #menu: Extensions > Rating > 0stars +// KP1 script-message rate-file 1 #menu: Extensions > Rating > 1stars +// KP2 script-message rate-file 2 #menu: Extensions > Rating > 2stars +// KP3 script-message rate-file 3 #menu: Extensions > Rating > 3stars +// KP4 script-message rate-file 4 #menu: Extensions > Rating > 4stars +// KP5 script-message rate-file 5 #menu: Extensions > Rating > 5stars + +using System; +using System.Collections.Generic; +using System.IO; +using System.Windows.Forms; + +using mpvnet; + +class Script +{ + // dictionory to store the filename and the rating + Dictionary Dic = new Dictionary(); + CorePlayer Core; + + public Script() // plugin initialization + { + Core = Global.Core; + Core.ClientMessage += ClientMessage; //handles keys defined in input.conf + Core.Shutdown += Shutdown; // handles MPV_EVENT_SHUTDOWN + } + + // handles MPV_EVENT_SHUTDOWN + void Shutdown() + { + foreach (var i in Dic) + { + string filepath = i.Key; + int rating = i.Value; + + if (string.IsNullOrEmpty(filepath) || !File.Exists(filepath)) + return; + + string basename = Path.GetFileNameWithoutExtension(filepath); + + for (int x = 0; x < 6; x++) + if (basename.Contains(" (" + x + "stars)")) + basename = basename.Replace(" (" + x + "stars)", ""); + + basename += " (" + rating + "stars)"; + + string newPath = Path.Combine(Path.GetDirectoryName(filepath), + basename + Path.GetExtension(filepath)); + + if (filepath.ToLower() != newPath.ToLower()) + File.Move(filepath, newPath); + + File.SetLastWriteTime(newPath, DateTime.Now); + } + } + + //handles keys defined in input.conf + void ClientMessage(string[] args) + { + if (args[0] != "rate-file") + return; + + int rating; + + if (int.TryParse(args[1], out rating)) + { + string path = Core.get_property_string("path"); + + if (!File.Exists(path)) + return; + + Dic[path] = rating; + Core.commandv("show-text", "Rating: " + rating); + } + else if (args[1] == "about") + MessageBox.Show("This extension writes a rating to the filename of rated videos when mpv.net shuts down.", + "Rating Extension"); + } +} diff --git a/src/Scripts/C-Sharp/dynamic-context-menu-items.cs b/src/Scripts/C-Sharp/switch-profile-context-menu.cs similarity index 73% rename from src/Scripts/C-Sharp/dynamic-context-menu-items.cs rename to src/Scripts/C-Sharp/switch-profile-context-menu.cs index 99eb420..4c768e0 100644 --- a/src/Scripts/C-Sharp/dynamic-context-menu-items.cs +++ b/src/Scripts/C-Sharp/switch-profile-context-menu.cs @@ -8,12 +8,12 @@ using System.Linq; class Script { MainForm MainForm; - Core core; + CorePlayer Core; public Script() { - core = Core.core; - MainForm = mpvnet.MainForm.Instance; + Core = Global.Core; + MainForm = MainForm.Instance; MainForm.ContextMenu.Opening += ContextMenu_Opening; } @@ -26,13 +26,13 @@ class Script return; menuItem.DropDownItems.Clear(); - var editionTracks = core.MediaTracks.Where(track => track.Type == "e"); + var editionTracks = Core.MediaTracks.Where(track => track.Type == "e"); foreach (MediaTrack track in editionTracks) { MenuItem mi = new MenuItem(track.Text); - mi.Action = () => { core.commandv("set", "edition", track.ID.ToString()); }; - mi.Checked = core.Edition == track.ID; + mi.Action = () => { Core.commandv("set", "edition", track.ID.ToString()); }; + mi.Checked = Core.Edition == track.ID; menuItem.DropDownItems.Add(mi); } } diff --git a/src/WPF/CommandPaletteWindow.xaml.cs b/src/WPF/CommandPaletteWindow.xaml.cs index 5bfc73d..f8c3f98 100644 --- a/src/WPF/CommandPaletteWindow.xaml.cs +++ b/src/WPF/CommandPaletteWindow.xaml.cs @@ -6,7 +6,7 @@ using System.Windows.Data; using System.Windows.Input; using System.Windows.Interop; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -107,7 +107,7 @@ namespace mpvnet { CommandItem item = ListView.SelectedItem as CommandItem; Close(); - core.command(item.Command); + Core.command(item.Command); } } diff --git a/src/WPF/ConfWindow.xaml.cs b/src/WPF/ConfWindow.xaml.cs index 15506bf..f570155 100644 --- a/src/WPF/ConfWindow.xaml.cs +++ b/src/WPF/ConfWindow.xaml.cs @@ -11,8 +11,7 @@ using System.Windows.Input; using DynamicGUI; -using static TaskDialog.Msg; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -28,11 +27,11 @@ namespace mpvnet InitializeComponent(); DataContext = this; SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged; - LoadConf(core.ConfPath); + LoadConf(Core.ConfPath); LoadConf(App.ConfPath); LoadSettings(); InitialContent = GetCompareString(); - SearchControl.Text = RegistryHelp.GetString("ConfigEditorSearch"); + SearchControl.Text = RegistryHelp.GetString("config-editor-search"); FilterListBox.SelectedItem = SearchControl.Text.TrimEnd(':'); } @@ -69,14 +68,14 @@ namespace mpvnet protected override void OnClosed(EventArgs e) { base.OnClosed(e); - RegistryHelp.SetValue(App.RegPath, "ConfigEditorSearch", SearchControl.Text); + RegistryHelp.SetValue("config-editor-search", SearchControl.Text); if (InitialContent == GetCompareString()) return; - File.WriteAllText(core.ConfPath, GetContent("mpv")); + File.WriteAllText(Core.ConfPath, GetContent("mpv")); File.WriteAllText(App.ConfPath, GetContent("mpvnet")); - MsgInfo("Changes will be available on next mpv.net startup."); + Msg.ShowInfo("Changes will be available on next startup."); } string GetCompareString() @@ -291,25 +290,17 @@ namespace mpvnet SearchControl.Text = e.AddedItems[0] + ":"; } - void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e) - { - ProcessHelp.ShellExecute(Path.GetDirectoryName(core.ConfPath)); - } + void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => + ProcessHelp.ShellExecute(Path.GetDirectoryName(Core.ConfPath)); - void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e) - { - MsgInfo("mpv.conf Preview", GetContent("mpv")); - } + void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => + Msg.ShowInfo("mpv.conf Preview", GetContent("mpv")); - void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e) - { + void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => ProcessHelp.ShellExecute("https://mpv.io/manual/master/"); - } - void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e) - { + void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e) => ProcessHelp.ShellExecute("https://github.com/stax76/mpv.net#Support"); - } protected override void OnKeyDown(KeyEventArgs e) { diff --git a/src/WPF/EverythingWindow.xaml.cs b/src/WPF/EverythingWindow.xaml.cs index d3a12c1..c719250 100644 --- a/src/WPF/EverythingWindow.xaml.cs +++ b/src/WPF/EverythingWindow.xaml.cs @@ -4,13 +4,12 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Interop; -using static mpvnet.Core; +using static mpvnet.Global; namespace mpvnet { @@ -109,7 +108,7 @@ namespace mpvnet void Execute() { if (ListView.SelectedItem != null) - core.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control); + Core.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control); Keyboard.Focus(FilterTextBox); } @@ -142,7 +141,7 @@ namespace mpvnet Everything_GetResultFullPathName(i, sb, (uint)sb.Capacity); string ext = sb.ToString().Ext(); - if (Core.AudioTypes.Contains(ext) || Core.VideoTypes.Contains(ext) || Core.ImageTypes.Contains(ext)) + if (CorePlayer.AudioTypes.Contains(ext) || CorePlayer.VideoTypes.Contains(ext) || CorePlayer.ImageTypes.Contains(ext)) items.Add(sb.ToString()); if (items.Count > 100) diff --git a/src/WPF/InputWindow.xaml.cs b/src/WPF/InputWindow.xaml.cs index 1f258d3..9a60e5b 100644 --- a/src/WPF/InputWindow.xaml.cs +++ b/src/WPF/InputWindow.xaml.cs @@ -8,8 +8,7 @@ using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; -using static mpvnet.Core; -using static TaskDialog.Msg; +using static mpvnet.Global; namespace mpvnet { @@ -38,7 +37,9 @@ namespace mpvnet if (SearchControl.SearchTextBox.Text == "?") { SearchControl.SearchTextBox.Text = ""; - MsgInfo("Filtering", "Reduce the filter scope with:\n\ni input\n\nm menu\n\nc command\n\nIf only one character is entered input search is performed."); + Msg.ShowInfo("Filtering", + "Reduce the filter scope with:\n\ni input\n\nm menu\n\nc command\n\n" + + "If only one character is entered input search is performed."); } } @@ -86,7 +87,7 @@ namespace mpvnet foreach (CommandItem i in CommandItem.Items) if (items.ContainsKey(i.Input) && i.Input != "") - MsgInfo($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found"); + Msg.ShowInfo($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found"); else items[i.Input] = i; } @@ -128,8 +129,8 @@ namespace mpvnet if (InitialInputConfContent == GetInputConfContent()) return; - File.WriteAllText(core.InputConfPath, GetInputConfContent()); - MsgInfo("Changes will be available on next mpv.net startup."); + File.WriteAllText(Core.InputConfPath, GetInputConfContent()); + Msg.ShowInfo("Changes will be available on next startup."); } void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e) @@ -137,7 +138,7 @@ namespace mpvnet DataGrid grid = (DataGrid)sender; if (e.Command == DataGrid.DeleteCommand) - if (Msg.ShowQuestion($"Confirm to delete: {(grid.SelectedItem as CommandItem).Input} ({(grid.SelectedItem as CommandItem).Path})") != MsgResult.OK) + if (Msg.ShowQuestion($"Confirm to delete: {(grid.SelectedItem as CommandItem).Input} ({(grid.SelectedItem as CommandItem).Path})") != System.Windows.Forms.DialogResult.OK) e.Handled = true; } diff --git a/src/WPF/SetupWindow.xaml.cs b/src/WPF/SetupWindow.xaml.cs index 860f1dc..9d21254 100644 --- a/src/WPF/SetupWindow.xaml.cs +++ b/src/WPF/SetupWindow.xaml.cs @@ -8,7 +8,6 @@ using System.Windows; using WinForms = System.Windows.Forms; using static StockIcon; -using static TaskDialog.Msg; namespace mpvnet { @@ -45,15 +44,16 @@ namespace mpvnet proc.WaitForExit(); if (proc.ExitCode == 0) - MsgInfo("File associations successfully created."); + Msg.ShowInfo("File associations successfully created."); + else + Msg.ShowError("Error creating file associations."); } - } catch {} } - void AddVideo_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.VideoTypes); - void AddAudio_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.AudioTypes); - void AddImage_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.ImageTypes); + void AddVideo_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.VideoTypes); + void AddAudio_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.AudioTypes); + void AddImage_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.ImageTypes); void RemoveFileAssociations_Click(object sender, RoutedEventArgs e) { diff --git a/src/WinForms/MainForm.cs b/src/WinForms/MainForm.cs index 883b0bf..7efe1fb 100644 --- a/src/WinForms/MainForm.cs +++ b/src/WinForms/MainForm.cs @@ -1,17 +1,16 @@  using System; -using System.Drawing; -using System.IO; -using System.Runtime.InteropServices; -using System.Windows.Forms; -using System.Linq; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing; using System.Globalization; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Windows.Forms; -using static mpvnet.Core; -using static Native; -using static TaskDialog.Msg; +using static mpvnet.Native; +using static mpvnet.Global; namespace mpvnet { @@ -35,51 +34,45 @@ namespace mpvnet public MainForm() { InitializeComponent(); + SetColors(); try { - object recent = RegistryHelp.GetValue(App.RegPath, "Recent"); - - if (recent is string[] r) - RecentFiles = new List(r); - else - RecentFiles = new List(); + object recent = RegistryHelp.GetValue("recent"); + RecentFiles = recent is string[] r ? new List(r) : new List(); Instance = this; Hwnd = Handle; - ConsoleHelp.Padding = 60; - core.Init(); + Core.Init(); - core.Shutdown += Shutdown; - core.VideoSizeChanged += VideoSizeChanged; - core.ScaleWindow += ScaleWindow; - core.WindowScale += WindowScale; - core.FileLoaded += FileLoaded; - core.Idle += Idle; - core.Seek += () => UpdateProgressBar(); + Core.Shutdown += Shutdown; + Core.VideoSizeChanged += VideoSizeChanged; + Core.ScaleWindow += ScaleWindow; + Core.WindowScale += WindowScale; + Core.FileLoaded += FileLoaded; + Core.Idle += Idle; + Core.Seek += () => UpdateProgressBar(); - core.observe_property("window-maximized", PropChangeWindowMaximized); - core.observe_property("window-minimized", PropChangeWindowMinimized); - core.observe_property_bool("pause", PropChangePause); - core.observe_property_bool("fullscreen", PropChangeFullscreen); - core.observe_property_bool("ontop", PropChangeOnTop); - core.observe_property_bool("border", PropChangeBorder); + Core.observe_property("window-maximized", PropChangeWindowMaximized); + Core.observe_property("window-minimized", PropChangeWindowMinimized); + Core.observe_property_bool("pause", PropChangePause); + Core.observe_property_bool("fullscreen", PropChangeFullscreen); + Core.observe_property_bool("ontop", PropChangeOnTop); + Core.observe_property_bool("border", PropChangeBorder); - core.observe_property_string("sid", PropChangeSid); - core.observe_property_string("aid", PropChangeAid); - core.observe_property_string("vid", PropChangeVid); + Core.observe_property_string("sid", PropChangeSid); + Core.observe_property_string("aid", PropChangeAid); + Core.observe_property_string("vid", PropChangeVid); - core.observe_property_string("title", PropChangeTitle); + Core.observe_property_string("title", PropChangeTitle); - core.observe_property_int("edition", PropChangeEdition); + Core.observe_property_int("edition", PropChangeEdition); - if (core.GPUAPI != "vulkan") - core.ProcessCommandLine(false); + if (Core.GPUAPI != "vulkan") + Core.ProcessCommandLine(false); AppDomain.CurrentDomain.UnhandledException += (sender, e) => App.ShowException(e.ExceptionObject); Application.ThreadException += (sender, e) => App.ShowException(e.Exception); - - Msg.SupportURL = "https://github.com/stax76/mpv.net#support"; TaskbarButtonCreatedMessage = RegisterWindowMessage("TaskbarButtonCreated"); @@ -87,9 +80,9 @@ namespace mpvnet ContextMenu.Opened += ContextMenu_Opened; ContextMenu.Opening += ContextMenu_Opening; - if (core.Screen > -1) + if (Core.Screen > -1) { - int targetIndex = core.Screen; + int targetIndex = Core.Screen; Screen[] screens = Screen.AllScreens; if (targetIndex < 0) @@ -104,19 +97,19 @@ namespace mpvnet Top = target.Y + (target.Height - Height) / 2; } - if (!core.Border) + if (!Core.Border) FormBorderStyle = FormBorderStyle.None; - int posX = RegistryHelp.GetInt("PosX"); - int posY = RegistryHelp.GetInt("PosY"); + int posX = RegistryHelp.GetInt("position-x"); + int posY = RegistryHelp.GetInt("position-y"); if ((posX != 0 || posY != 0) && App.RememberPosition) { Left = posX - Width / 2; Top = posY - Height / 2; - int horizontal = RegistryHelp.GetInt("HorizontalLocation"); - int vertical = RegistryHelp.GetInt("VerticalLocation"); + int horizontal = RegistryHelp.GetInt("location-horizontal"); + int vertical = RegistryHelp.GetInt("location-vertical"); if (horizontal == -1) Left = posX; if (horizontal == 1) Left = posX - Width; @@ -124,13 +117,13 @@ namespace mpvnet if (vertical == 1) Top = posY - Height; } - if (core.WindowMaximized) + if (Core.WindowMaximized) { SetFormPosAndSize(true); WindowState = FormWindowState.Maximized; } - if (core.WindowMinimized) + if (Core.WindowMinimized) { SetFormPosAndSize(true); WindowState = FormWindowState.Minimized; @@ -145,7 +138,7 @@ namespace mpvnet void ScaleWindow(float scale) { BeginInvoke(new Action(() => { int w = (int)(ClientSize.Width * scale); - int h = (int)Math.Ceiling(w * core.VideoSize.Height / (double)core.VideoSize.Width); + int h = (int)Math.Ceiling(w * Core.VideoSize.Height / (double)Core.VideoSize.Width); SetSize(w, h, Screen.FromControl(this), false); })); } @@ -154,10 +147,10 @@ namespace mpvnet { BeginInvoke(new Action(() => { SetSize( - (int)(core.VideoSize.Width * scale), - (int)Math.Ceiling(core.VideoSize.Height * scale), + (int)(Core.VideoSize.Width * scale), + (int)Math.Ceiling(Core.VideoSize.Height * scale), Screen.FromControl(this), false); - core.command($"show-text \"window-scale {scale.ToString(CultureInfo.InvariantCulture)}\""); + Core.command($"show-text \"window-scale {scale.ToString(CultureInfo.InvariantCulture)}\""); })); } @@ -192,7 +185,7 @@ namespace mpvnet void ContextMenu_Opening(object sender, CancelEventArgs e) { - lock (core.MediaTracks) + lock (Core.MediaTracks) { MenuItem trackMenuItem = FindMenuItem("Track"); @@ -200,16 +193,16 @@ namespace mpvnet { trackMenuItem.DropDownItems.Clear(); - MediaTrack[] audTracks = core.MediaTracks.Where(track => track.Type == "a").ToArray(); - MediaTrack[] subTracks = core.MediaTracks.Where(track => track.Type == "s").ToArray(); - MediaTrack[] vidTracks = core.MediaTracks.Where(track => track.Type == "v").ToArray(); - MediaTrack[] ediTracks = core.MediaTracks.Where(track => track.Type == "e").ToArray(); + MediaTrack[] audTracks = Core.MediaTracks.Where(track => track.Type == "a").ToArray(); + MediaTrack[] subTracks = Core.MediaTracks.Where(track => track.Type == "s").ToArray(); + MediaTrack[] vidTracks = Core.MediaTracks.Where(track => track.Type == "v").ToArray(); + MediaTrack[] ediTracks = Core.MediaTracks.Where(track => track.Type == "e").ToArray(); foreach (MediaTrack track in vidTracks) { MenuItem mi = new MenuItem(track.Text); - mi.Action = () => core.commandv("set", "vid", track.ID.ToString()); - mi.Checked = core.Vid == track.ID.ToString(); + mi.Action = () => Core.commandv("set", "vid", track.ID.ToString()); + mi.Checked = Core.Vid == track.ID.ToString(); trackMenuItem.DropDownItems.Add(mi); } @@ -219,8 +212,8 @@ namespace mpvnet foreach (MediaTrack track in audTracks) { MenuItem mi = new MenuItem(track.Text); - mi.Action = () => core.commandv("set", "aid", track.ID.ToString()); - mi.Checked = core.Aid == track.ID.ToString(); + mi.Action = () => Core.commandv("set", "aid", track.ID.ToString()); + mi.Checked = Core.Aid == track.ID.ToString(); trackMenuItem.DropDownItems.Add(mi); } @@ -230,16 +223,16 @@ namespace mpvnet foreach (MediaTrack track in subTracks) { MenuItem mi = new MenuItem(track.Text); - mi.Action = () => core.commandv("set", "sid", track.ID.ToString()); - mi.Checked = core.Sid == track.ID.ToString(); + mi.Action = () => Core.commandv("set", "sid", track.ID.ToString()); + mi.Checked = Core.Sid == track.ID.ToString(); trackMenuItem.DropDownItems.Add(mi); } if (subTracks.Length > 0) { MenuItem mi = new MenuItem("S: No subtitles"); - mi.Action = () => core.commandv("set", "sid", "no"); - mi.Checked = core.Sid == "no"; + mi.Action = () => Core.commandv("set", "sid", "no"); + mi.Checked = Core.Sid == "no"; trackMenuItem.DropDownItems.Add(mi); } @@ -249,14 +242,14 @@ namespace mpvnet foreach (MediaTrack track in ediTracks) { MenuItem mi = new MenuItem(track.Text); - mi.Action = () => core.commandv("set", "edition", track.ID.ToString()); - mi.Checked = core.Edition == track.ID; + mi.Action = () => Core.commandv("set", "edition", track.ID.ToString()); + mi.Checked = Core.Edition == track.ID; trackMenuItem.DropDownItems.Add(mi); } } } - lock (core.Chapters) + lock (Core.Chapters) { MenuItem chaptersMenuItem = FindMenuItem("Chapters"); @@ -264,11 +257,11 @@ namespace mpvnet { chaptersMenuItem.DropDownItems.Clear(); - foreach (var pair in core.Chapters) + foreach (var pair in Core.Chapters) { MenuItem mi = new MenuItem(pair.Key); mi.ShortcutKeyDisplayString = TimeSpan.FromSeconds(pair.Value).ToString().Substring(0, 8) + " "; - mi.Action = () => core.commandv("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute"); + mi.Action = () => Core.commandv("seek", pair.Value.ToString(CultureInfo.InvariantCulture), "absolute"); chaptersMenuItem.DropDownItems.Add(mi); } } @@ -281,7 +274,7 @@ namespace mpvnet recent.DropDownItems.Clear(); foreach (string path in RecentFiles) - MenuItem.Add(recent.DropDownItems, path, () => core.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control))); + MenuItem.Add(recent.DropDownItems, path, () => Core.LoadFiles(new[] { path }, true, Control.ModifierKeys.HasFlag(Keys.Control))); recent.DropDownItems.Add(new ToolStripSeparator()); MenuItem mi = new MenuItem("Clear List"); @@ -295,12 +288,12 @@ namespace mpvnet { titles.DropDownItems.Clear(); - lock (core.BluRayTitles) + lock (Core.BluRayTitles) { List<(int Index, TimeSpan Len)> items = new List<(int Index, TimeSpan Len)>(); - for (int i = 0; i < core.BluRayTitles.Count; i++) - items.Add((i, core.BluRayTitles[i])); + for (int i = 0; i < Core.BluRayTitles.Count; i++) + items.Add((i, Core.BluRayTitles[i])); var titleItems = items.OrderByDescending(item => item.Len) .Take(20).OrderBy(item => item.Index); @@ -308,7 +301,7 @@ namespace mpvnet foreach (var item in titleItems) if (item.Len != TimeSpan.Zero) MenuItem.Add(titles.DropDownItems, $"{item.Len} ({item.Index})", - () => core.SetBluRayTitle(item.Index)); + () => Core.SetBluRayTitle(item.Index)); } } } @@ -341,7 +334,7 @@ namespace mpvnet if (WindowState != FormWindowState.Normal) return; - if (core.Fullscreen) + if (Core.Fullscreen) { CycleFullscreen(true); return; @@ -349,14 +342,14 @@ namespace mpvnet } Screen screen = Screen.FromControl(this); - int autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * core.Autofit); + int autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * Core.Autofit); - if (core.VideoSize.Height == 0 || core.VideoSize.Width == 0 || - core.VideoSize.Width / (float)core.VideoSize.Height < App.MinimumAspectRatio) + if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0 || + Core.VideoSize.Width / (float)Core.VideoSize.Height < App.MinimumAspectRatio) - core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight); + Core.VideoSize = new Size((int)(autoFitHeight * (16 / 9f)), autoFitHeight); - Size videoSize = core.VideoSize; + Size videoSize = Core.VideoSize; int height = videoSize.Height; int width = videoSize.Width; @@ -364,7 +357,7 @@ namespace mpvnet if (App.StartSize == "previous") App.StartSize = "height-session"; - if (core.WasInitialSizeSet) + if (Core.WasInitialSizeSet) { if (App.StartSize == "always") { @@ -384,8 +377,8 @@ namespace mpvnet } else { - int savedHeight = RegistryHelp.GetInt("Height"); - int savedWidth = RegistryHelp.GetInt("Width"); + int savedHeight = RegistryHelp.GetInt("window-height"); + int savedWidth = RegistryHelp.GetInt("window-width"); if (App.StartSize == "height-always" && savedHeight != 0) { @@ -413,7 +406,7 @@ namespace mpvnet width = savedWidth; } - core.WasInitialSizeSet = true; + Core.WasInitialSizeSet = true; } SetSize(width, height, screen, checkAutofit); @@ -429,15 +422,15 @@ namespace mpvnet if (checkAutofit) { - if (height < maxHeight * core.AutofitSmaller) + if (height < maxHeight * Core.AutofitSmaller) { - height = Convert.ToInt32(maxHeight * core.AutofitSmaller); + height = Convert.ToInt32(maxHeight * Core.AutofitSmaller); width = Convert.ToInt32(height * startWidth / (double)startHeight); } - if (height > maxHeight * core.AutofitLarger) + if (height > maxHeight * Core.AutofitLarger) { - height = Convert.ToInt32(maxHeight * core.AutofitLarger); + height = Convert.ToInt32(maxHeight * Core.AutofitLarger); width = Convert.ToInt32(height * startWidth / (double)startHeight); } } @@ -493,7 +486,8 @@ namespace mpvnet if (top + rect.Height > maxBottom) top = maxBottom - rect.Height; - SetWindowPos(Handle, IntPtr.Zero, left, top, rect.Width, rect.Height, 4); + uint SWP_NOACTIVATE = 0x0010; + SetWindowPos(Handle, IntPtr.Zero, left, top, rect.Width, rect.Height, SWP_NOACTIVATE); } public int GetHorizontalLocation(Screen screen) @@ -533,7 +527,7 @@ namespace mpvnet public void CycleFullscreen(bool enabled) { LastCycleFullscreen = Environment.TickCount; - core.Fullscreen = enabled; + Core.Fullscreen = enabled; if (enabled) { @@ -560,7 +554,7 @@ namespace mpvnet else WindowState = FormWindowState.Normal; - if (core.Border) + if (Core.Border) FormBorderStyle = FormBorderStyle.Sizable; else FormBorderStyle = FormBorderStyle.None; @@ -573,7 +567,7 @@ namespace mpvnet public void BuildMenu() { - string content = File.ReadAllText(core.InputConfPath); + string content = File.ReadAllText(Core.InputConfPath); var items = CommandItem.GetItems(content); if (!content.Contains("#menu:")) @@ -595,7 +589,7 @@ namespace mpvnet MenuItem menuItem = ContextMenu.Add(item.Path.Replace("&", "&&"), () => { try { - core.command(item.Command); + Core.command(item.Command); } catch (Exception ex) { Msg.ShowException(ex); } @@ -608,12 +602,12 @@ namespace mpvnet void FileLoaded() { - string path = core.get_property_string("path"); + string path = Core.get_property_string("path"); BeginInvoke(new Action(() => { - Text = core.expand(Title); + Text = Core.expand(Title); - int interval = (int)(core.Duration.TotalMilliseconds / 100); + int interval = (int)(Core.Duration.TotalMilliseconds / 100); if (interval < 100) interval = 100; @@ -634,7 +628,7 @@ namespace mpvnet RecentFiles.RemoveAt(App.RecentCount); } - void SetTitle() => BeginInvoke(new Action(() => Text = core.expand(Title))); + void SetTitle() => BeginInvoke(new Action(() => Text = Core.expand(Title))); void SaveWindowProperties() { @@ -642,8 +636,8 @@ namespace mpvnet { SavePosition(); - RegistryHelp.SetValue(App.RegPath, "Width", ClientSize.Width); - RegistryHelp.SetValue(App.RegPath, "Height", ClientSize.Height); + RegistryHelp.SetInt("window-width", ClientSize.Width); + RegistryHelp.SetInt("window-height", ClientSize.Height); } } @@ -662,11 +656,11 @@ namespace mpvnet if (y == -1) posY = Top; if (y == 1) posY = Top + Height; - RegistryHelp.SetInt("PosX", posX); - RegistryHelp.SetInt("PosY", posY); + RegistryHelp.SetInt("position-x", posX); + RegistryHelp.SetInt("position-y", posY); - RegistryHelp.SetInt("HorizontalLocation", x); - RegistryHelp.SetInt("VerticalLocation", y); + RegistryHelp.SetInt("location-horizontal", x); + RegistryHelp.SetInt("location-vertical", y); } protected override CreateParams CreateParams { @@ -714,8 +708,8 @@ namespace mpvnet bool skip = m.Msg == 0x100 && LastAppCommand != 0 && (Environment.TickCount - LastAppCommand) < 1000; - if (core.WindowHandle != IntPtr.Zero && !skip) - m.Result = SendMessage(core.WindowHandle, m.Msg, m.WParam, m.LParam); + if (Core.WindowHandle != IntPtr.Zero && !skip) + m.Result = SendMessage(Core.WindowHandle, m.Msg, m.WParam, m.LParam); } break; case 0x319: // WM_APPCOMMAND @@ -724,7 +718,7 @@ namespace mpvnet if (value != null) { - core.command("keypress " + value); + Core.command("keypress " + value); m.Result = new IntPtr(1); LastAppCommand = Environment.TickCount; return; @@ -738,7 +732,7 @@ namespace mpvnet if (Environment.TickCount - LastCycleFullscreen > 500) { Point pos = PointToClient(Cursor.Position); - core.command($"mouse {pos.X} {pos.Y}"); + Core.command($"mouse {pos.X} {pos.Y}"); } if (CursorHelp.IsPosDifferent(LastCursorPosition)) @@ -746,12 +740,12 @@ namespace mpvnet break; case 0x2a3: // WM_MOUSELEAVE //osc won't auto hide after mouse left window in borderless mode - core.command($"mouse {ClientSize.Width / 2} {ClientSize.Height / 3}"); + Core.command($"mouse {ClientSize.Width / 2} {ClientSize.Height / 3}"); break; case 0x203: // WM_LBUTTONDBLCLK { Point pos = PointToClient(Cursor.Position); - core.command($"mouse {pos.X} {pos.Y} 0 double"); + Core.command($"mouse {pos.X} {pos.Y} 0 double"); } break; case 0x02E0: // WM_DPICHANGED @@ -770,7 +764,7 @@ namespace mpvnet SubtractWindowBorders(Handle, ref r, GetDPI(Handle)); int c_w = r.Right - r.Left, c_h = r.Bottom - r.Top; - Size videoSize = core.VideoSize; + Size videoSize = Core.VideoSize; if (videoSize == Size.Empty) videoSize = new Size(16, 9); @@ -800,14 +794,14 @@ namespace mpvnet switch (mode) { case "single": - core.LoadFiles(args, true, ModifierKeys.HasFlag(Keys.Control)); + Core.LoadFiles(args, true, ModifierKeys.HasFlag(Keys.Control)); break; case "queue": foreach (string file in args) - core.commandv("loadfile", file, "append"); + Core.commandv("loadfile", file, "append"); break; case "command": - core.command(args[0]); + Core.command(args[0]); break; } @@ -816,7 +810,7 @@ namespace mpvnet return; } - if (m.Msg == TaskbarButtonCreatedMessage && core.TaskbarProgress) + if (m.Msg == TaskbarButtonCreatedMessage && Core.TaskbarProgress) { Taskbar = new Taskbar(Handle); ProgressTimer.Start(); @@ -845,21 +839,21 @@ namespace mpvnet void UpdateProgressBar() { - if (core.TaskbarProgress && Taskbar != null) - Taskbar.SetValue(core.get_property_number("time-pos"), core.Duration.TotalSeconds); + if (Core.TaskbarProgress && Taskbar != null) + Taskbar.SetValue(Core.get_property_number("time-pos"), Core.Duration.TotalSeconds); } void PropChangeOnTop(bool value) => BeginInvoke(new Action(() => TopMost = value)); - void PropChangeAid(string value) => core.Aid = value; + void PropChangeAid(string value) => Core.Aid = value; - void PropChangeSid(string value) => core.Sid = value; + void PropChangeSid(string value) => Core.Sid = value; - void PropChangeVid(string value) => core.Vid = value; + void PropChangeVid(string value) => Core.Vid = value; void PropChangeTitle(string value) { Title = value; SetTitle(); } - void PropChangeEdition(int value) => core.Edition = value; + void PropChangeEdition(int value) => Core.Edition = value; void PropChangeWindowMaximized() { @@ -868,11 +862,11 @@ namespace mpvnet BeginInvoke(new Action(() => { - core.WindowMaximized = core.get_property_bool("window-maximized"); + Core.WindowMaximized = Core.get_property_bool("window-maximized"); - if (core.WindowMaximized && WindowState != FormWindowState.Maximized) + if (Core.WindowMaximized && WindowState != FormWindowState.Maximized) WindowState = FormWindowState.Maximized; - else if (!core.WindowMaximized && WindowState == FormWindowState.Maximized) + else if (!Core.WindowMaximized && WindowState == FormWindowState.Maximized) WindowState = FormWindowState.Normal; })); } @@ -884,25 +878,25 @@ namespace mpvnet BeginInvoke(new Action(() => { - core.WindowMinimized = core.get_property_bool("window-minimized"); + Core.WindowMinimized = Core.get_property_bool("window-minimized"); - if (core.WindowMinimized && WindowState != FormWindowState.Minimized) + if (Core.WindowMinimized && WindowState != FormWindowState.Minimized) WindowState = FormWindowState.Minimized; - else if (!core.WindowMinimized && WindowState == FormWindowState.Minimized) + else if (!Core.WindowMinimized && WindowState == FormWindowState.Minimized) WindowState = FormWindowState.Normal; })); } void PropChangeBorder(bool enabled) { - core.Border = enabled; + Core.Border = enabled; BeginInvoke(new Action(() => { if (!IsFullscreen) { - if (core.Border && FormBorderStyle == FormBorderStyle.None) + if (Core.Border && FormBorderStyle == FormBorderStyle.None) FormBorderStyle = FormBorderStyle.Sizable; - if (!core.Border && FormBorderStyle == FormBorderStyle.Sizable) + if (!Core.Border && FormBorderStyle == FormBorderStyle.Sizable) FormBorderStyle = FormBorderStyle.None; } })); @@ -910,7 +904,7 @@ namespace mpvnet void PropChangePause(bool enabled) { - if (Taskbar != null && core.TaskbarProgress) + if (Taskbar != null && Core.TaskbarProgress) { if (enabled) Taskbar.SetState(TaskbarStates.Paused); @@ -923,44 +917,13 @@ namespace mpvnet { base.OnLoad(e); - if (core.GPUAPI != "vulkan") - core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); + if (Core.GPUAPI != "vulkan") + Core.VideoSizeAutoResetEvent.WaitOne(App.StartThreshold); LastCycleFullscreen = Environment.TickCount; SetFormPosAndSize(); } - protected override void OnShown(EventArgs e) - { - base.OnShown(e); - - if (WindowState == FormWindowState.Maximized) - core.set_property_bool("window-maximized", true); - - if (core.GPUAPI == "vulkan") - core.ProcessCommandLine(false); - - ToolStripRendererEx.ForegroundColor = Theme.Current.GetWinFormsColor("menu-foreground"); - ToolStripRendererEx.BackgroundColor = Theme.Current.GetWinFormsColor("menu-background"); - ToolStripRendererEx.SelectionColor = Theme.Current.GetWinFormsColor("menu-highlight"); - ToolStripRendererEx.BorderColor = Theme.Current.GetWinFormsColor("menu-border"); - ToolStripRendererEx.CheckedColor = Theme.Current.GetWinFormsColor("menu-checked"); - - BuildMenu(); - ContextMenuStrip = ContextMenu; - WPF.Init(); - System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; - Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); - UpdateCheck.DailyCheck(); - core.LoadScripts(); - GlobalHotkey.RegisterGlobalHotkeys(Handle); - App.RunTask(() => App.Extension = new Extension()); - CSharpScriptHost.ExecuteScriptsInFolder(core.ConfigFolder + "scripts-cs"); - ShownTickCount = Environment.TickCount; - App.ShowSetup(); - MsgError("aaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbb"); - } - protected override void OnActivated(EventArgs e) { base.OnActivated(e); @@ -968,12 +931,49 @@ namespace mpvnet SendMessage(Handle, m.Msg, m.WParam, m.LParam); } + protected override void OnShown(EventArgs e) + { + base.OnShown(e); + + if (WindowState == FormWindowState.Maximized) + Core.set_property_bool("window-maximized", true); + + if (Core.GPUAPI == "vulkan") + Core.ProcessCommandLine(false); + + BuildMenu(); + ContextMenuStrip = ContextMenu; + WPF.Init(); + System.Windows.Application.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; + Cursor.Position = new Point(Cursor.Position.X + 1, Cursor.Position.Y); + UpdateCheck.DailyCheck(); + Core.LoadScripts(); + GlobalHotkey.RegisterGlobalHotkeys(Handle); + App.RunTask(() => App.Extension = new Extension()); + CSharpScriptHost.ExecuteScriptsInFolder(Core.ConfigFolder + "scripts-cs"); + ShownTickCount = Environment.TickCount; + App.ShowSetup(); + + //if (Debugger.IsAttached) + //{ + //} + } + + static void SetColors() + { + ToolStripRendererEx.ForegroundColor = Theme.Current.GetWinFormsColor("menu-foreground"); + ToolStripRendererEx.BackgroundColor = Theme.Current.GetWinFormsColor("menu-background"); + ToolStripRendererEx.SelectionColor = Theme.Current.GetWinFormsColor("menu-highlight"); + ToolStripRendererEx.BorderColor = Theme.Current.GetWinFormsColor("menu-border"); + ToolStripRendererEx.CheckedColor = Theme.Current.GetWinFormsColor("menu-checked"); + } + protected override void OnResize(EventArgs e) { base.OnResize(e); - if (core.IsLogoVisible) - core.ShowLogo(); + if (Core.IsLogoVisible) + Core.ShowLogo(); if (FormBorderStyle != FormBorderStyle.None) { @@ -987,16 +987,16 @@ namespace mpvnet { if (WindowState == FormWindowState.Minimized) { - core.set_property_bool("window-minimized", true); + Core.set_property_bool("window-minimized", true); } else if (WindowState == FormWindowState.Normal) { - core.set_property_bool("window-maximized", false); - core.set_property_bool("window-minimized", false); + Core.set_property_bool("window-maximized", false); + Core.set_property_bool("window-minimized", false); } else if (WindowState == FormWindowState.Maximized) { - core.set_property_bool("window-maximized", true); + Core.set_property_bool("window-maximized", true); } } } @@ -1005,12 +1005,12 @@ namespace mpvnet { base.OnFormClosing(e); SaveWindowProperties(); - RegistryHelp.SetValue(App.RegPath, "Recent", RecentFiles.ToArray()); + RegistryHelp.SetValue("recent", RecentFiles.ToArray()); - if (core.IsQuitNeeded) - core.commandv("quit"); + if (Core.IsQuitNeeded) + Core.commandv("quit"); - if (!core.ShutdownAutoResetEvent.WaitOne(10000)) + if (!Core.ShutdownAutoResetEvent.WaitOne(10000)) Msg.ShowError("Shutdown thread failed to complete within 10 seconds."); } @@ -1027,7 +1027,7 @@ namespace mpvnet } if (Width - e.Location.X < 10 && e.Location.Y < 10) - core.commandv("quit"); + Core.commandv("quit"); } protected override void OnDragEnter(DragEventArgs e) @@ -1043,10 +1043,10 @@ namespace mpvnet base.OnDragDrop(e); if (e.Data.GetDataPresent(DataFormats.FileDrop)) - core.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as String[], true, Control.ModifierKeys.HasFlag(Keys.Control)); + Core.LoadFiles(e.Data.GetData(DataFormats.FileDrop) as String[], true, Control.ModifierKeys.HasFlag(Keys.Control)); if (e.Data.GetDataPresent(DataFormats.Text)) - core.LoadFiles(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, Control.ModifierKeys.HasFlag(Keys.Control)); + Core.LoadFiles(new[] { e.Data.GetData(DataFormats.Text).ToString() }, true, Control.ModifierKeys.HasFlag(Keys.Control)); } protected override void OnLostFocus(EventArgs e) diff --git a/src/WinForms/TaskDialog/CheckBoxRendererEx.vb b/src/WinForms/TaskDialog/CheckBoxRendererEx.vb deleted file mode 100644 index 33978e5..0000000 --- a/src/WinForms/TaskDialog/CheckBoxRendererEx.vb +++ /dev/null @@ -1,70 +0,0 @@ - -Imports System.Drawing -Imports System.Drawing.Drawing2D -Imports System.Windows.Forms -Imports System.Windows.Forms.VisualStyles - -Public Class CheckBoxRendererEx - Public Shared Sub DrawCheckBox(g As Graphics, glyphLocation As Point, state As CheckBoxState) - DrawCheckBox(g, New Rectangle(glyphLocation, GetGlyphSize(g, state)), state) - End Sub - - Public Shared Sub DrawCheckBox(g As Graphics, rect As Rectangle, state As CheckBoxState) - 'Dim smoothingModeBackup = g.SmoothingMode - 'g.SmoothingMode = SmoothingMode.AntiAlias - - 'If ThemeManager.CurrentTheme.UsesSystemColors OrElse DesignHelp.IsDesignMode Then - ' CheckBoxRenderer.DrawCheckBox(g, rect.Location, state) - ' Return - 'End If - - 'Dim theme = ThemeManager.CurrentTheme.General.Controls.CheckBox - 'Dim checked = state = CheckBoxState.CheckedDisabled OrElse state = CheckBoxState.CheckedHot OrElse state = CheckBoxState.CheckedNormal OrElse state = CheckBoxState.CheckedPressed - 'Dim backColor = If(checked, theme.BoxCheckedColor, theme.BoxColor) - 'Dim borderColor = If(checked, theme.BorderCheckedColor, theme.BorderColor) - 'Dim borderStrength = 2 - 'Dim checkmarkColor = theme.CheckmarkColor - 'Dim checkmarkStrength = rect.Width \ 5 - - 'Select Case state - ' Case CheckBoxState.CheckedNormal - ' Using brush As New SolidBrush(backColor) - ' Using pen As New Pen(borderColor, borderStrength) - ' g.FillRectangle(brush, rect) - ' g.DrawRectangle(pen, rect) - ' End Using - ' End Using - - ' Dim startX1 = rect.Left + rect.Width / 4.5F - ' Dim startY1 = rect.Top + rect.Height / 2.75F - ' Dim endX1 = rect.Left + rect.Width / 3.0F - ' Dim endY1 = rect.Top + rect.Height / 1.2F - - ' Dim startX2 = rect.Left + rect.Width / 3.6F - ' Dim startY2 = rect.Top + rect.Height / 1.3F - ' Dim endX2 = rect.Left + rect.Width / 1.2F - ' Dim endY2 = rect.Top + rect.Height / 5.0F - - ' Using pen As New Pen(checkmarkColor, checkmarkStrength) - ' g.DrawLine(pen, startX1, startY1, endX1, endY1) - ' g.DrawLine(pen, startX2, startY2, endX2, endY2) - ' End Using - - ' Case CheckBoxState.UncheckedNormal - ' Using brush As New SolidBrush(backColor) - ' Using pen As New Pen(borderColor, borderStrength) - ' g.FillRectangle(brush, rect) - ' g.DrawRectangle(pen, rect) - ' End Using - ' End Using - 'End Select - - 'g.SmoothingMode = smoothingModeBackup - End Sub - - Shared Function GetGlyphSize(g As Graphics, state As CheckBoxState) As Size - Dim defaultSize = CheckBoxRenderer.GetGlyphSize(g, state) - Dim uiSize = New Size(CInt(defaultSize.Width), CInt(defaultSize.Height)) - Return uiSize - End Function -End Class diff --git a/src/WinForms/TaskDialog/ColorHSL.vb b/src/WinForms/TaskDialog/ColorHSL.vb deleted file mode 100644 index 39100e3..0000000 --- a/src/WinForms/TaskDialog/ColorHSL.vb +++ /dev/null @@ -1,164 +0,0 @@ -Imports System.Drawing - - -Public Structure ColorHSL - Private ReadOnly _h As Integer - Private ReadOnly _s As Single - Private ReadOnly _l As Single - Private ReadOnly _a As Single - - - Public ReadOnly Property H As Integer - Get - Return _h - End Get - End Property - - Public ReadOnly Property S As Single - Get - Return _s - End Get - End Property - - Public ReadOnly Property L As Single - Get - Return _l - End Get - End Property - - Public ReadOnly Property A As Single - Get - Return _a - End Get - End Property - - Public Sub New(h As Integer, s As Single, l As Single, Optional a As Single = 1.0F) - Dim newHue = h Mod 360 - _h = Mathf.Clamp(If(newHue < 0, newHue + 360, newHue), 0, 359) - _s = Mathf.Clamp01(s) - _l = Mathf.Clamp01(l) - _a = Mathf.Clamp01(a) - End Sub - - Public Shared Widening Operator CType(colorHSL As ColorHSL) As Color - Dim hue As Integer = Mathf.Clamp(colorHSL.H Mod 360, 0, 359) - Dim saturation As Single = Mathf.Clamp01(colorHSL.S) - Dim lightness As Single = Mathf.Clamp01(colorHSL.L) - Dim alpha As Single = Mathf.Clamp01(colorHSL.A) - Dim c As Single = (1.0F - Math.Abs(2.0F * lightness - 1.0F)) * saturation - Dim x As Single = c * (1.0F - Math.Abs((hue / 60.0F) Mod 2.0F - 1.0F)) - Dim m As Single = lightness - c / 2.0F - Dim r As Single = c - Dim g As Single = 0 - Dim b As Single = x - - If hue < 300 Then - r = x - g = 0 - b = c - End If - - If hue < 240 Then - r = 0 - g = x - b = c - End If - - If hue < 180 Then - r = 0 - g = c - b = x - End If - - If hue < 120 Then - r = x - g = c - b = 0 - End If - - If hue < 60 Then - r = c - g = x - b = 0 - End If - - Return Color.FromArgb(CType(alpha * 255.0F, Byte), CType(Mathf.Clamp01(r + m) * 255.0F, Byte), CType(Mathf.Clamp01(g + m) * 255.0F, Byte), CType(Mathf.Clamp01(b + m) * 255.0F, Byte)) - End Operator - - Public Shared Widening Operator CType(color As Color) As ColorHSL - Dim r As Single = color.R / 255.0F - Dim g As Single = color.G / 255.0F - Dim b As Single = color.B / 255.0F - Dim max As Single = Mathf.Max(r, g, b) - Dim min As Single = Mathf.Min(r, g, b) - Dim delta As Single = max - min - Dim alpha As Single = color.A / 255.0F - Dim lightness As Single = (min + max) / 2 - Dim saturation As Single = 0F - saturation = If(delta <> 0F, (delta / (1 - Math.Abs(2 * lightness - 1))), saturation) - Dim hue As Single = 0F - If delta <> 0F Then - hue = If(max = r, 60.0F * (((g - b) / delta) Mod 6.0F), hue) - hue = If(max = g, 60.0F * (((b - r) / delta) + 2.0F), hue) - hue = If(max = b, 60.0F * (((r - g) / delta) + 4.0F), hue) - End If - Return New ColorHSL(Mathf.RoundToInt(hue), saturation, lightness, alpha) - End Operator - - Public Shared Operator =(colorA As ColorHSL, colorB As ColorHSL) As Boolean - Return colorA.Equals(colorB) - End Operator - - Public Shared Operator <>(colorA As ColorHSL, colorB As ColorHSL) As Boolean - Return Not colorA.Equals(colorB) - End Operator - - Public Function AddHue(offset As Integer) As ColorHSL - Return New ColorHSL(H + offset, S, L, A) - End Function - - Public Function AddSaturation(offset As Single) As ColorHSL - Return New ColorHSL(H, S + offset, L, A) - End Function - - Public Function AddLuminance(offset As Single) As ColorHSL - Return New ColorHSL(H, S, L + offset, A) - End Function - - Public Function AddAlpha(offset As Single) As ColorHSL - Return New ColorHSL(H, S, L, A + offset) - End Function - - Public Overrides Function Equals(obj As Object) As Boolean - Dim objColor = CType(obj, ColorHSL) - Return H = objColor.H AndAlso S = objColor.S AndAlso L = objColor.L AndAlso A = objColor.A - End Function - - Public Function SetHue(value As Integer) As ColorHSL - Return New ColorHSL(value, S, L, A) - End Function - - Public Function SetSaturation(value As Single) As ColorHSL - Return New ColorHSL(H, value, L, A) - End Function - - Public Function SetLuminance(value As Single) As ColorHSL - Return New ColorHSL(H, S, value, A) - End Function - - Public Function SetAlpha(value As Single) As ColorHSL - Return New ColorHSL(H, S, L, value) - End Function - - Public Function ToColor() As Color - Return CType(Me, Color) - End Function - - Public Function ToHTML() As String - Return ColorTranslator.ToHtml(Me) - End Function - - Public Overrides Function ToString() As String - Return String.Format($"HSLA({H:0}, {S:0.00}, {L:0.00}, {A:0.00})") - End Function -End Structure diff --git a/src/WinForms/TaskDialog/Mathf.vb b/src/WinForms/TaskDialog/Mathf.vb deleted file mode 100644 index 17367a0..0000000 --- a/src/WinForms/TaskDialog/Mathf.vb +++ /dev/null @@ -1,116 +0,0 @@ -Public Class Mathf - Public Shared Function Clamp(value As Integer, min As Integer, max As Integer) As Integer - If value < min Then - value = min - ElseIf value > max Then - value = max - End If - Return value - End Function - - Public Shared Function Clamp(value As Single, min As Single, max As Single) As Single - If value < min Then - value = min - ElseIf value > max Then - value = max - End If - Return value - End Function - - Public Shared Function Clamp01(value As Single) As Single - If value < 0F Then - value = 0F - ElseIf value > 1.0F Then - value = 1.0F - End If - Return value - End Function - - Public Shared Function Min(a As Single, b As Single) As Single - Return If((a >= b), b, a) - End Function - - Public Shared Function Min(ParamArray values As Single()) As Single - Dim num As Integer = values.Length - Dim result As Single - If num = 0 Then - result = 0F - Else - Dim num2 As Single = values(0) - For i As Integer = 1 To num - 1 - If values(i) < num2 Then - num2 = values(i) - End If - Next - result = num2 - End If - Return result - End Function - - Public Shared Function Min(a As Integer, b As Integer) As Integer - Return If((a >= b), b, a) - End Function - - Public Shared Function Min(ParamArray values As Integer()) As Integer - Dim num As Integer = values.Length - Dim result As Integer - If num = 0 Then - result = 0 - Else - Dim num2 As Integer = values(0) - For i As Integer = 1 To num - 1 - If values(i) < num2 Then - num2 = values(i) - End If - Next - result = num2 - End If - Return result - End Function - - Public Shared Function Max(a As Single, b As Single) As Single - Return If((a <= b), b, a) - End Function - - Public Shared Function Max(ParamArray values As Single()) As Single - Dim num As Integer = values.Length - Dim result As Single - If num = 0 Then - result = 0F - Else - Dim num2 As Single = values(0) - For i As Integer = 1 To num - 1 - If values(i) > num2 Then - num2 = values(i) - End If - Next - result = num2 - End If - Return result - End Function - - Public Shared Function Max(a As Integer, b As Integer) As Integer - Return If((a <= b), b, a) - End Function - - Public Shared Function Max(ParamArray values As Integer()) As Integer - Dim num As Integer = values.Length - Dim result As Integer - If num = 0 Then - result = 0 - Else - Dim num2 As Integer = values(0) - For i As Integer = 1 To num - 1 - If values(i) > num2 Then - num2 = values(i) - End If - Next - result = num2 - End If - Return result - End Function - - Public Shared Function RoundToInt(value As Single) As Integer - Return CInt(Math.Round(value)) - End Function -End Class diff --git a/src/WinForms/TaskDialog/Misc.vb b/src/WinForms/TaskDialog/Misc.vb deleted file mode 100644 index 0321bc6..0000000 --- a/src/WinForms/TaskDialog/Misc.vb +++ /dev/null @@ -1,69 +0,0 @@ - -Imports System.IO -Imports System.Runtime.InteropServices -Imports System.Text -Imports System.Windows.Forms - -Public Class StringHelp - Shared Function Base(instance As String) As String - If instance = "" Then - Return "" - End If - - Dim ret = instance - - If ret.Contains(Path.DirectorySeparatorChar) Then - ret = RightLast(ret, Path.DirectorySeparatorChar) - End If - - If ret.Contains(".") Then - ret = LeftLast(ret, ".") - End If - - Return ret - End Function - - Shared Function RightLast(value As String, start As String) As String - If value = "" OrElse start = "" Then - Return "" - End If - - If Not value.Contains(start) Then - Return "" - End If - - Return value.Substring(value.LastIndexOf(start) + start.Length) - End Function - - Shared Function LeftLast(value As String, start As String) As String - If Not value.Contains(start) Then - Return "" - End If - - Return value.Substring(0, value.LastIndexOf(start)) - End Function -End Class - -Public Class Native - - Shared Function GetForegroundWindow() As IntPtr - End Function - - - Shared Function GetWindowModuleFileName( - hwnd As IntPtr, - lpszFileName As StringBuilder, - cchFileNameMax As UInteger) As UInteger - End Function - - - Shared Function SetWindowPos( - hWnd As IntPtr, - hWndInsertAfter As IntPtr, - X As Integer, - Y As Integer, - cx As Integer, - cy As Integer, - uFlags As UInteger) As Boolean - End Function -End Class \ No newline at end of file diff --git a/src/WinForms/TaskDialog/Msg.vb b/src/WinForms/TaskDialog/Msg.vb deleted file mode 100644 index 6fab867..0000000 --- a/src/WinForms/TaskDialog/Msg.vb +++ /dev/null @@ -1,82 +0,0 @@ - -Imports System.Windows.Forms - -Public Class Msg - Shared Sub MsgInfo(title As Object, Optional content As Object = Nothing) - Dim title1 = title?.ToString - Dim content1 = content?.ToString - Msg(title1, content1, TaskIcon.Info, TaskButton.OK) - End Sub - - Shared Sub MsgError(title As String, Optional content As String = Nothing) - MsgError(title, content, IntPtr.Zero) - End Sub - - Shared Sub MsgError(title As String, content As String, handle As IntPtr) - If title = "" Then - title = content - End If - - If title = "" Then - Exit Sub - End If - - Using td As New TaskDialog(Of String) - td.Title = title - td.Content = content - td.Owner = handle - td.Icon = TaskIcon.Error - td.ShowCopyButton = True - td.AddButton("OK") - td.Show() - End Using - End Sub - - Private Shared ShownMessages As String - - Shared Sub MsgWarn(text As String, Optional content As String = Nothing, Optional onlyOnce As Boolean = False) - If onlyOnce AndAlso ShownMessages?.Contains(text + content) Then - Exit Sub - End If - - Msg(text, content, TaskIcon.Warning, TaskButton.OK) - - If onlyOnce Then - ShownMessages += text + content - End If - End Sub - - Shared Function MsgOK(title As String) As Boolean - Return Msg(title, Nothing, TaskIcon.Question, TaskButton.OkCancel) = DialogResult.OK - End Function - - Shared Function MsgQuestion( - title As String, - Optional buttons As TaskButton = TaskButton.OkCancel) As DialogResult - - Return Msg(title, Nothing, TaskIcon.Question, buttons) - End Function - - Shared Function MsgQuestion( - title As String, - content As String, - Optional buttons As TaskButton = TaskButton.OkCancel) As DialogResult - - Return Msg(title, content, TaskIcon.Question, buttons) - End Function - - Shared Function Msg( - title As String, - content As String, - icon As TaskIcon, - buttons As TaskButton) As DialogResult - - Using td As New TaskDialog(Of DialogResult) - td.Icon = icon - td.Title = title - td.Content = content - td.Buttons = buttons - Return td.Show() - End Using - End Function -End Class diff --git a/src/WinForms/TaskDialog/My Project/Application.Designer.vb b/src/WinForms/TaskDialog/My Project/Application.Designer.vb deleted file mode 100644 index 88dd01c..0000000 --- a/src/WinForms/TaskDialog/My Project/Application.Designer.vb +++ /dev/null @@ -1,13 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - diff --git a/src/WinForms/TaskDialog/My Project/Application.myapp b/src/WinForms/TaskDialog/My Project/Application.myapp deleted file mode 100644 index e62f1a5..0000000 --- a/src/WinForms/TaskDialog/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - false - false - 0 - true - 0 - 2 - true - diff --git a/src/WinForms/TaskDialog/My Project/AssemblyInfo.vb b/src/WinForms/TaskDialog/My Project/AssemblyInfo.vb deleted file mode 100644 index bf41d06..0000000 --- a/src/WinForms/TaskDialog/My Project/AssemblyInfo.vb +++ /dev/null @@ -1,35 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - -' Review the values of the assembly attributes - - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: -' - - - diff --git a/src/WinForms/TaskDialog/My Project/Resources.Designer.vb b/src/WinForms/TaskDialog/My Project/Resources.Designer.vb deleted file mode 100644 index 9a3290c..0000000 --- a/src/WinForms/TaskDialog/My Project/Resources.Designer.vb +++ /dev/null @@ -1,63 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - -Imports System - -Namespace My.Resources - - 'This class was auto-generated by the StronglyTypedResourceBuilder - 'class via a tool like ResGen or Visual Studio. - 'To add or remove a member, edit your .ResX file then rerun ResGen - 'with the /str option, or rebuild your VS project. - ''' - ''' A strongly-typed resource class, for looking up localized strings, etc. - ''' - _ - Friend Module Resources - - Private resourceMan As Global.System.Resources.ResourceManager - - Private resourceCulture As Global.System.Globalization.CultureInfo - - ''' - ''' Returns the cached ResourceManager instance used by this class. - ''' - _ - Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager - Get - If Object.ReferenceEquals(resourceMan, Nothing) Then - Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TaskDialog.Resources", GetType(Resources).Assembly) - resourceMan = temp - End If - Return resourceMan - End Get - End Property - - ''' - ''' Overrides the current thread's CurrentUICulture property for all - ''' resource lookups using this strongly typed resource class. - ''' - _ - Friend Property Culture() As Global.System.Globalization.CultureInfo - Get - Return resourceCulture - End Get - Set - resourceCulture = value - End Set - End Property - End Module -End Namespace diff --git a/src/WinForms/TaskDialog/My Project/Resources.resx b/src/WinForms/TaskDialog/My Project/Resources.resx deleted file mode 100644 index af7dbeb..0000000 --- a/src/WinForms/TaskDialog/My Project/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/WinForms/TaskDialog/My Project/Settings.Designer.vb b/src/WinForms/TaskDialog/My Project/Settings.Designer.vb deleted file mode 100644 index dffe133..0000000 --- a/src/WinForms/TaskDialog/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict On -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.TaskDialog.My.MySettings - Get - Return Global.TaskDialog.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/src/WinForms/TaskDialog/My Project/Settings.settings b/src/WinForms/TaskDialog/My Project/Settings.settings deleted file mode 100644 index 85b890b..0000000 --- a/src/WinForms/TaskDialog/My Project/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/WinForms/TaskDialog/StockIcon.vb b/src/WinForms/TaskDialog/StockIcon.vb deleted file mode 100644 index 9378342..0000000 --- a/src/WinForms/TaskDialog/StockIcon.vb +++ /dev/null @@ -1,144 +0,0 @@ - -Imports System.Drawing -Imports System.Runtime.InteropServices - - -Enum StockIconOptions As UInteger - Small = &H1 - ShellSize = &H4 - Handle = &H100 - SystemIndex = &H4000 - LinkOverlay = &H8000 - Selected = &H10000 -End Enum - -Enum StockIconIdentifier As UInteger - DocumentNotAssociated = 0 - DocumentAssociated = 1 - Application = 2 - Folder = 3 - FolderOpen = 4 - Drive525 = 5 - Drive35 = 6 - DriveRemove = 7 - DriveFixed = 8 - DriveNetwork = 9 - DriveNetworkDisabled = 10 - DriveCD = 11 - DriveRAM = 12 - World = 13 - Server = 15 - Printer = 16 - MyNetwork = 17 - Find = 22 - Help = 23 - Share = 28 - Link = 29 - SlowFile = 30 - Recycler = 31 - RecyclerFull = 32 - MediaCDAudio = 40 - Lock = 47 - AutoList = 49 - PrinterNet = 50 - ServerShare = 51 - PrinterFax = 52 - PrinterFaxNet = 53 - PrinterFile = 54 - Stack = 55 - MediaSVCD = 56 - StuffedFolder = 57 - DriveUnknown = 58 - DriveDVD = 59 - MediaDVD = 60 - MediaDVDRAM = 61 - MediaDVDRW = 62 - MediaDVDR = 63 - MediaDVDROM = 64 - MediaCDAudioPlus = 65 - MediaCDRW = 66 - MediaCDR = 67 - MediaCDBurn = 68 - MediaBlankCD = 69 - MediaCDROM = 70 - AudioFiles = 71 - ImageFiles = 72 - VideoFiles = 73 - MixedFiles = 74 - FolderBack = 75 - FolderFront = 76 - Shield = 77 - Warning = 78 - Info = 79 - [Error] = 80 - Key = 81 - Software = 82 - Rename = 83 - Delete = 84 - MediaAudioDVD = 85 - MediaMovieDVD = 86 - MediaEnhancedCD = 87 - MediaEnhancedDVD = 88 - MediaHDDVD = 89 - MediaBluRay = 90 - MediaVCD = 91 - MediaDVDPlusR = 92 - MediaDVDPlusRW = 93 - DesktopPC = 94 - MobilePC = 95 - Users = 96 - MediaSmartMedia = 97 - MediaCompactFlash = 98 - DeviceCellPhone = 99 - DeviceCamera = 100 - DeviceVideoCamera = 101 - DeviceAudioPlayer = 102 - NetworkConnect = 103 - Internet = 104 - ZipFile = 105 - Settings = 106 -End Enum - -Class StockIcon - - Structure StockIconInfo - Friend StuctureSize As UInt32 - Friend Handle As IntPtr - Friend ImageIndex As Int32 - Friend Identifier As Int32 - - Friend Path As String - End Structure - - - Shared Function SHGetStockIconInfo( - identifier As StockIconIdentifier, - flags As StockIconOptions, - ByRef info As StockIconInfo) As Integer - End Function - - - Shared Function DestroyIcon(handle As IntPtr) As Boolean - End Function - - Shared Function GetSmallImage(identifier As StockIconIdentifier) As Bitmap - Dim ptr = GetIcon(identifier, StockIconOptions.Handle Or StockIconOptions.Small) - Dim bmp = Icon.FromHandle(ptr).ToBitmap - DestroyIcon(ptr) - Return bmp - End Function - - Shared Function GetImage(identifier As StockIconIdentifier) As Image - Dim ptr = GetIcon(identifier, StockIconOptions.Handle Or StockIconOptions.ShellSize) - Dim bmp = Icon.FromHandle(ptr).ToBitmap - DestroyIcon(ptr) - Return bmp - End Function - - Shared Function GetIcon(identifier As StockIconIdentifier, flags As StockIconOptions) As IntPtr - Dim info As New StockIconInfo() - info.StuctureSize = CType(Marshal.SizeOf(GetType(StockIconInfo)), UInt32) - Marshal.ThrowExceptionForHR(SHGetStockIconInfo(identifier, flags, info)) - Return info.Handle - End Function -End Class diff --git a/src/WinForms/TaskDialog/Symbol.vb b/src/WinForms/TaskDialog/Symbol.vb deleted file mode 100644 index 810adae..0000000 --- a/src/WinForms/TaskDialog/Symbol.vb +++ /dev/null @@ -1,2059 +0,0 @@ - -Public Enum Symbol - None = 0 - [Error] = &HE783 - [Like] = &HE8E1 - [Next] = &HE893 - [Stop] = &HE71A - Accept = &HE8FB - AcceptLegacy = &HE10B - Accident = &HE81F - AccidentSolid = &HEA8E - Accounts = &HE910 - AccountsLegacy = &HE168 - ActionCenter = &HE91C - ActionCenterAsterisk = &HEA21 - ActionCenterMirrored = &HED0D - ActionCenterNotification = &HE7E7 - ActionCenterNotificationMirrored = &HED0C - ActionCenterQuiet = &HEE79 - ActionCenterQuietNotification = &HEE7A - Add = &HE710 - AddFriend = &HE8FA - AddFriendLegacy = &HE1E2 - AddLegacy = &HE109 - AddRemoteDevice = &HE836 - AddSurfaceHub = &HECC4 - AddTo = &HECC8 - AdjustHologram = &HEBD2 - Admin = &HE7EF - AdminLegacy = &HE1A7 - Airplane = &HE709 - AirplaneSolid = &HEB4C - AlignCenter = &HE8E3 - AlignCenterLegacy = &HE1A1 - AlignLeft = &HE8E4 - AlignLeftLegacy = &HE1A2 - AlignRight = &HE8E2 - AlignRightLegacy = &HE1A0 - AllApps = &HE71D - AllAppsLegacy = &HE179 - AllAppsLegacyMirrored = &HE1EC - AllAppsMirrored = &HEA40 - Annotation = &HE924 - AppIconDefault = &HECAA - ArrowHTMLLegacy = &HED5 - ArrowHTMLLegacyMirrored = &HEAE - AspectRatio = &HE799 - Asterisk = &HEA38 - AsteriskBadge12 = &HEDAD - Attach = &HE723 - AttachCamera = &HE8A2 - AttachCameraLegacy = &HE12D - AttachLegacy = &HE16C - Audio = &HE8D6 - AudioLegacy = &HE189 - Back = &HE72B - BackBttnArrow20Legacy = &HEC4 - BackBttnArrow42Legacy = &HEA6 - BackBttnMirroredArrow20Legacy = &HEAD - BackBttnMirroredArrow42Legacy = &HEAB - BackgroundToggle = &HEF1F - BackLegacy = &HE112 - BackSpaceQWERTY = &HE750 - BackSpaceQWERTYLg = &HEB96 - BackSpaceQWERTYMd = &HE926 - BackSpaceQWERTYSm = &HE925 - BackToWindow = &HE73F - BackToWindowLegacy = &HE1D8 - Badge = &HEC1B - Bank = &HE825 - BarcodeScanner = &HEC5A - Battery0 = &HE850 - Battery1 = &HE851 - Battery10 = &HE83F - Battery2 = &HE852 - Battery3 = &HE853 - Battery4 = &HE854 - Battery5 = &HE855 - Battery6 = &HE856 - Battery7 = &HE857 - Battery8 = &HE858 - Battery9 = &HE859 - BatteryCharging0 = &HE85A - BatteryCharging1 = &HE85B - BatteryCharging10 = &HEA93 - BatteryCharging2 = &HE85C - BatteryCharging3 = &HE85D - BatteryCharging4 = &HE85E - BatteryCharging5 = &HE85F - BatteryCharging6 = &HE860 - BatteryCharging7 = &HE861 - BatteryCharging8 = &HE862 - BatteryCharging9 = &HE83E - BatterySaver0 = &HE863 - BatterySaver1 = &HE864 - BatterySaver10 = &HEA95 - BatterySaver2 = &HE865 - BatterySaver3 = &HE866 - BatterySaver4 = &HE867 - BatterySaver5 = &HE868 - BatterySaver6 = &HE869 - BatterySaver7 = &HE86A - BatterySaver8 = &HE86B - BatterySaver9 = &HEA94 - BatteryUnknown = &HE996 - Beta = &HEA24 - BidiLtr = &HE9AA - BidiRtl = &HE9AB - BlockContact = &HE8F8 - BlockContactLegacy = &HE1E0 - BlockedLegacy = &HE25B - Bluetooth = &HE702 - BodyCam = &HEC80 - Bold = &HE8DD - BoldFLegacy = &HE1B3 - BoldGLegacy = &HE1B1 - BoldKoreanLegacy = &HE1BD - BoldLegacy = &HE19B - BoldNLegacy = &HE1B7 - BoldRussionLegacy = &HE1B9 - Bookmarks = &HE8A4 - BookmarksLegacy = &HE12F - BookmarksLegacyMirrored = &HE1EE - BookmarksMirrored = &HEA41 - Brightness = &HE706 - Broom = &HEA99 - BrowsePhotos = &HE7C5 - BrowsePhotosLegacy = &HE155 - BrushSize = &HEDA8 - BuildingEnergy = &HEC0B - BulletedList = &HE8FD - BulletedListLegacy = &HE292 - BulletedListLegacyMirrored = &HE299 - BulletedListMirrored = &HEA42 - Bus = &HE806 - BusSolid = &HEB47 - Calculator = &HE8EF - CalculatorAddition = &HE948 - CalculatorBackspace = &HE94F - CalculatorDivide = &HE94A - CalculatorEqualTo = &HE94E - CalculatorLegacy = &HE1D0 - CalculatorMultiply = &HE947 - CalculatorNegate = &HE94D - CalculatorPercentage = &HE94C - CalculatorSquareroot = &HE94B - CalculatorSubtract = &HE949 - Calendar = &HE787 - CalendarDay = &HE8BF - CalendarDayLegacy = &HE161 - CalendarLegacy = &HE163 - CalendarLegacyMirrored = &HE1DC - CalendarMirrored = &HED28 - CalendarReply = &HE8F5 - CalendarReplyLegacy = &HE1DB - CalendarSolid = &HEA89 - CalendarWeek = &HE8C0 - CalendarWeekLegacy = &HE162 - CaligraphyPen = &HEDFB - CallForwarding = &HE7F2 - CallForwardingMirrored = &HEA97 - CallForwardInternational = &HE87A - CallForwardInternationalMirrored = &HEA43 - CallForwardRoaming = &HE87B - CallForwardRoamingMirrored = &HEA44 - Camera = &HE722 - CameraLegacy = &HE114 - Cancel = &HE711 - CancelLegacy = &HE10A - Caption = &HE8BA - CaptionLegacy = &HE15A - Car = &HE804 - CashDrawer = &HEC59 - CC = &HE7F0 - CCEuroLegacy = &HE18F - CCJapanLegacy = &HE18E - CCLegacy = &HE190 - CellPhone = &HE8EA - CellPhoneLegacy = &HE1C9 - Certificate = &HEB95 - Characters = &HE8C1 - CharactersLegacy = &HE164 - ChatBubbles = &HE8F2 - Checkbox = &HE739 - CheckboxComposite = &HE73A - CheckboxCompositeLegacy = &HEA2 - CheckboxCompositeReversed = &HE73D - CheckboxCompositeReversedLegacy = &HE5 - CheckboxFill = &HE73B - CheckboxFillLegacy = &HE2 - CheckboxFillZeroWidthLegacy = &HE9 - CheckboxIndeterminate = &HE73C - CheckboxIndeterminateLegacy = &HE4 - CheckboxLegacy = &HE3 - CheckMark = &HE73E - CheckMarkLegacy = &HE1 - CheckmarkListviewLegacy = &HE81 - CheckmarkMenuLegacy = &HEE7 - CheckMarkZeroWidthLegacy = &HE8 - ChevronDown = &HE70D - ChevronDown1Legacy = &HE99 - ChevronDown2Legacy = &HE9D - ChevronDown3Legacy = &HE15 - ChevronDown4Legacy = &HEA1 - ChevronDownMed = &HE972 - ChevronDownSmall = &HE96E - ChevronDownSmLegacy = &HE228 - ChevronFlipDownLegacy = &HEE5 - ChevronFlipLeftLegacy = &HEE2 - ChevronFlipRightLegacy = &HEE3 - ChevronFlipUpLegacy = &HEE4 - ChevronLeft = &HE76B - ChevronLeft1Legacy = &HE96 - ChevronLeft2Legacy = &HE9A - ChevronLeft3Legacy = &HE12 - ChevronLeft4Legacy = &HE9E - ChevronLeftMed = &HE973 - ChevronLeftSmall = &HE96F - ChevronLeftSmLegacy = &HE26C - ChevronRight = &HE76C - ChevronRight1Legacy = &HE97 - ChevronRight2Legacy = &HE9B - ChevronRight3Legacy = &HE13 - ChevronRight4Legacy = &HE9F - ChevronRightMed = &HE974 - ChevronRightSmall = &HE970 - ChevronRightSmLegacy = &HE26B - ChevronUp = &HE70E - ChevronUp1Legacy = &HE98 - ChevronUp2Legacy = &HE9C - ChevronUp3Legacy = &HE14 - ChevronUp4Legacy = &HEA0 - ChevronUpMed = &HE971 - ChevronUpSmall = &HE96D - ChineseBoPoMoFo = &HE989 - ChineseChangjie = &HE981 - ChinesePinyin = &HE98A - ChineseQuick = &HE984 - ChromeAnnotate = &HE931 - ChromeBack = &HE830 - ChromeBackMirrored = &HEA47 - ChromeBackToWindow = &HE92C - ChromeClose = &HE8BB - ChromeFullScreen = &HE92D - ChromeMaximize = &HE922 - ChromeMinimize = &HE921 - ChromeRestore = &HE923 - CircleFill = &HEA3B - CircleFillBadge12 = &HEDB0 - CircleRing = &HEA3A - CircleRingBadge12 = &HEDAF - CityNext = &HEC06 - CityNext2 = &HEC07 - Clear = &HE894 - ClearAllInk = &HED62 - ClearAllInkMirrored = &HEF19 - ClearLegacy = &HE106 - ClearSelection = &HE8E6 - ClearSelectionLegacy = &HE1C5 - ClearSelectionLegacyMirrored = &HE1F4 - ClearSelectionMirrored = &HEA48 - Click = &HE8B0 - ClockLegacy = &HE121 - ClosePane = &HE89F - ClosePaneLegacy = &HE126 - ClosePaneLegacyMirrored = &HE1BF - ClosePaneMirrored = &HEA49 - Cloud = &HE753 - CloudPrinter = &HEDA6 - Code = &HE943 - Color = &HE790 - ColorLegacy = &HE2B1 - CommaKey = &HE9AD - CommandPrompt = &HE756 - Comment = &HE90A - CommentInlineLegacy = &HE206 - CommentLegacy = &HE134 - Communications = &HE95A - CompanionApp = &HEC64 - CompanionDeviceFramework = &HED5D - Completed = &HE930 - CompletedSolid = &HEC61 - Component = &HE950 - Connect = &HE703 - ConnectApp = &HED5C - Construction = &HE822 - ConstructionCone = &HE98F - ConstructionSolid = &HEA8D - Contact = &HE77B - Contact2 = &HE8D4 - Contact2Legacy = &HE187 - Contact3Legacy = &HE2AF - ContactInfo = &HE779 - ContactInfoLegacy = &HE136 - ContactInfoMirrored = &HEA4A - ContactLegacy = &HE13D - ContactPresence = &HE8CF - ContactPresenceLegacy = &HE181 - ContactSolid = &HEA8C - Copy = &HE8C8 - CopyLegacy = &HE16F - Courthouse = &HEC08 - Crop = &HE7A8 - CropLegacy = &HE123 - Cut = &HE8C6 - CutLegacy = &HE16B - DashKey = &HE9AE - DataSense = &HE791 - DataSenseBar = &HE7A5 - DateTime = &HEC92 - DateTimeMirrored = &HEE93 - DecreaseIndentLegacy = &HE290 - DecreaseIndentLegacyMirrored = &HE297 - DefenderApp = &HE83D - Delete = &HE74D - DeleteLegacy = &HE107 - DeveloperTools = &HEC7A - DeviceDiscovery = &HEBDE - DeviceLaptopNoPic = &HE7F8 - DeviceLaptopPic = &HE7F7 - DeviceMonitorLeftPic = &HE7FA - DeviceMonitorNoPic = &HE7FB - DeviceMonitorRightPic = &HE7F9 - Devices = &HE772 - Devices2 = &HE975 - Devices3 = &HEA6C - Devices4 = &HEB66 - DevicesLegacy = &HE212 - DevUpdate = &HECC5 - Diagnostic = &HE9D9 - Dialpad = &HE75F - DialUp = &HE83C - Dictionary = &HE82D - DictionaryAdd = &HE82E - DictionaryCloud = &HEBC3 - DirectAccess = &HE83B - Directions = &HE8F0 - DirectionsLegacy = &HE1D1 - DisableUpdates = &HE8D8 - DisableUpdatesLegacy = &HE194 - DisconnectDisplay = &HEA14 - DisconnectDrive = &HE8CD - DisconnectDriveLegacy = &HE17A - Dislike = &HE8E0 - DislikeLegacy = &HE19E - DMC = &HE951 - Dock = &HE952 - DockBottom = &HE90E - DockBottomLegacy = &HE147 - DockLeft = &HE90C - DockLeftLegacy = &HE145 - DockLeftLegacyMirrored = &HE1AB - DockLeftMirrored = &HEA4C - DockRight = &HE90D - DockRightLegacy = &HE146 - DockRightLegacyMirrored = &HE1AC - DockRightMirrored = &HEA4B - Document = &HE8A5 - DocumentLegacy = &HE130 - Down = &HE74B - DownLegacy = &HE1FD - Download = &HE896 - DownloadLegacy = &HE118 - DownloadMap = &HE826 - DownShiftKey = &HE84A - Draw = &HEC87 - DrawSolid = &HEC88 - DrivingMode = &HE7EC - Drop = &HEB42 - DullSound = &HE911 - DullSoundKey = &HE9AF - EaseOfAccess = &HE776 - EaseOfAccessLegacy = &HE7F - Edit = &HE70F - EditLegacy = &HE104 - EditLegacyMirrored = &HE1C2 - EditMirrored = &HEB7E - Education = &HE7BE - Emoji = &HE899 - Emoji2 = &HE76E - Emoji2Legacy = &HE170 - EmojiLegacy = &HE11D - EmojiSwatch = &HED5B - EmojiTabCelebrationObjects = &HED55 - EmojiTabFavorites = &HED5A - EmojiTabFoodPlants = &HED56 - EmojiTabPeople = &HED53 - EmojiTabSmilesAnimals = &HED54 - EmojiTabSymbols = &HED58 - EmojiTabTextSmiles = &HED59 - EmojiTabTransitPlaces = &HED57 - EndPoint = &HE81B - EndPointSolid = &HEB4B - EraseTool = &HE75C - EraseToolFill = &HE82B - EraseToolFill2 = &HE82C - ErrorBadge = &HEA39 - ErrorBadge12 = &HEDAE - eSIM = &HED2A - eSIMBusy = &HED2D - eSIMLocked = &HED2C - eSIMNoProfile = &HED2B - Ethernet = &HE839 - EthernetError = &HEB55 - EthernetWarning = &HEB56 - ExpandTile = &HE976 - ExpandTileLegacy = &HE13F - ExpandTileLegacyMirrored = &HE176 - ExpandTileMirrored = &HEA4E - ExploreContent = &HECCD - Export = &HEDE1 - ExportMirrored = &HEDE2 - FastForward = &HEB9D - Favorite2Legacy = &HE249 - FavoriteInlineLegacy = &HE208 - FavoriteLegacy = &HE113 - FavoriteList = &HE728 - FavoriteStar = &HE734 - FavoriteStarFill = &HE735 - Feedback = &HED15 - FeedbackApp = &HE939 - Ferry = &HE7E3 - FerrySolid = &HEB48 - FileExplorer = &HEC50 - FileExplorerApp = &HEC51 - Filter = &HE71C - FilterLegacy = &HE16E - FindLegacy = &HE11A - FingerInking = &HED5F - Fingerprint = &HE928 - Flag = &HE7C1 - FlagLegacy = &HE129 - Flashlight = &HE754 - FlickDown = &HE935 - FlickLeft = &HE937 - FlickRight = &HE938 - FlickUp = &HE936 - Folder = &HE8B7 - FolderFill = &HE8D5 - FolderLegacy = &HE188 - Font = &HE8D2 - FontColor = &HE8D3 - FontColorKoreanLegacy = &HE1BE - FontColorLegacy = &HE186 - FontDecrease = &HE8E7 - FontDecreaseLegacy = &HE1C6 - FontIncrease = &HE8E8 - FontIncreaseLegacy = &HE1C7 - FontLegacy = &HE185 - FontSize = &HE8E9 - FontSizeLegacy = &HE1C8 - FontStyleKoreanLegacy = &HE1BA - Forward = &HE72A - ForwardLegacy = &HE111 - ForwardSm = &HE9AC - FourBars = &HE908 - FourBarsLegacy = &HE1E9 - Frigid = &HE9CA - FullAlpha = &HE97F - FullCircleMask = &HE91F - FullHiragana = &HE986 - FullKatakana = &HE987 - FullScreen = &HE740 - FullScreenLegacy = &HE1D9 - Game = &HE7FC - GameConsole = &HE967 - GlobalNavButton = &HE700 - Globe = &HE774 - GlobeLegacy = &HE12B - Go = &HE8AD - GoLegacy = &HE143 - GoLegacyMirrored = &HE1AA - GoMirrored = &HEA4F - GoToStart = &HE8FC - GoToStartLegacy = &HE1E4 - GotoToday = &HE8D1 - GotoTodayLegacy = &HE184 - GripperBarHorizontal = &HE76F - GripperBarVertical = &HE784 - GripperResize = &HE788 - GripperResizeMirrored = &HEA50 - GripperTool = &HE75E - Groceries = &HEC09 - GuestUser = &HEE57 - HalfAlpha = &HE97E - HalfDullSound = &HE9B0 - HalfKatakana = &HE988 - HalfStarLeft = &HE7C6 - HalfStarRight = &HE7C7 - Handwriting = &HE929 - HangUp = &HE778 - HangUpLegacy = &HE137 - HardDrive = &HEDA2 - Headphone = &HE7F6 - Headphone0 = &HED30 - Headphone1 = &HED31 - Headphone2 = &HED32 - Headphone3 = &HED33 - Headset = &HE95B - Health = &HE95E - Heart = &HEB51 - HeartBroken = &HEA92 - HeartBrokenLegacy = &HE7 - HeartBrokenZeroWidthLegacy = &HEC - HeartFill = &HEB52 - HeartFillLegacy = &HEA5 - HeartFillZeroWidthLegacy = &HEB - HeartLegacy = &HE6 - Help = &HE897 - HelpLegacy = &HE11B - HelpLegacyMirrored = &HE1F3 - HelpMirrored = &HEA51 - HideBcc = &HE8C5 - HideBccLegacy = &HE16A - Highlight = &HE7E6 - HighlightFill = &HE891 - HighlightFill2 = &HE82A - HighlightLegacy = &HE193 - History = &HE81C - Home = &HE80F - HomeGroup = &HEC26 - HomeLegacy = &HE10F - HomeSolid = &HEA8A - HorizontalTabKey = &HE7FD - IBeam = &HE933 - IBeamOutline = &HE934 - ImageExport = &HEE71 - Import = &HE8B5 - ImportAll = &HE8B6 - ImportAllLegacy = &HE151 - ImportAllLegacyMirrored = &HE1AE - ImportAllMirrored = &HEA53 - Important = &HE8C9 - ImportantBadge12 = &HEDB1 - ImportantLegacy = &HE171 - ImportLegacy = &HE150 - ImportLegacyMirrored = &HE1AD - ImportMirrored = &HEA52 - IncidentTriangle = &HE814 - IncreaseIndentLegacy = &HE291 - IncreaseIndentLegacyMirrored = &HE298 - Info = &HE946 - Info2 = &HEA1F - InkingCaret = &HED65 - InkingColorFill = &HED67 - InkingColorOutline = &HED66 - InkingTool = &HE76D - InkingToolFill = &HE88F - InkingToolFill2 = &HE829 - InPrivate = &HE727 - Input = &HE961 - InsiderHubApp = &HEC24 - InternetSharing = &HE704 - Italic = &HE8DB - ItalicCLegacy = &HE1B0 - ItalicILegacy = &HE1B6 - ItalicKLegacy = &HE1B4 - ItalicKoreanLegacy = &HE1BC - ItalicLegacy = &HE199 - ItalicRussianLegacy = &HE1EA - Japanese = &HE985 - JpnRomanji = &HE87C - JpnRomanjiLock = &HE87D - JpnRomanjiShift = &HE87E - JpnRomanjiShiftLock = &HE87F - Key12On = &HE980 - KeyboardBrightness = &HED39 - KeyboardClassic = &HE765 - KeyboardDismiss = &HE92F - KeyboardFull = &HEC31 - KeyboardLeftHanded = &HE763 - KeyBoardLegacy = &HE144 - KeyboardLowerBrightness = &HED3A - KeyboardOneHanded = &HED4C - KeyboardRightHanded = &HE764 - KeyboardShortcut = &HEDA7 - KeyboardSplit = &HE766 - KeyboardSplitLegacy = &HE8F - KeyboardStandard = &HE92E - KeyboardStandardLegacy = &HE87 - Korean = &HE97D - Label = &HE932 - LangJPN = &HE7DE - LanguageChs = &HE88D - LanguageCht = &HE88C - LanguageJpn = &HEC45 - LanguageKor = &HE88B - LaptopSelected = &HEC76 - LayoutLegacy = &HE2AE - Leaf = &HE8BE - LeaveChat = &HE89B - LeaveChatLegacy = &HE11F - LeaveChatMirrored = &HEA54 - LEDLight = &HE781 - LeftArrowKeyTime0 = &HEC52 - LeftDoubleQuote = &HE9B2 - LeftQuote = &HE848 - LengthLegacy = &HE2AD - Library = &HE8F1 - LibraryLegacy = &HE1D3 - Light = &HE793 - Lightbulb = &HEA80 - LightningBolt = &HE945 - LikeDislike = &HE8DF - LikeDislikeLegacy = &HE19D - LikeInlineLegacy = &HE209 - LikeLegacy = &HE19F - Link = &HE71B - LinkLegacy = &HE167 - List = &HEA37 - ListLegacy = &HE14C - ListLegacyMirrored = &HE175 - ListMirrored = &HEA55 - Location = &HE81D - LocationLegacy = &HE1D2 - Lock = &HE72E - LockLegacy = &HE1F6 - LockscreenDesktop = &HEE3F - LockScreenGlance = &HEE65 - LowerBrightness = &HEC8A - MagStripeReader = &HEC5C - Mail = &HE715 - MailBadge12 = &HEDB3 - MailFill = &HE8A8 - MailFillLegacy = &HE135 - MailForward = &HE89C - MailForwardLegacy = &HE120 - MailForwardLegacyMirrored = &HE1A8 - MailForwardMirrored = &HEA56 - MailLegacy = &HE119 - MailMessageLegacy = &HE20B - MailReply = &HE8CA - MailReplyAll = &HE8C2 - MailReplyAllLegacy = &HE165 - MailReplyAllLegacyMirrored = &HE1F2 - MailReplyAllMirrored = &HEA58 - MailReplyLegacy = &HE172 - MailReplyLegacyMirrored = &HE1AF - MailReplyMirrored = &HEA57 - Manage = &HE912 - ManageLegacy = &HE178 - MapCompassBottom = &HE813 - MapCompassTop = &HE812 - MapDirections = &HE816 - MapDrive = &HE8CE - MapDriveLegacy = &HE17B - MapLayers = &HE81E - MapLegacy = &HE1C4 - MapPin = &HE707 - MapPin2 = &HE7B7 - MapPinLegacy = &HE139 - Marker = &HED64 - Marquee = &HEF20 - Media = &HEA69 - MediaStorageTower = &HE965 - Megaphone = &HE789 - Memo = &HE77C - MemoLegacy = &HE1D5 - Message = &HE8BD - MessageLegacy = &HE15F - MicClipping = &HEC72 - MicError = &HEC56 - MicOff = &HEC54 - MicOn = &HEC71 - Microphone = &HE720 - MicrophoneLegacy = &HE1D6 - MicSleep = &HEC55 - MiracastLogoLarge = &HEC16 - MiracastLogoSmall = &HEC15 - MobActionCenter = &HEC42 - MobAirplane = &HEC40 - MobBattery0 = &HEBA0 - MobBattery1 = &HEBA1 - MobBattery10 = &HEBAA - MobBattery2 = &HEBA2 - MobBattery3 = &HEBA3 - MobBattery4 = &HEBA4 - MobBattery5 = &HEBA5 - MobBattery6 = &HEBA6 - MobBattery7 = &HEBA7 - MobBattery8 = &HEBA8 - MobBattery9 = &HEBA9 - MobBatteryCharging0 = &HEBAB - MobBatteryCharging1 = &HEBAC - MobBatteryCharging10 = &HEBB5 - MobBatteryCharging2 = &HEBAD - MobBatteryCharging3 = &HEBAE - MobBatteryCharging4 = &HEBAF - MobBatteryCharging5 = &HEBB0 - MobBatteryCharging6 = &HEBB1 - MobBatteryCharging7 = &HEBB2 - MobBatteryCharging8 = &HEBB3 - MobBatteryCharging9 = &HEBB4 - MobBatterySaver0 = &HEBB6 - MobBatterySaver1 = &HEBB7 - MobBatterySaver10 = &HEBC0 - MobBatterySaver2 = &HEBB8 - MobBatterySaver3 = &HEBB9 - MobBatterySaver4 = &HEBBA - MobBatterySaver5 = &HEBBB - MobBatterySaver6 = &HEBBC - MobBatterySaver7 = &HEBBD - MobBatterySaver8 = &HEBBE - MobBatterySaver9 = &HEBBF - MobBatteryUnknown = &HEC02 - MobBluetooth = &HEC41 - MobCallForwarding = &HEC7E - MobCallForwardingMirrored = &HEC7F - MobDrivingMode = &HEC47 - MobileContactLegacy = &HE25A - MobileLocked = &HEC20 - MobileSelected = &HEC75 - MobileTablet = &HE8CC - MobLocation = &HEC43 - MobQuietHours = &HEC46 - MobSignal1 = &HEC37 - MobSignal2 = &HEC38 - MobSignal3 = &HEC39 - MobSignal4 = &HEC3A - MobSignal5 = &HEC3B - MobWifi1 = &HEC3C - MobWifi2 = &HEC3D - MobWifi3 = &HEC3E - MobWifi4 = &HEC3F - MobWifiHotspot = &HEC44 - More = &HE712 - MoreLegacy = &HE10C - Mouse = &HE962 - MoveToFolder = &HE8DE - MoveToFolderLegacy = &HE19C - Movies = &HE8B2 - MultimediaDMP = &HED47 - MultimediaDMS = &HE953 - MultimediaDVR = &HE954 - MultimediaPMP = &HE955 - MultiSelect = &HE762 - MultiSelectLegacy = &HE133 - MultiSelectLegacyMirrored = &HE1EF - MultiSelectMirrored = &HEA98 - Multitask = &HE7C4 - Multitask16 = &HEE40 - MultitaskExpanded = &HEB91 - MusicAlbum = &HE93C - MusicInfo = &HE90B - MusicInfoLegacy = &HE142 - MusicNote = &HEC4F - Mute = &HE74F - MuteLegacy = &HE198 - MyNetwork = &HEC27 - Narrator = &HED4D - NarratorForward = &HEDA9 - NarratorForwardMirrored = &HEDAA - Network = &HE968 - NetworkAdapter = &HEDA3 - NetworkPrinter = &HEDA5 - NetworkTower = &HEC05 - NewFolder = &HE8F4 - NewFolderLegacy = &HE1DA - NewWindow = &HE78B - NewWindowLegacy = &HE17C - NextLegacy = &HE101 - NUIFace = &HEB68 - NUIFPContinueSlideAction = &HEB85 - NUIFPContinueSlideHand = &HEB84 - NUIFPPressAction = &HEB8B - NUIFPPressHand = &HEB8A - NUIFPPressRepeatAction = &HEB8D - NUIFPPressRepeatHand = &HEB8C - NUIFPRollLeftAction = &HEB89 - NUIFPRollLeftHand = &HEB88 - NUIFPRollRightHand = &HEB86 - NUIFPRollRightHandAction = &HEB87 - NUIFPStartSlideAction = &HEB83 - NUIFPStartSlideHand = &HEB82 - NUIIris = &HEB67 - OEM = &HE74C - OneBar = &HE905 - OneBarLegacy = &HE1E6 - OpenFile = &HE8E5 - OpenFileLegacy = &HE1A5 - OpenInNewWindow = &HE8A7 - OpenInNewWindowLegacy = &HE2B4 - OpenLocal = &HE8DA - OpenLocalLegacy = &HE197 - OpenPane = &HE8A0 - OpenPaneLegacy = &HE127 - OpenPaneLegacyMirrored = &HE1C0 - OpenPaneMirrored = &HEA5B - OpenWith = &HE7AC - OpenWithLegacy = &HE17D - OpenWithLegacyMirrored = &HE1ED - OpenWithMirrored = &HEA5C - Orientation = &HE8B4 - OrientationLegacy = &HE14F - OtherUser = &HE7EE - OtherUserLegacy = &HE1A6 - OutlineStarLegacy = &HE1CE - Package = &HE7B8 - Page = &HE7C3 - PageFillLegacy = &HE132 - PageLeft = &HE760 - PageLegacy = &HE160 - PageRight = &HE761 - PageSolid = &HE729 - PanMode = &HECE9 - ParkingLocation = &HE811 - ParkingLocationMirrored = &HEA5E - ParkingLocationSolid = &HEA8B - PartyLeader = &HECA7 - PasswordKeyHide = &HE9A9 - PasswordKeyShow = &HE9A8 - Paste = &HE77F - PasteLegacy = &HE16D - Pause = &HE769 - PauseBadge12 = &HEDB4 - PauseLegacy = &HE103 - PC1 = &HE977 - PC1Legacy = &HE211 - Pencil = &HED63 - PenPalette = &HEE56 - PenPaletteMirrored = &HEF16 - PenWorkspace = &HEDC6 - PenWorkspaceMirrored = &HEF15 - People = &HE716 - PeopleLegacy = &HE125 - PeriodKey = &HE843 - Permissions = &HE8D7 - PermissionsLegacy = &HE192 - PersonalFolder = &HEC25 - Personalize = &HE771 - Phone = &HE717 - PhoneBook = &HE780 - PhoneBookLegacy = &HE1D4 - PhoneLegacy = &HE13A - Photo = &HE91B - Photo2 = &HEB9F - Picture = &HE8B9 - PictureLegacy = &HE158 - PieSingle = &HEB05 - Pin = &HE718 - PinFill = &HE841 - PinLegacy = &HE141 - Pinned = &HE840 - PinnedFill = &HE842 - PlaceFolderLegacy = &HE18A - PLAP = &HEC19 - Play = &HE768 - Play36 = &HEE4A - PlaybackRate1x = &HEC57 - PlaybackRateOther = &HEC58 - PlayBadge12 = &HEDB5 - PlayLegacy = &HE102 - PlayOnLegacy = &HE29B - PointErase = &HED61 - PointEraseMirrored = &HEF18 - PoliceCar = &HEC81 - PostUpdate = &HE8F3 - PostUpdateLegacy = &HE1D7 - PowerButton = &HE7E8 - PresenceChicklet = &HE978 - PresenceChickletLegacy = &HE25E - PresenceChickletVideo = &HE979 - PresenceChickletVideoLegacy = &HE25D - Preview = &HE8FF - PreviewLegacy = &HE295 - PreviewLink = &HE8A1 - PreviewLinkLegacy = &HE12A - Previous = &HE892 - PreviousLegacy = &HE100 - Print = &HE749 - Printer3D = &HE914 - Printer3DLegacy = &HE2F7 - PrintfaxPrinterFile = &HE956 - PrintLegacy = &HE2F6 - Priority = &HE8D0 - PriorityLegacy = &HE182 - Process = &HE9F3 - Project = &HEBC6 - Projector = &HE95D - ProtectedDocument = &HE8A6 - ProtectedDocumentLegacy = &HE131 - ProvisioningPackage = &HE835 - PuncKey = &HE844 - PuncKey0 = &HE84C - PuncKey1 = &HE9B4 - PuncKey2 = &HE9B5 - PuncKey3 = &HE9B6 - PuncKey4 = &HE9B7 - PuncKey5 = &HE9B8 - PuncKey6 = &HE9B9 - PuncKey7 = &HE9BB - PuncKey8 = &HE9BC - PuncKey9 = &HE9BA - PuncKeyLeftBottom = &HE84D - PuncKeyRightBottom = &HE9B3 - Puzzle = &HEA86 - QuickNote = &HE70B - QuietHours = &HE708 - QWERTYOff = &HE983 - QWERTYOn = &HE982 - RadioBtnOff = &HECCA - RadioBtnOn = &HECCB - RadioBullet = &HE915 - RadioBullet2 = &HECCC - RatingStarFillLegacy = &HEB4 - RatingStarFillReducedPaddingHTMLLegacy = &HE82 - RatingStarFillSmallLegacy = &HEB5 - RatingStarFillZeroWidthLegacy = &HEA - RatingStarLegacy = &HE224 - Read = &HE8C3 - ReadingList = &HE7BC - ReadLegacy = &HE166 - ReceiptPrinter = &HEC5B - Recent = &HE823 - Record = &HE7C8 - RecordLegacy = &HE1F5 - Redo = &HE7A6 - RedoLegacy = &HE10D - ReduceTileLegacy = &HE140 - ReduceTileLegacyMirrored = &HE177 - Refresh = &HE72C - RefreshLegacy = &HE149 - RememberedDevice = &HE70C - Reminder = &HEB50 - ReminderFill = &HEB4F - Remote = &HE8AF - RemoteLegacy = &HE148 - Remove = &HE738 - RemoveFrom = &HECC9 - RemoveLegacy = &HE108 - Rename = &HE8AC - RenameLegacy = &HE13E - Repair = &HE90F - RepairLegacy = &HE15E - RepeatAll = &HE8EE - RepeatAllLegacy = &HE1CD - RepeatOne = &HE8ED - RepeatOneLegacy = &HE1CC - Reply = &HE97A - ReplyLegacy = &HE248 - ReplyMirrored = &HEE35 - ReportHacked = &HE730 - ReportHackedLegacy = &HE1DE - ResetDevice = &HED10 - ResetDrive = &HEBC4 - Reshare = &HE8EB - ReshareLegacy = &HE1CA - ResizeMouseLarge = &HE747 - ResizeMouseMedium = &HE744 - ResizeMouseMediumMirrored = &HEA5F - ResizeMouseSmall = &HE743 - ResizeMouseSmallMirrored = &HEA60 - ResizeMouseTall = &HE746 - ResizeMouseTallMirrored = &HEA61 - ResizeMouseWide = &HE745 - ResizeTouchLarger = &HE741 - ResizeTouchNarrower = &HE7EA - ResizeTouchNarrowerMirrored = &HEA62 - ResizeTouchShorter = &HE7EB - ResizeTouchSmaller = &HE742 - ResolutionLegacy = &HE2AC - ReturnKey = &HE751 - ReturnKeyLg = &HEB97 - ReturnKeySm = &HE966 - ReturnToWindow = &HE944 - ReturnToWindowLegacy = &HE2B3 - RevealPasswordLegacy = &HE52 - RevToggleKey = &HE845 - Rewind = &HEB9E - RightArrowKeyTime0 = &HEBE7 - RightArrowKeyTime1 = &HE846 - RightArrowKeyTime2 = &HE847 - RightArrowKeyTime3 = &HE84E - RightArrowKeyTime4 = &HE84F - RightDoubleQuote = &HE9B1 - RightQuote = &HE849 - Ringer = &HEA8F - RingerBadge12 = &HEDAC - RingerSilent = &HE7ED - RoamingDomestic = &HE879 - RoamingInternational = &HE878 - Robot = &HE99A - Rotate = &HE7AD - RotateCamera = &HE89E - RotateCameraLegacy = &HE124 - RotateLegacy = &HE14A - RotateMapLeft = &HE80D - RotateMapRight = &HE80C - RotationLock = &HE755 - Ruler = &HED5E - Save = &HE74E - SaveAs = &HE792 - SaveAsLegacy = &HE28F - SaveCopy = &HEA35 - SaveLegacy = &HE105 - SaveLocal = &HE78C - SaveLocalLegacy = &HE159 - Scan = &HE8FE - ScanLegacy = &HE294 - ScrollChevronDownBoldLegacy = &HE19 - ScrollChevronDownLegacy = &HE11 - ScrollChevronLeftBoldLegacy = &HE16 - ScrollChevronLeftLegacy = &HEE - ScrollChevronRightBoldLegacy = &HE17 - ScrollChevronRightLegacy = &HEF - ScrollChevronUpBoldLegacy = &HE18 - ScrollChevronUpLegacy = &HE10 - ScrollMode = &HECE7 - ScrollUpDown = &HEC8F - SDCard = &HE7F1 - Search = &HE721 - SearchAndApps = &HE773 - SearchboxLegacy = &HE94 - SelectAll = &HE8B3 - SelectAllLegacy = &HE14E - SemanticZoomLegacy = &HEB8 - Send = &HE724 - SendFill = &HE725 - SendFillMirrored = &HEA64 - SendLegacy = &HE122 - SendMirrored = &HEA63 - Sensor = &HE957 - SetlockScreen = &HE7B5 - SetlockScreenLegacy = &HE18C - SetTile = &HE97B - SetTileLegacy = &HE18D - Settings = &HE713 - SettingsBattery = &HEE63 - SettingsDisplaySound = &HE7F3 - SettingsLegacy = &HE115 - Share = &HE72D - ShareBroadband = &HE83A - Shield = &HEA18 - Shop = &HE719 - ShopLegacy = &HE14D - ShoppingCart = &HE7BF - ShowAllFiles1Legacy = &HE153 - ShowAllFiles3Legacy = &HE152 - ShowAllFilesLegacy = &HE154 - ShowBcc = &HE8C4 - ShowBccLegacy = &HE169 - ShowResults = &HE8BC - ShowResultsLegacy = &HE15C - ShowResultsLegacyMirrored = &HE1F1 - ShowResultsMirrored = &HEA65 - Shuffle = &HE8B1 - ShuffleLegacy = &HE14B - SignalBars1 = &HE86C - SignalBars2 = &HE86D - SignalBars3 = &HE86E - SignalBars4 = &HE86F - SignalBars5 = &HE870 - SignalError = &HED2E - SignalNotConnected = &HE871 - SignalRoaming = &HEC1E - SIMLock = &HE875 - SIMMissing = &HE876 - SIPMove = &HE759 - SIPRedock = &HE75B - SIPUndock = &HE75A - SizeLegacy = &HE2B2 - SkipBack10 = &HED3C - SkipForward30 = &HED3D - SliderThumb = &HEC13 - Slideshow = &HE786 - SlideshowLegacy = &HE173 - SlowMotionOn = &HEA79 - Smartcard = &HE963 - SmartcardVirtual = &HE964 - SolidStarLegacy = &HE1CF - Sort = &HE8CB - SortLegacy = &HE174 - Speakers = &HE7F5 - SpeedHigh = &HEC4A - SpeedMedium = &HEC49 - SpeedOff = &HEC48 - StartPoint = &HE819 - StartPointSolid = &HEB49 - StatusCircle = &HEA81 - StatusCircleLeft = &HEBFD - StatusConnecting1 = &HEB57 - StatusConnecting2 = &HEB58 - StatusDataTransfer = &HE880 - StatusDataTransferVPN = &HE881 - StatusDualSIM1 = &HE884 - StatusDualSIM1VPN = &HE885 - StatusDualSIM2 = &HE882 - StatusDualSIM2VPN = &HE883 - StatusError = &HEA83 - StatusErrorFull = &HEB90 - StatusErrorLeft = &HEBFF - StatusSGLTE = &HE886 - StatusSGLTECell = &HE887 - StatusSGLTEDataVPN = &HE888 - StatusTriangle = &HEA82 - StatusTriangleLeft = &HEBFE - StatusUnsecure = &HEB59 - StatusVPN = &HE889 - StatusWarning = &HEA84 - StatusWarningLeft = &HEC00 - StockDown = &HEB0F - StockUp = &HEB11 - StopLegacy = &HE15B - StopPoint = &HE81A - StopPointSolid = &HEB4A - StopSlideshowLegacy = &HE191 - Stopwatch = &HE916 - StorageNetworkWireless = &HE969 - StorageOptical = &HE958 - StorageTape = &HE96A - Streaming = &HE93E - StreamingEnterprise = &HED2F - Street = &HE913 - StreetLegacy = &HE1C3 - StreetsideSplitExpand = &HE803 - StreetsideSplitMinimize = &HE802 - StrokeErase = &HED60 - StrokeEraseMirrored = &HEF17 - Subtitles = &HED1E - SubtitlesAudio = &HED1F - SurfaceHub = &HE8AE - Sustainable = &HEC0A - Swipe = &HE927 - SwipeRevealArt = &HEC6D - Switch = &HE8AB - SwitchApps = &HE8F9 - SwitchAppsLegacy = &HE1E1 - SwitchLegacy = &HE13C - SwitchUser = &HE748 - Sync = &HE895 - SyncBadge12 = &HEDAB - SyncError = &HEA6A - SyncFolder = &HE8F7 - SyncFolderLegacy = &HE1DF - SyncLegacy = &HE117 - System = &HE770 - Tablet = &HE70A - TabletMode = &HEBFC - TabletSelected = &HEC74 - Tag = &HE8EC - TagLegacy = &HE1CB - TapAndSend = &HE9A1 - TaskbarPhone = &HEE64 - ThisPC = &HEC4E - ThoughtBubble = &HEA91 - ThreeBars = &HE907 - ThreeBarsLegacy = &HE1E8 - Tiles = &HECA5 - TiltDown = &HE80A - TiltUp = &HE809 - TimeLanguage = &HE775 - ToggleBorder = &HEC12 - ToggleFilled = &HEC11 - ToggleThumb = &HEC14 - ToolTip = &HE82F - Touch = &HE815 - TouchPointer = &HE7C9 - TouchPointerLegacy = &HE1E3 - Touchscreen = &HEDA4 - Trackers = &HEADF - TrackersMirrored = &HEE92 - Train = &HE7C0 - TrainSolid = &HEB4D - TreeFolderFolder = &HED41 - TreeFolderFolderFill = &HED42 - TreeFolderFolderOpen = &HED43 - TreeFolderFolderOpenFill = &HED44 - Trim = &HE78A - TrimLegacy = &HE12C - TVMonitor = &HE7F4 - TVMonitorSelected = &HEC77 - TwoBars = &HE906 - TwoBarsLegacy = &HE1E7 - TwoPage = &HE89A - TwoPageLegacy = &HE11E - Type = &HE97C - TypeLegacy = &HE2B0 - TypingIndicatorLegacy = &HE25C - Underline = &HE8DC - UnderlineLegacy = &HE19A - UnderlineLKoreanLegacy = &HE1BB - UnderlineRussianLegacy = &HE1B8 - UnderlineSLegacy = &HE1B2 - UnderlineULegacy = &HE1B5 - UnderscoreSpace = &HE75D - Undo = &HE7A7 - UndoLegacy = &HE10E - Unfavorite = &HE8D9 - Unfavorite2Legacy = &HE24A - UnfavoriteLegacy = &HE195 - Unit = &HECC6 - Unlock = &HE785 - UnlockLegacy = &HE1F7 - Unpin = &HE77A - UnpinLegacy = &HE196 - UnsyncFolder = &HE8F6 - UnsyncFolderLegacy = &HE1DD - Up = &HE74A - UpArrowShiftKey = &HE752 - UpdateRestore = &HE777 - UpLegacy = &HE110 - Upload = &HE898 - UploadLegacy = &HE11C - UploadSkyDriveLegacy = &HE183 - UpShiftKey = &HE84B - USB = &HE88E - USBSafeConnect = &HECF3 - Vibrate = &HE877 - Video = &HE714 - VideoChat = &HE8AA - VideoChatLegacy = &HE13B - VideoInlineLegacy = &HE20A - VideoLegacy = &HE116 - View = &HE890 - ViewAll = &HE8A9 - ViewAllLegacy = &HE138 - ViewLegacy = &HE18B - Volume = &HE767 - Volume0 = &HE992 - Volume1 = &HE993 - Volume2 = &HE994 - Volume3 = &HE995 - VolumeBars = &HEBC5 - VolumeLegacy = &HE15D - VPN = &HE705 - Walk = &HE805 - WalkSolid = &HE726 - Warning = &HE7BA - Webcam = &HE8B8 - Webcam2 = &HE960 - WebcamLegacy = &HE156 - Wheel = &HEE94 - Wifi = &HE701 - Wifi1 = &HE872 - Wifi2 = &HE873 - Wifi3 = &HE874 - WifiAttentionOverlay = &HE998 - WifiCall0 = &HEBD5 - WifiCall1 = &HEBD6 - WifiCall2 = &HEBD7 - WifiCall3 = &HEBD8 - WifiCall4 = &HEBD9 - WifiCallBars = &HEBD4 - WifiError0 = &HEB5A - WifiError1 = &HEB5B - WifiError2 = &HEB5C - WifiError3 = &HEB5D - WifiError4 = &HEB5E - WifiEthernet = &HEE77 - WifiHotspot = &HE88A - WifiWarning0 = &HEB5F - WifiWarning1 = &HEB60 - WifiWarning2 = &HEB61 - WifiWarning3 = &HEB62 - WifiWarning4 = &HEB63 - WindDirection = &HEBE6 - WiredUSB = &HECF0 - WirelessUSB = &HECF1 - Work = &HE821 - WorkSolid = &HEB4E - World = &HE909 - WorldLegacy = &HE128 - XboxOneConsole = &HE990 - ZeroBars = &HE904 - ZeroBarsLegacy = &HE1E5 - Zoom = &HE71E - ZoomIn = &HE8A3 - ZoomInLegacy = &HE12E - ZoomLegacy = &HE1A3 - ZoomMode = &HECE8 - ZoomOut = &HE71F - ZoomOutLegacy = &HE1A4 - fa_500px = &HF26E - fa_address_book = &HF2B9 - fa_address_book_o = &HF2BA - fa_address_card = &HF2BB - fa_address_card_o = &HF2BC - fa_adjust = &HF042 - fa_adn = &HF170 - fa_align_center = &HF037 - fa_align_justify = &HF039 - fa_align_left = &HF036 - fa_align_right = &HF038 - fa_amazon = &HF270 - fa_ambulance = &HF0F9 - fa_american_sign_language_interpreting = &HF2A3 - fa_anchor = &HF13D - fa_android = &HF17B - fa_angellist = &HF209 - fa_angle_double_down = &HF103 - fa_angle_double_left = &HF100 - fa_angle_double_right = &HF101 - fa_angle_double_up = &HF102 - fa_angle_down = &HF107 - fa_angle_left = &HF104 - fa_angle_right = &HF105 - fa_angle_up = &HF106 - fa_apple = &HF179 - fa_archive = &HF187 - fa_area_chart = &HF1FE - fa_arrow_circle_down = &HF0AB - fa_arrow_circle_left = &HF0A8 - fa_arrow_circle_o_down = &HF01A - fa_arrow_circle_o_left = &HF190 - fa_arrow_circle_o_right = &HF18E - fa_arrow_circle_o_up = &HF01B - fa_arrow_circle_right = &HF0A9 - fa_arrow_circle_up = &HF0AA - fa_arrow_down = &HF063 - fa_arrow_left = &HF060 - fa_arrow_right = &HF061 - fa_arrow_up = &HF062 - fa_arrows = &HF047 - fa_arrows_alt = &HF0B2 - fa_arrows_h = &HF07E - fa_arrows_v = &HF07D - fa_asl_interpreting = &HF2A3 - fa_assistive_listening_systems = &HF2A2 - fa_asterisk = &HF069 - fa_at = &HF1FA - fa_audio_description = &HF29E - fa_automobile = &HF1B9 - fa_backward = &HF04A - fa_balance_scale = &HF24E - fa_ban = &HF05E - fa_bandcamp = &HF2D5 - fa_bank = &HF19C - fa_bar_chart = &HF080 - fa_bar_chart_o = &HF080 - fa_barcode = &HF02A - fa_bars = &HF0C9 - fa_bath = &HF2CD - fa_bathtub = &HF2CD - fa_battery = &HF240 - fa_battery_0 = &HF244 - fa_battery_1 = &HF243 - fa_battery_2 = &HF242 - fa_battery_3 = &HF241 - fa_battery_4 = &HF240 - fa_battery_empty = &HF244 - fa_battery_full = &HF240 - fa_battery_half = &HF242 - fa_battery_quarter = &HF243 - fa_battery_three_quarters = &HF241 - fa_bed = &HF236 - fa_beer = &HF0FC - fa_behance = &HF1B4 - fa_behance_square = &HF1B5 - fa_bell = &HF0F3 - fa_bell_o = &HF0A2 - fa_bell_slash = &HF1F6 - fa_bell_slash_o = &HF1F7 - fa_bicycle = &HF206 - fa_binoculars = &HF1E5 - fa_birthday_cake = &HF1FD - fa_bitbucket = &HF171 - fa_bitbucket_square = &HF172 - fa_bitcoin = &HF15A - fa_black_tie = &HF27E - fa_blind = &HF29D - fa_bluetooth = &HF293 - fa_bluetooth_b = &HF294 - fa_bold = &HF032 - fa_bolt = &HF0E7 - fa_bomb = &HF1E2 - fa_book = &HF02D - fa_bookmark = &HF02E - fa_bookmark_o = &HF097 - fa_braille = &HF2A1 - fa_briefcase = &HF0B1 - fa_btc = &HF15A - fa_bug = &HF188 - fa_building = &HF1AD - fa_building_o = &HF0F7 - fa_bullhorn = &HF0A1 - fa_bullseye = &HF140 - fa_bus = &HF207 - fa_buysellads = &HF20D - fa_cab = &HF1BA - fa_calculator = &HF1EC - fa_calendar = &HF073 - fa_calendar_check_o = &HF274 - fa_calendar_minus_o = &HF272 - fa_calendar_o = &HF133 - fa_calendar_plus_o = &HF271 - fa_calendar_times_o = &HF273 - fa_camera = &HF030 - fa_camera_retro = &HF083 - fa_car = &HF1B9 - fa_caret_down = &HF0D7 - fa_caret_left = &HF0D9 - fa_caret_right = &HF0DA - fa_caret_square_o_down = &HF150 - fa_caret_square_o_left = &HF191 - fa_caret_square_o_right = &HF152 - fa_caret_square_o_up = &HF151 - fa_caret_up = &HF0D8 - fa_cart_arrow_down = &HF218 - fa_cart_plus = &HF217 - fa_cc = &HF20A - fa_cc_amex = &HF1F3 - fa_cc_diners_club = &HF24C - fa_cc_discover = &HF1F2 - fa_cc_jcb = &HF24B - fa_cc_mastercard = &HF1F1 - fa_cc_paypal = &HF1F4 - fa_cc_stripe = &HF1F5 - fa_cc_visa = &HF1F0 - fa_certificate = &HF0A3 - fa_chain = &HF0C1 - fa_chain_broken = &HF127 - fa_check = &HF00C - fa_check_circle = &HF058 - fa_check_circle_o = &HF05D - fa_check_square = &HF14A - fa_check_square_o = &HF046 - fa_chevron_circle_down = &HF13A - fa_chevron_circle_left = &HF137 - fa_chevron_circle_right = &HF138 - fa_chevron_circle_up = &HF139 - fa_chevron_down = &HF078 - fa_chevron_left = &HF053 - fa_chevron_right = &HF054 - fa_chevron_up = &HF077 - fa_child = &HF1AE - fa_chrome = &HF268 - fa_circle = &HF111 - fa_circle_o = &HF10C - fa_circle_o_notch = &HF1CE - fa_circle_thin = &HF1DB - fa_clipboard = &HF0EA - fa_clock_o = &HF017 - fa_clone = &HF24D - fa_close = &HF00D - fa_cloud = &HF0C2 - fa_cloud_download = &HF0ED - fa_cloud_upload = &HF0EE - fa_cny = &HF157 - fa_code = &HF121 - fa_code_fork = &HF126 - fa_codepen = &HF1CB - fa_codiepie = &HF284 - fa_coffee = &HF0F4 - fa_cog = &HF013 - fa_cogs = &HF085 - fa_columns = &HF0DB - fa_comment = &HF075 - fa_comment_o = &HF0E5 - fa_commenting = &HF27A - fa_commenting_o = &HF27B - fa_comments = &HF086 - fa_comments_o = &HF0E6 - fa_compass = &HF14E - fa_compress = &HF066 - fa_connectdevelop = &HF20E - fa_contao = &HF26D - fa_copy = &HF0C5 - fa_copyright = &HF1F9 - fa_creative_commons = &HF25E - fa_credit_card = &HF09D - fa_credit_card_alt = &HF283 - fa_crop = &HF125 - fa_crosshairs = &HF05B - fa_css3 = &HF13C - fa_cube = &HF1B2 - fa_cubes = &HF1B3 - fa_cut = &HF0C4 - fa_cutlery = &HF0F5 - fa_dashboard = &HF0E4 - fa_dashcube = &HF210 - fa_database = &HF1C0 - fa_deaf = &HF2A4 - fa_deafness = &HF2A4 - fa_dedent = &HF03B - fa_delicious = &HF1A5 - fa_desktop = &HF108 - fa_deviantart = &HF1BD - fa_diamond = &HF219 - fa_digg = &HF1A6 - fa_dollar = &HF155 - fa_dot_circle_o = &HF192 - fa_download = &HF019 - fa_dribbble = &HF17D - fa_drivers_license = &HF2C2 - fa_drivers_license_o = &HF2C3 - fa_dropbox = &HF16B - fa_drupal = &HF1A9 - fa_edge = &HF282 - fa_edit = &HF044 - fa_eercast = &HF2DA - fa_eject = &HF052 - fa_ellipsis_h = &HF141 - fa_ellipsis_v = &HF142 - fa_empire = &HF1D1 - fa_envelope = &HF0E0 - fa_envelope_o = &HF003 - fa_envelope_open = &HF2B6 - fa_envelope_open_o = &HF2B7 - fa_envelope_square = &HF199 - fa_envira = &HF299 - fa_eraser = &HF12D - fa_etsy = &HF2D7 - fa_eur = &HF153 - fa_euro = &HF153 - fa_exchange = &HF0EC - fa_exclamation = &HF12A - fa_exclamation_circle = &HF06A - fa_exclamation_triangle = &HF071 - fa_expand = &HF065 - fa_expeditedssl = &HF23E - fa_external_link = &HF08E - fa_external_link_square = &HF14C - fa_eye = &HF06E - fa_eye_slash = &HF070 - fa_eyedropper = &HF1FB - fa_fa = &HF2B4 - fa_facebook = &HF09A - fa_facebook_f = &HF09A - fa_facebook_official = &HF230 - fa_facebook_square = &HF082 - fa_fast_backward = &HF049 - fa_fast_forward = &HF050 - fa_fax = &HF1AC - fa_feed = &HF09E - fa_female = &HF182 - fa_fighter_jet = &HF0FB - fa_file = &HF15B - fa_file_archive_o = &HF1C6 - fa_file_audio_o = &HF1C7 - fa_file_code_o = &HF1C9 - fa_file_excel_o = &HF1C3 - fa_file_image_o = &HF1C5 - fa_file_movie_o = &HF1C8 - fa_file_o = &HF016 - fa_file_pdf_o = &HF1C1 - fa_file_photo_o = &HF1C5 - fa_file_picture_o = &HF1C5 - fa_file_powerpoint_o = &HF1C4 - fa_file_sound_o = &HF1C7 - fa_file_text = &HF15C - fa_file_text_o = &HF0F6 - fa_file_video_o = &HF1C8 - fa_file_word_o = &HF1C2 - fa_file_zip_o = &HF1C6 - fa_files_o = &HF0C5 - fa_film = &HF008 - fa_filter = &HF0B0 - fa_fire = &HF06D - fa_fire_extinguisher = &HF134 - fa_firefox = &HF269 - fa_first_order = &HF2B0 - fa_flag = &HF024 - fa_flag_checkered = &HF11E - fa_flag_o = &HF11D - fa_flash = &HF0E7 - fa_flask = &HF0C3 - fa_flickr = &HF16E - fa_floppy_o = &HF0C7 - fa_folder = &HF07B - fa_folder_o = &HF114 - fa_folder_open = &HF07C - fa_folder_open_o = &HF115 - fa_font = &HF031 - fa_font_awesome = &HF2B4 - fa_fonticons = &HF280 - fa_fort_awesome = &HF286 - fa_forumbee = &HF211 - fa_forward = &HF04E - fa_foursquare = &HF180 - fa_free_code_camp = &HF2C5 - fa_frown_o = &HF119 - fa_futbol_o = &HF1E3 - fa_gamepad = &HF11B - fa_gavel = &HF0E3 - fa_gbp = &HF154 - fa_ge = &HF1D1 - fa_gear = &HF013 - fa_gears = &HF085 - fa_genderless = &HF22D - fa_get_pocket = &HF265 - fa_gg = &HF260 - fa_gg_circle = &HF261 - fa_gift = &HF06B - fa_git = &HF1D3 - fa_git_square = &HF1D2 - fa_github = &HF09B - fa_github_alt = &HF113 - fa_github_square = &HF092 - fa_gitlab = &HF296 - fa_gittip = &HF184 - fa_glass = &HF000 - fa_glide = &HF2A5 - fa_glide_g = &HF2A6 - fa_globe = &HF0AC - fa_google = &HF1A0 - fa_google_plus = &HF0D5 - fa_google_plus_circle = &HF2B3 - fa_google_plus_official = &HF2B3 - fa_google_plus_square = &HF0D4 - fa_google_wallet = &HF1EE - fa_graduation_cap = &HF19D - fa_gratipay = &HF184 - fa_grav = &HF2D6 - fa_group = &HF0C0 - fa_h_square = &HF0FD - fa_hacker_news = &HF1D4 - fa_hand_grab_o = &HF255 - fa_hand_lizard_o = &HF258 - fa_hand_o_down = &HF0A7 - fa_hand_o_left = &HF0A5 - fa_hand_o_right = &HF0A4 - fa_hand_o_up = &HF0A6 - fa_hand_paper_o = &HF256 - fa_hand_peace_o = &HF25B - fa_hand_pointer_o = &HF25A - fa_hand_rock_o = &HF255 - fa_hand_scissors_o = &HF257 - fa_hand_spock_o = &HF259 - fa_hand_stop_o = &HF256 - fa_handshake_o = &HF2B5 - fa_hard_of_hearing = &HF2A4 - fa_hashtag = &HF292 - fa_hdd_o = &HF0A0 - fa_header = &HF1DC - fa_headphones = &HF025 - fa_heart = &HF004 - fa_heart_o = &HF08A - fa_heartbeat = &HF21E - fa_history = &HF1DA - fa_home = &HF015 - fa_hospital_o = &HF0F8 - fa_hotel = &HF236 - fa_hourglass = &HF254 - fa_hourglass_1 = &HF251 - fa_hourglass_2 = &HF252 - fa_hourglass_3 = &HF253 - fa_hourglass_end = &HF253 - fa_hourglass_half = &HF252 - fa_hourglass_o = &HF250 - fa_hourglass_start = &HF251 - fa_houzz = &HF27C - fa_html5 = &HF13B - fa_i_cursor = &HF246 - fa_id_badge = &HF2C1 - fa_id_card = &HF2C2 - fa_id_card_o = &HF2C3 - fa_ils = &HF20B - fa_image = &HF03E - fa_imdb = &HF2D8 - fa_inbox = &HF01C - fa_indent = &HF03C - fa_industry = &HF275 - fa_info = &HF129 - fa_info_circle = &HF05A - fa_inr = &HF156 - fa_instagram = &HF16D - fa_institution = &HF19C - fa_internet_explorer = &HF26B - fa_intersex = &HF224 - fa_ioxhost = &HF208 - fa_italic = &HF033 - fa_joomla = &HF1AA - fa_jpy = &HF157 - fa_jsfiddle = &HF1CC - fa_key = &HF084 - fa_keyboard_o = &HF11C - fa_krw = &HF159 - fa_language = &HF1AB - fa_laptop = &HF109 - fa_lastfm = &HF202 - fa_lastfm_square = &HF203 - fa_leaf = &HF06C - fa_leanpub = &HF212 - fa_legal = &HF0E3 - fa_lemon_o = &HF094 - fa_level_down = &HF149 - fa_level_up = &HF148 - fa_life_bouy = &HF1CD - fa_life_buoy = &HF1CD - fa_life_ring = &HF1CD - fa_life_saver = &HF1CD - fa_lightbulb_o = &HF0EB - fa_line_chart = &HF201 - fa_link = &HF0C1 - fa_linkedin = &HF0E1 - fa_linkedin_square = &HF08C - fa_linode = &HF2B8 - fa_linux = &HF17C - fa_list = &HF03A - fa_list_alt = &HF022 - fa_list_ol = &HF0CB - fa_list_ul = &HF0CA - fa_location_arrow = &HF124 - fa_lock = &HF023 - fa_long_arrow_down = &HF175 - fa_long_arrow_left = &HF177 - fa_long_arrow_right = &HF178 - fa_long_arrow_up = &HF176 - fa_low_vision = &HF2A8 - fa_magic = &HF0D0 - fa_magnet = &HF076 - fa_mail_forward = &HF064 - fa_mail_reply = &HF112 - fa_mail_reply_all = &HF122 - fa_male = &HF183 - fa_map = &HF279 - fa_map_marker = &HF041 - fa_map_o = &HF278 - fa_map_pin = &HF276 - fa_map_signs = &HF277 - fa_mars = &HF222 - fa_mars_double = &HF227 - fa_mars_stroke = &HF229 - fa_mars_stroke_h = &HF22B - fa_mars_stroke_v = &HF22A - fa_maxcdn = &HF136 - fa_meanpath = &HF20C - fa_medium = &HF23A - fa_medkit = &HF0FA - fa_meetup = &HF2E0 - fa_meh_o = &HF11A - fa_mercury = &HF223 - fa_microchip = &HF2DB - fa_microphone = &HF130 - fa_microphone_slash = &HF131 - fa_minus = &HF068 - fa_minus_circle = &HF056 - fa_minus_square = &HF146 - fa_minus_square_o = &HF147 - fa_mixcloud = &HF289 - fa_mobile = &HF10B - fa_mobile_phone = &HF10B - fa_modx = &HF285 - fa_money = &HF0D6 - fa_moon_o = &HF186 - fa_mortar_board = &HF19D - fa_motorcycle = &HF21C - fa_mouse_pointer = &HF245 - fa_music = &HF001 - fa_navicon = &HF0C9 - fa_neuter = &HF22C - fa_newspaper_o = &HF1EA - fa_object_group = &HF247 - fa_object_ungroup = &HF248 - fa_odnoklassniki = &HF263 - fa_odnoklassniki_square = &HF264 - fa_opencart = &HF23D - fa_openid = &HF19B - fa_opera = &HF26A - fa_optin_monster = &HF23C - fa_outdent = &HF03B - fa_pagelines = &HF18C - fa_paint_brush = &HF1FC - fa_paper_plane = &HF1D8 - fa_paper_plane_o = &HF1D9 - fa_paperclip = &HF0C6 - fa_paragraph = &HF1DD - fa_paste = &HF0EA - fa_pause = &HF04C - fa_pause_circle = &HF28B - fa_pause_circle_o = &HF28C - fa_paw = &HF1B0 - fa_paypal = &HF1ED - fa_pencil = &HF040 - fa_pencil_square = &HF14B - fa_pencil_square_o = &HF044 - fa_percent = &HF295 - fa_phone = &HF095 - fa_phone_square = &HF098 - fa_photo = &HF03E - fa_picture_o = &HF03E - fa_pie_chart = &HF200 - fa_pied_piper = &HF2AE - fa_pied_piper_alt = &HF1A8 - fa_pied_piper_pp = &HF1A7 - fa_pinterest = &HF0D2 - fa_pinterest_p = &HF231 - fa_pinterest_square = &HF0D3 - fa_plane = &HF072 - fa_play = &HF04B - fa_play_circle = &HF144 - fa_play_circle_o = &HF01D - fa_plug = &HF1E6 - fa_plus = &HF067 - fa_plus_circle = &HF055 - fa_plus_square = &HF0FE - fa_plus_square_o = &HF196 - fa_podcast = &HF2CE - fa_power_off = &HF011 - fa_print = &HF02F - fa_product_hunt = &HF288 - fa_puzzle_piece = &HF12E - fa_qq = &HF1D6 - fa_qrcode = &HF029 - fa_question = &HF128 - fa_question_circle = &HF059 - fa_question_circle_o = &HF29C - fa_quora = &HF2C4 - fa_quote_left = &HF10D - fa_quote_right = &HF10E - fa_ra = &HF1D0 - fa_random = &HF074 - fa_ravelry = &HF2D9 - fa_rebel = &HF1D0 - fa_recycle = &HF1B8 - fa_reddit = &HF1A1 - fa_reddit_alien = &HF281 - fa_reddit_square = &HF1A2 - fa_refresh = &HF021 - fa_registered = &HF25D - fa_remove = &HF00D - fa_renren = &HF18B - fa_reorder = &HF0C9 - fa_repeat = &HF01E - fa_reply = &HF112 - fa_reply_all = &HF122 - fa_resistance = &HF1D0 - fa_retweet = &HF079 - fa_rmb = &HF157 - fa_road = &HF018 - fa_rocket = &HF135 - fa_rotate_left = &HF0E2 - fa_rotate_right = &HF01E - fa_rouble = &HF158 - fa_rss = &HF09E - fa_rss_square = &HF143 - fa_rub = &HF158 - fa_ruble = &HF158 - fa_rupee = &HF156 - fa_s15 = &HF2CD - fa_safari = &HF267 - fa_save = &HF0C7 - fa_scissors = &HF0C4 - fa_scribd = &HF28A - fa_search = &HF002 - fa_search_minus = &HF010 - fa_search_plus = &HF00E - fa_sellsy = &HF213 - fa_send = &HF1D8 - fa_send_o = &HF1D9 - fa_server = &HF233 - fa_share = &HF064 - fa_share_alt = &HF1E0 - fa_share_alt_square = &HF1E1 - fa_share_square = &HF14D - fa_share_square_o = &HF045 - fa_shekel = &HF20B - fa_sheqel = &HF20B - fa_shield = &HF132 - fa_ship = &HF21A - fa_shirtsinbulk = &HF214 - fa_shopping_bag = &HF290 - fa_shopping_basket = &HF291 - fa_shopping_cart = &HF07A - fa_shower = &HF2CC - fa_sign_in = &HF090 - fa_sign_language = &HF2A7 - fa_sign_out = &HF08B - fa_signal = &HF012 - fa_signing = &HF2A7 - fa_simplybuilt = &HF215 - fa_sitemap = &HF0E8 - fa_skyatlas = &HF216 - fa_skype = &HF17E - fa_slack = &HF198 - fa_sliders = &HF1DE - fa_slideshare = &HF1E7 - fa_smile_o = &HF118 - fa_snapchat = &HF2AB - fa_snapchat_ghost = &HF2AC - fa_snapchat_square = &HF2AD - fa_snowflake_o = &HF2DC - fa_soccer_ball_o = &HF1E3 - fa_sort = &HF0DC - fa_sort_alpha_asc = &HF15D - fa_sort_alpha_desc = &HF15E - fa_sort_amount_asc = &HF160 - fa_sort_amount_desc = &HF161 - fa_sort_asc = &HF0DE - fa_sort_desc = &HF0DD - fa_sort_down = &HF0DD - fa_sort_numeric_asc = &HF162 - fa_sort_numeric_desc = &HF163 - fa_sort_up = &HF0DE - fa_soundcloud = &HF1BE - fa_space_shuttle = &HF197 - fa_spinner = &HF110 - fa_spoon = &HF1B1 - fa_spotify = &HF1BC - fa_square = &HF0C8 - fa_square_o = &HF096 - fa_stack_exchange = &HF18D - fa_stack_overflow = &HF16C - fa_star = &HF005 - fa_star_half = &HF089 - fa_star_half_empty = &HF123 - fa_star_half_full = &HF123 - fa_star_half_o = &HF123 - fa_star_o = &HF006 - fa_steam = &HF1B6 - fa_steam_square = &HF1B7 - fa_step_backward = &HF048 - fa_step_forward = &HF051 - fa_stethoscope = &HF0F1 - fa_sticky_note = &HF249 - fa_sticky_note_o = &HF24A - fa_stop = &HF04D - fa_stop_circle = &HF28D - fa_stop_circle_o = &HF28E - fa_street_view = &HF21D - fa_strikethrough = &HF0CC - fa_stumbleupon = &HF1A4 - fa_stumbleupon_circle = &HF1A3 - fa_subscript = &HF12C - fa_subway = &HF239 - fa_suitcase = &HF0F2 - fa_sun_o = &HF185 - fa_superpowers = &HF2DD - fa_superscript = &HF12B - fa_support = &HF1CD - fa_table = &HF0CE - fa_tablet = &HF10A - fa_tachometer = &HF0E4 - fa_tag = &HF02B - fa_tags = &HF02C - fa_tasks = &HF0AE - fa_taxi = &HF1BA - fa_telegram = &HF2C6 - fa_television = &HF26C - fa_tencent_weibo = &HF1D5 - fa_terminal = &HF120 - fa_text_height = &HF034 - fa_text_width = &HF035 - fa_th = &HF00A - fa_th_large = &HF009 - fa_th_list = &HF00B - fa_themeisle = &HF2B2 - fa_thermometer = &HF2C7 - fa_thermometer_0 = &HF2CB - fa_thermometer_1 = &HF2CA - fa_thermometer_2 = &HF2C9 - fa_thermometer_3 = &HF2C8 - fa_thermometer_4 = &HF2C7 - fa_thermometer_empty = &HF2CB - fa_thermometer_full = &HF2C7 - fa_thermometer_half = &HF2C9 - fa_thermometer_quarter = &HF2CA - fa_thermometer_three_quarters = &HF2C8 - fa_thumb_tack = &HF08D - fa_thumbs_down = &HF165 - fa_thumbs_o_down = &HF088 - fa_thumbs_o_up = &HF087 - fa_thumbs_up = &HF164 - fa_ticket = &HF145 - fa_times = &HF00D - fa_times_circle = &HF057 - fa_times_circle_o = &HF05C - fa_times_rectangle = &HF2D3 - fa_times_rectangle_o = &HF2D4 - fa_tint = &HF043 - fa_toggle_down = &HF150 - fa_toggle_left = &HF191 - fa_toggle_off = &HF204 - fa_toggle_on = &HF205 - fa_toggle_right = &HF152 - fa_toggle_up = &HF151 - fa_trademark = &HF25C - fa_train = &HF238 - fa_transgender = &HF224 - fa_transgender_alt = &HF225 - fa_trash = &HF1F8 - fa_trash_o = &HF014 - fa_tree = &HF1BB - fa_trello = &HF181 - fa_tripadvisor = &HF262 - fa_trophy = &HF091 - fa_truck = &HF0D1 - fa_try = &HF195 - fa_tty = &HF1E4 - fa_tumblr = &HF173 - fa_tumblr_square = &HF174 - fa_turkish_lira = &HF195 - fa_tv = &HF26C - fa_twitch = &HF1E8 - fa_twitter = &HF099 - fa_twitter_square = &HF081 - fa_umbrella = &HF0E9 - fa_underline = &HF0CD - fa_undo = &HF0E2 - fa_universal_access = &HF29A - fa_university = &HF19C - fa_unlink = &HF127 - fa_unlock = &HF09C - fa_unlock_alt = &HF13E - fa_unsorted = &HF0DC - fa_upload = &HF093 - fa_usb = &HF287 - fa_usd = &HF155 - fa_user = &HF007 - fa_user_circle = &HF2BD - fa_user_circle_o = &HF2BE - fa_user_md = &HF0F0 - fa_user_o = &HF2C0 - fa_user_plus = &HF234 - fa_user_secret = &HF21B - fa_user_times = &HF235 - fa_users = &HF0C0 - fa_vcard = &HF2BB - fa_vcard_o = &HF2BC - fa_venus = &HF221 - fa_venus_double = &HF226 - fa_venus_mars = &HF228 - fa_viacoin = &HF237 - fa_viadeo = &HF2A9 - fa_viadeo_square = &HF2AA - fa_video_camera = &HF03D - fa_vimeo = &HF27D - fa_vimeo_square = &HF194 - fa_vine = &HF1CA - fa_vk = &HF189 - fa_volume_control_phone = &HF2A0 - fa_volume_down = &HF027 - fa_volume_off = &HF026 - fa_volume_up = &HF028 - fa_warning = &HF071 - fa_wechat = &HF1D7 - fa_weibo = &HF18A - fa_weixin = &HF1D7 - fa_whatsapp = &HF232 - fa_wheelchair = &HF193 - fa_wheelchair_alt = &HF29B - fa_wifi = &HF1EB - fa_wikipedia_w = &HF266 - fa_window_close = &HF2D3 - fa_window_close_o = &HF2D4 - fa_window_maximize = &HF2D0 - fa_window_minimize = &HF2D1 - fa_window_restore = &HF2D2 - fa_windows = &HF17A - fa_won = &HF159 - fa_wordpress = &HF19A - fa_wpbeginner = &HF297 - fa_wpexplorer = &HF2DE - fa_wpforms = &HF298 - fa_wrench = &HF0AD - fa_xing = &HF168 - fa_xing_square = &HF169 - fa_y_combinator = &HF23B - fa_y_combinator_square = &HF1D4 - fa_yahoo = &HF19E - fa_yc = &HF23B - fa_yc_square = &HF1D4 - fa_yelp = &HF1E9 - fa_yen = &HF157 - fa_yoast = &HF2B1 - fa_youtube = &HF167 - fa_youtube_play = &HF16A - fa_youtube_square = &HF166 -End Enum \ No newline at end of file diff --git a/src/WinForms/TaskDialog/TaskDialog.sln b/src/WinForms/TaskDialog/TaskDialog.sln deleted file mode 100644 index c623942..0000000 --- a/src/WinForms/TaskDialog/TaskDialog.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31229.75 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TaskDialog", "TaskDialog.vbproj", "{CFBE6E6C-B711-42BB-B5ED-487D4767FE2B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CFBE6E6C-B711-42BB-B5ED-487D4767FE2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CFBE6E6C-B711-42BB-B5ED-487D4767FE2B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CFBE6E6C-B711-42BB-B5ED-487D4767FE2B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CFBE6E6C-B711-42BB-B5ED-487D4767FE2B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A25E6589-5D38-46A2-B480-5B0FFCAC64D7} - EndGlobalSection -EndGlobal diff --git a/src/WinForms/TaskDialog/TaskDialog.vb b/src/WinForms/TaskDialog/TaskDialog.vb deleted file mode 100644 index ab1de70..0000000 --- a/src/WinForms/TaskDialog/TaskDialog.vb +++ /dev/null @@ -1,486 +0,0 @@ - -Imports System.Drawing -Imports System.Text -Imports System.Threading -Imports System.Windows.Forms - -Imports TaskDialog.Msg - -Public Class TaskDialog(Of T) - Inherits TaskDialogBaseForm - - Property CommandDefinitions As New List(Of CommandDefinition) - Property ButtonDefinitions As New List(Of ButtonDefinition) - Property SelectedValue As T - Property SelectedText As String - Property Title As String - Property Timeout As Integer - Property Content As String - Property ContentLabel As LabelEx - Property ExpandedContent As String - Property ExpandedContentLabel As LabelEx - - Overloads Property Icon As TaskIcon - Overloads Property Owner As IntPtr - - - Public Sub New() - MyBase.New() - End Sub - - Public Sub New(defaultValue As T) - MyClass.New() - SelectedValue = defaultValue - End Sub - - Public Sub New(defaultText As String, defaultValue As T) - MyClass.New(defaultValue) - SelectedText = defaultText - End Sub - - Sub Init() - ShowInTaskbar = False - Width = FontHeight * 22 - - If Content = "" AndAlso Title?.Length > 80 Then - Content = Title - Title = "" - End If - - If MenuButton.Items.Count > 0 Then - MenuButton.Visible = True - - For Each i In MenuButton.Items - Dim textWidth = TextRenderer.MeasureText(i.ToString, Font).Width + FontHeight * 3 - - If MenuButton.Width < textWidth Then - Width += textWidth - MenuButton.Width - End If - Next - End If - - If Content?.Length > 1000 OrElse ExpandedContent?.Length > 1000 Then - Width = FontHeight * 35 - End If - - ShowIcon = False - StartPosition = FormStartPosition.CenterScreen - - If Icon <> TaskIcon.None Then - pbIcon.Visible = True - End If - - Select Case Icon - Case TaskIcon.Warning - pbIcon.Image = StockIcon.GetImage(StockIconIdentifier.Warning) - Case TaskIcon.Error - pbIcon.Image = StockIcon.GetImage(StockIconIdentifier.Error) - Case TaskIcon.Info - pbIcon.Image = StockIcon.GetImage(StockIconIdentifier.Info) - Case TaskIcon.Shield - pbIcon.Image = StockIcon.GetImage(StockIconIdentifier.Shield) - Case TaskIcon.Question - pbIcon.Image = StockIcon.GetImage(StockIconIdentifier.Help) - End Select - - TitleLabel.Font = New Font("Segoe UI", 11) - TitleLabel.Text = Title - - If Content <> "" Then - ContentLabel = New LabelEx - ContentLabel.Margin = New Padding(0) - ContentLabel.BorderStyle = BorderStyle.None - ContentLabel.Text = Content - paMain.Controls.Add(ContentLabel) - End If - - If ExpandedContent <> "" Then - ExpandedContentLabel = New LabelEx - ExpandedContentLabel.Margin = New Padding(0) - ExpandedContentLabel.BorderStyle = BorderStyle.None - ExpandedContentLabel.Text = ExpandedContent - ExpandedContentLabel.Name = "ExpandedInformation" - blDetails.Visible = True - paMain.Controls.Add(ExpandedContentLabel) - End If - - Dim firstCommandButton As CommandButton = Nothing - - For Each cmd In CommandDefinitions - Dim cb As New CommandButton - cb.Title = cmd.Text - cb.Description = cmd.Description - cb.Tag = cmd - - If TypeOf cmd.Value Is FontFamily Then - cb.Font = New Font(cmd.Text, Font.Size) - End If - - AddHandler cb.Click, AddressOf CommandClick - paMain.Controls.Add(cb) - - If firstCommandButton Is Nothing Then - firstCommandButton = cb - End If - Next - - For Each i In ButtonDefinitions - If Not flpButtons.Visible Then - flpButtons.Visible = True - flpButtons.AutoSize = True - End If - - Dim b As New ButtonEx - b.Text = i.Text - b.Tag = i.Value - - If AcceptButton Is Nothing AndAlso i.Text = "OK" Then - AcceptButton = b - End If - - flpButtons.Controls.Add(b) - i.Button = b - AddHandler b.Click, AddressOf ButtonClick - Next - - If Timeout > 0 Then - Task.Run(Sub() - Thread.Sleep(Timeout * 1000) - - If Not IsDisposingOrDisposed Then - Invoke(Sub() Close()) - End If - End Sub) - End If - - If TypeOf SelectedValue Is DialogResult Then - If SelectedValue.Equals(DialogResult.None) Then - If ButtonDefinitions.Where(Function(i) i.Value.Equals(DialogResult.No)).Any Then - SelectedValue = CType(CObj(DialogResult.No), T) - End If - - If ButtonDefinitions.Where(Function(i) i.Value.Equals(DialogResult.Cancel)).Any Then - SelectedValue = CType(CObj(DialogResult.Cancel), T) - End If - End If - - Dim ok = ButtonDefinitions.Where(Function(i) i.Value.Equals(DialogResult.OK)).FirstOrDefault - - If Not ok Is Nothing Then - ActiveControl = ok.Button - End If - - If ActiveControl Is Nothing Then - Dim yes = ButtonDefinitions.Where(Function(i) i.Value.Equals(DialogResult.Yes)).FirstOrDefault - - If Not yes Is Nothing Then - ActiveControl = yes.Button - End If - End If - End If - - If ActiveControl Is Nothing Then - If firstCommandButton Is Nothing Then - ActiveControl = TitleLabel - Else - ActiveControl = firstCommandButton - End If - End If - - If Owner = IntPtr.Zero Then - Owner = GetHandle() - End If - End Sub - - Sub AddCommand(value As T) - AddCommand(value.ToString, Nothing, value) - End Sub - - Sub AddCommand(text As String, Optional value As T = Nothing) - AddCommand(text, Nothing, value) - End Sub - - Sub AddCommand(text As String, description As String, value As T) - If value Is Nothing Then - value = CType(CObj(text), T) - End If - - CommandDefinitions.Add(New CommandDefinition With {.Text = text, .Description = description, .Value = value}) - End Sub - - Sub AddCommands(values As IEnumerable(Of T)) - For Each i In values - AddCommand(i) - Next - End Sub - - Sub AddButton(text As String) - AddButton(text, CType(CObj(text), T)) - End Sub - - Sub AddButton(text As String, value As T) - ButtonDefinitions.Add(New ButtonDefinition With {.Text = text, .Value = value}) - End Sub - - Sub AddButton(value As T) - ButtonDefinitions.Add(New ButtonDefinition With {.Text = value.ToString, .Value = value}) - End Sub - - Sub AddButtons(values As IEnumerable(Of T)) - For Each i In values - AddButton(i) - Next - End Sub - - WriteOnly Property Buttons As TaskButton - Set(value As TaskButton) - For Each i In {TaskButton.OK, TaskButton.Yes, TaskButton.No, - TaskButton.Cancel, TaskButton.Retry, TaskButton.Close} - - If value.HasFlag(i) Then - AddButton(i.ToString, CType(CObj(GetDialogResultFromButton(i)), T)) - End If - Next - End Set - End Property - - Sub CommandClick(sender As Object, e As EventArgs) - Dim tag = DirectCast(sender, CommandButton).Tag - Dim cmd = DirectCast(tag, CommandDefinition) - SelectedText = If(cmd.Text = "", cmd.Description, cmd.Text) - SelectedValue = cmd.Value - Close() - End Sub - - Sub ButtonClick(sender As Object, e As EventArgs) - Dim button = DirectCast(sender, ButtonEx) - SelectedText = button.Text - SelectedValue = DirectCast(button.Tag, T) - Close() - End Sub - - Overrides Sub AdjustSize() - Dim h = tlpTop.Height + tlpTop.Margin.Vertical - - If paMain.Controls.Count > 0 Then - Dim last = paMain.Controls(paMain.Controls.Count - 1) - h += last.Top + last.Height + last.Margin.Vertical - End If - - h += spBottom.Height - - If spBottom.Controls.OfType(Of Control).Where(Function(i) i.Visible).Count > 0 Then - h += spBottom.Margin.Vertical - End If - - Dim fh = FontHeight - h += CInt(fh * 0.7) - - Dim nonClientHeight = Height - ClientSize.Height - Dim workingArea = Screen.FromControl(Me).WorkingArea - Dim maxHeight = workingArea.Height - Dim w = ClientSize.Width - Dim secondLongestLine = GetSecondLongestLineLength() - Dim predictedWidth = CInt(secondLongestLine * fh * 0.45) - - If predictedWidth > Width Then - w = predictedWidth - End If - - If w > fh * 40 Then - w = fh * 40 - End If - - Dim ncx = Width - ClientSize.Width - Dim ncy = Height - ClientSize.Height - - w += ncx - h += ncy - - If h > maxHeight Then - h = maxHeight - End If - - Dim l = (workingArea.Width - w) \ 2 - Dim t = (workingArea.Height - h) \ 2 - - Native.SetWindowPos(Handle, IntPtr.Zero, l, t, w, h, 64) - End Sub - - Function GetSecondLongestLineLength() As Integer - Dim list As New List(Of Integer)({51, 52}) - - If Content <> "" Then - For Each line In Content.Split(vbLf) - list.Add(line.Length) - Next - End If - - If ExpandedContent <> "" AndAlso ExpandedContentLabel?.Height > 0 Then - For Each line In ExpandedContent.Split(vbLf) - list.Add(line.Length) - Next - End If - - For Each def In CommandDefinitions - If def.Description <> "" Then - For Each line In def.Description.Split(vbLf) - list.Add(line.Length) - Next - End If - Next - - For Each def In CommandDefinitions - If def.Text <> "" Then - For Each line In def.Text.Split(vbLf) - list.Add(CInt(line.Length / 11 * 9)) - Next - End If - Next - - list.Sort() - list.Reverse() - Return list(1) - End Function - - WriteOnly Property ShowCopyButton As Boolean - Set(value As Boolean) - If value Then - blCopyMessage.Text = "Copy Message" - blCopyMessage.Visible = True - blCopyMessage.ClickAction = Sub() - Clipboard.SetText(GetText) - MsgInfo("Message was copied to clipboard.") - End Sub - End If - End Set - End Property - - Function GetHandle() As IntPtr - Dim sb As New StringBuilder(500) - Dim handle = Native.GetForegroundWindow - Native.GetWindowModuleFileName(handle, sb, CUInt(sb.Capacity)) - - If StringHelp.Base(sb.ToString.Replace(".vshost", "")) = StringHelp.Base(Application.ExecutablePath) Then - Return handle - End If - End Function - - Function GetText() As String - Dim ret = TitleLabel.Text - - If Content <> "" Then - ret += BR2 + Content - End If - - If ExpandedContent <> "" Then - ret += BR2 + ExpandedContent - End If - - Return ret - End Function - - Shared Function GetDialogResultFromButton(button As TaskButton) As DialogResult - Select Case button - Case TaskButton.OK - Return DialogResult.OK - Case TaskButton.Cancel, TaskButton.Close - Return DialogResult.Cancel - Case TaskButton.Yes - Return DialogResult.Yes - Case TaskButton.No - Return DialogResult.No - Case TaskButton.None - Return DialogResult.None - Case TaskButton.Retry - Return DialogResult.Retry - End Select - End Function - - Protected Overrides Sub OnLoad(args As EventArgs) - MyBase.OnLoad(args) - Font = New Font("Segoe UI", 9) - Dim fh = FontHeight - - For Each i As ButtonEx In flpButtons.Controls - i.Height = CInt(fh * 1.5) - i.Width = fh * 5 - - Using g = i.CreateGraphics - Dim minWidth = CInt(g.MeasureString(i.Text, i.Font).Width + fh) - - If i.Width < minWidth Then - i.Width = minWidth - End If - End Using - - i.Margin = New Padding(CInt(fh * 0.4), 0, 0, 0) - Next - - MenuButton.Margin = New Padding(CInt(fh * 0.7), MenuButton.Margin.Top, CInt(fh * 0.7), MenuButton.Margin.Bottom) - InputTextEdit.Margin = MenuButton.Margin - flpButtons.Margin = New Padding(0, 0, CInt(fh * 0.7), 0) - - If InputTextEdit.Visible Then - ActiveControl = InputTextEdit - InputTextEdit.TextBox.SelectAll() - End If - - AdjustSize() - AdjustSize() - - If Owner <> IntPtr.Zero Then - Dim GWLP_HWNDPARENT = -8 - SetWindowLongPtr(Handle, GWLP_HWNDPARENT, Owner) - End If - End Sub - - Overloads Function Show() As T - Init() - - If Application.MessageLoop Then - Using Me - ShowDialog() - End Using - Else - Application.Run(Me) - End If - - Return SelectedValue - End Function - - Public Class CommandDefinition - Property Text As String - Property Description As String - Property Value As T - End Class - - Public Class ButtonDefinition - Property Text As String - Property Value As T - Property Button As ButtonEx - End Class -End Class - -Public Enum TaskIcon - None - Info - Warning - Question - [Error] - Shield -End Enum - -Public Enum TaskButton - None = 0 - OK = 1 - Yes = 2 - No = 4 - Cancel = 8 - Retry = 16 - Close = 32 - OkCancel = OK Or Cancel - YesNo = Yes Or No - YesNoCancel = YesNo Or Cancel - RetryCancel = Retry Or Cancel -End Enum diff --git a/src/WinForms/TaskDialog/TaskDialog.vbproj b/src/WinForms/TaskDialog/TaskDialog.vbproj deleted file mode 100644 index 54ee139..0000000 --- a/src/WinForms/TaskDialog/TaskDialog.vbproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - AnyCPU - {CFBE6E6C-B711-42BB-B5ED-487D4767FE2B} - Library - - - TaskDialog - TaskDialog - 512 - Windows - v4.8 - true - true - - - AnyCPU - true - full - true - true - bin\Debug\ - TaskDialog.xml - 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42105,42106,42107,42353,42354,42355 - - - AnyCPU - pdbonly - false - true - true - bin\Release\ - TaskDialog.xml - 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42105,42106,42107,42353,42354,42355 - - - On - - - Binary - - - Off - - - On - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - Application.myapp - True - - - True - True - Resources.resx - - - True - Settings.settings - True - - - - - Form - - - TaskDialogBaseForm.vb - - - Form - - - - - VbMyResourcesResXFileCodeGenerator - Resources.Designer.vb - My.Resources - Designer - - - TaskDialogBaseForm.vb - - - - - MyApplicationCodeGenerator - Application.Designer.vb - - - SettingsSingleFileGenerator - My - Settings.Designer.vb - - - - \ No newline at end of file diff --git a/src/WinForms/TaskDialog/TaskDialogBaseForm.Designer.vb b/src/WinForms/TaskDialog/TaskDialogBaseForm.Designer.vb deleted file mode 100644 index fc27f8a..0000000 --- a/src/WinForms/TaskDialog/TaskDialogBaseForm.Designer.vb +++ /dev/null @@ -1,247 +0,0 @@ - -Imports System.Windows.Forms - - -Partial Class TaskDialogBaseForm - Inherits Form - - 'Form overrides dispose to clean up the component list. - - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - - Private Sub InitializeComponent() - Me.components = New System.ComponentModel.Container() - Me.tlpMain = New System.Windows.Forms.TableLayoutPanel() - Me.tlpTop = New System.Windows.Forms.TableLayoutPanel() - Me.TitleLabel = New TaskDialog.TaskDialogBaseForm.LabelEx() - Me.pbIcon = New System.Windows.Forms.PictureBox() - Me.paMain = New TaskDialog.TaskDialogBaseForm.TaskDialogPanel() - Me.spBottom = New TaskDialog.TaskDialogBaseForm.StackPanel() - Me.InputTextEdit = New TaskDialog.TaskDialogBaseForm.TextEdit() - Me.MenuButton = New TaskDialog.TaskDialogBaseForm.MenuButtonEx() - Me.CheckBox = New TaskDialog.TaskDialogBaseForm.CheckBoxEx() - Me.flpButtons = New System.Windows.Forms.FlowLayoutPanel() - Me.blDetails = New TaskDialog.TaskDialogBaseForm.ButtonLabel() - Me.blCopyMessage = New TaskDialog.TaskDialogBaseForm.ButtonLabel() - Me.tlpMain.SuspendLayout() - Me.tlpTop.SuspendLayout() - CType(Me.pbIcon, System.ComponentModel.ISupportInitialize).BeginInit() - Me.spBottom.SuspendLayout() - Me.SuspendLayout() - ' - 'tlpMain - ' - Me.tlpMain.ColumnCount = 1 - Me.tlpMain.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - Me.tlpMain.Controls.Add(Me.tlpTop, 0, 0) - Me.tlpMain.Controls.Add(Me.paMain, 0, 1) - Me.tlpMain.Controls.Add(Me.spBottom, 0, 2) - Me.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill - Me.tlpMain.Location = New System.Drawing.Point(0, 0) - Me.tlpMain.Name = "tlpMain" - Me.tlpMain.RowCount = 3 - Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle()) - Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) - Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle()) - Me.tlpMain.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!)) - Me.tlpMain.Size = New System.Drawing.Size(705, 683) - Me.tlpMain.TabIndex = 0 - ' - 'tlpTop - ' - Me.tlpTop.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.tlpTop.AutoSize = True - Me.tlpTop.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.tlpTop.ColumnCount = 2 - Me.tlpTop.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle()) - Me.tlpTop.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.tlpTop.Controls.Add(Me.TitleLabel, 1, 0) - Me.tlpTop.Controls.Add(Me.pbIcon, 0, 0) - Me.tlpTop.Location = New System.Drawing.Point(0, 15) - Me.tlpTop.Margin = New System.Windows.Forms.Padding(0, 15, 0, 20) - Me.tlpTop.Name = "tlpTop" - Me.tlpTop.RowCount = 1 - Me.tlpTop.RowStyles.Add(New System.Windows.Forms.RowStyle()) - Me.tlpTop.Size = New System.Drawing.Size(705, 150) - Me.tlpTop.TabIndex = 1 - ' - 'TitleLabel - ' - Me.TitleLabel.Anchor = System.Windows.Forms.AnchorStyles.Left - Me.TitleLabel.AutoSize = True - Me.TitleLabel.Location = New System.Drawing.Point(160, 56) - Me.TitleLabel.Margin = New System.Windows.Forms.Padding(20) - Me.TitleLabel.Size = New System.Drawing.Size(155, 37) - Me.TitleLabel.Text = "TitleLabel" - Me.TitleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'pbIcon - ' - Me.pbIcon.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.pbIcon.Location = New System.Drawing.Point(40, 30) - Me.pbIcon.Margin = New System.Windows.Forms.Padding(40, 30, 0, 20) - Me.pbIcon.Name = "pbIcon" - Me.pbIcon.Size = New System.Drawing.Size(100, 100) - Me.pbIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage - Me.pbIcon.TabIndex = 2 - Me.pbIcon.TabStop = False - Me.pbIcon.Visible = False - ' - 'paMain - ' - Me.paMain.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.paMain.AutoScroll = True - Me.paMain.Form = Nothing - Me.paMain.LineBreaks = 0 - Me.paMain.Location = New System.Drawing.Point(0, 185) - Me.paMain.Margin = New System.Windows.Forms.Padding(0) - Me.paMain.Name = "paMain" - Me.paMain.Size = New System.Drawing.Size(705, 63) - Me.paMain.TabIndex = 2 - ' - 'spBottom - ' - Me.spBottom.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.spBottom.AutoSize = True - Me.spBottom.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.spBottom.Controls.Add(Me.InputTextEdit) - Me.spBottom.Controls.Add(Me.MenuButton) - Me.spBottom.Controls.Add(Me.CheckBox) - Me.spBottom.Controls.Add(Me.flpButtons) - Me.spBottom.Controls.Add(Me.blDetails) - Me.spBottom.Controls.Add(Me.blCopyMessage) - Me.spBottom.FlowDirection = System.Windows.Forms.FlowDirection.TopDown - Me.spBottom.Location = New System.Drawing.Point(0, 248) - Me.spBottom.Margin = New System.Windows.Forms.Padding(0, 0, 0, 30) - Me.spBottom.Name = "spBottom" - Me.spBottom.Size = New System.Drawing.Size(705, 405) - Me.spBottom.TabIndex = 3 - Me.spBottom.WrapContents = False - ' - 'InputTextEdit - ' - Me.InputTextEdit.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.InputTextEdit.Location = New System.Drawing.Point(30, 0) - Me.InputTextEdit.Margin = New System.Windows.Forms.Padding(30, 0, 30, 30) - Me.InputTextEdit.Name = "InputTextEdit" - Me.InputTextEdit.Size = New System.Drawing.Size(645, 60) - Me.InputTextEdit.Text = "InputTextEdit" - Me.InputTextEdit.Visible = False - ' - 'MenuButton - ' - Me.MenuButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Left Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.MenuButton.FlatAppearance.BorderSize = 2 - Me.MenuButton.Location = New System.Drawing.Point(30, 90) - Me.MenuButton.Margin = New System.Windows.Forms.Padding(30, 0, 30, 30) - Me.MenuButton.Padding = New System.Windows.Forms.Padding(4, 0, 0, 0) - Me.MenuButton.ShowMenuSymbol = True - Me.MenuButton.ShowPath = False - Me.MenuButton.Size = New System.Drawing.Size(645, 70) - Me.MenuButton.Text2 = "MenuButton" - Me.MenuButton.Visible = False - ' - 'CheckBox - ' - Me.CheckBox.AutoSize = True - Me.CheckBox.FlatAppearance.BorderSize = 2 - Me.CheckBox.Location = New System.Drawing.Point(30, 190) - Me.CheckBox.Margin = New System.Windows.Forms.Padding(30, 0, 0, 0) - Me.CheckBox.Size = New System.Drawing.Size(366, 41) - Me.CheckBox.Text = "VerificationCheckBox" - Me.CheckBox.UseVisualStyleBackColor = False - Me.CheckBox.Visible = False - ' - 'flpButtons - ' - Me.flpButtons.Anchor = System.Windows.Forms.AnchorStyles.Right - Me.flpButtons.Location = New System.Drawing.Point(505, 231) - Me.flpButtons.Margin = New System.Windows.Forms.Padding(0) - Me.flpButtons.Name = "flpButtons" - Me.flpButtons.Size = New System.Drawing.Size(200, 100) - Me.flpButtons.TabIndex = 2 - Me.flpButtons.Visible = False - ' - 'blDetails - ' - Me.blDetails.AutoSize = True - Me.blDetails.ClickAction = Nothing - Me.blDetails.Location = New System.Drawing.Point(20, 331) - Me.blDetails.Margin = New System.Windows.Forms.Padding(20, 0, 0, 0) - Me.blDetails.Name = "blDetails" - Me.blDetails.Size = New System.Drawing.Size(203, 37) - Me.blDetails.TabIndex = 8 - Me.blDetails.Text = "Show Details" - Me.blDetails.Visible = False - ' - 'blCopyMessage - ' - Me.blCopyMessage.AutoSize = True - Me.blCopyMessage.ClickAction = Nothing - Me.blCopyMessage.Location = New System.Drawing.Point(20, 368) - Me.blCopyMessage.Margin = New System.Windows.Forms.Padding(20, 0, 0, 0) - Me.blCopyMessage.Name = "blCopyMessage" - Me.blCopyMessage.Size = New System.Drawing.Size(228, 37) - Me.blCopyMessage.TabIndex = 7 - Me.blCopyMessage.Text = "Copy Message" - Me.blCopyMessage.Visible = False - ' - 'TaskDialogBaseForm - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(288.0!, 288.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.ClientSize = New System.Drawing.Size(705, 683) - Me.Controls.Add(Me.tlpMain) - Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4) - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "TaskDialogBaseForm" - Me.ShowIcon = False - Me.Text = "StaxRip" - Me.tlpMain.ResumeLayout(False) - Me.tlpMain.PerformLayout() - Me.tlpTop.ResumeLayout(False) - Me.tlpTop.PerformLayout() - CType(Me.pbIcon, System.ComponentModel.ISupportInitialize).EndInit() - Me.spBottom.ResumeLayout(False) - Me.spBottom.PerformLayout() - Me.ResumeLayout(False) - - End Sub - - Friend WithEvents tlpMain As TableLayoutPanel - Friend WithEvents CheckBox As CheckBoxEx - Friend WithEvents flpButtons As FlowLayoutPanel - Friend WithEvents InputTextEdit As TextEdit - Friend WithEvents tlpTop As TableLayoutPanel - Friend WithEvents TitleLabel As LabelEx - Friend WithEvents MenuButton As MenuButtonEx - Friend WithEvents paMain As TaskDialogPanel - Friend WithEvents spBottom As StackPanel - Friend WithEvents blCopyMessage As ButtonLabel - Friend WithEvents blDetails As ButtonLabel - Friend WithEvents pbIcon As PictureBox -End Class diff --git a/src/WinForms/TaskDialog/TaskDialogBaseForm.resx b/src/WinForms/TaskDialog/TaskDialogBaseForm.resx deleted file mode 100644 index 1af7de1..0000000 --- a/src/WinForms/TaskDialog/TaskDialogBaseForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/WinForms/TaskDialog/TaskDialogBaseForm.vb b/src/WinForms/TaskDialog/TaskDialogBaseForm.vb deleted file mode 100644 index 99f0824..0000000 --- a/src/WinForms/TaskDialog/TaskDialogBaseForm.vb +++ /dev/null @@ -1,1603 +0,0 @@ - -Imports System.ComponentModel -Imports System.Drawing -Imports System.Drawing.Drawing2D -Imports System.Runtime.InteropServices -Imports System.Windows.Forms -Imports System.Windows.Forms.VisualStyles - -Public Class TaskDialogBaseForm - Overridable Sub AdjustSize() - End Sub - - Public Shared Property BR As String = Environment.NewLine - Public Shared Property BR2 As String = Environment.NewLine + Environment.NewLine - - Public Sub New() - InitializeComponent() - 'ApplyTheme() - - AddHandler InputTextEdit.TextBox.KeyDown, AddressOf InputTextEditTextBoxKeyDown - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.TaskDialog.BackColor - ' ForeColor = theme.TaskDialog.ForeColor - ' blCopyMessage.BackColor = BackColor - ' blDetails.BackColor = BackColor - ' ResumeLayout() - 'End Sub - - - Shared Function SetWindowLong32(hWnd As IntPtr, nIndex As Integer, dwNewLong As Integer) As Integer - End Function - - - Shared Function SetWindowLongPtr64(hWnd As IntPtr, nIndex As Integer, dwNewLong As IntPtr) As IntPtr - End Function - - Shared Function SetWindowLongPtr(hWnd As IntPtr, nIndex As Integer, dwNewLong As IntPtr) As IntPtr - If IntPtr.Size = 8 Then - Return SetWindowLongPtr64(hWnd, nIndex, dwNewLong) - Else - Return New IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32)) - End If - End Function - - Class TaskDialogPanel - Inherits PanelEx - - Property Form As TaskDialogBaseForm - Property LineBreaks As Integer - - Protected Overrides Sub OnLayout(levent As LayoutEventArgs) - MyBase.OnLayout(levent) - - If DesignMode OrElse Controls.Count = 0 Then - MyBase.OnLayout(levent) - Exit Sub - End If - - If Form Is Nothing Then - Form = DirectCast(FindForm(), TaskDialogBaseForm) - End If - - Dim fh = FontHeight - Dim previous As Control = Nothing - - Using g = CreateGraphics() - For x = 0 To Controls.Count - 1 - Dim c = Controls(x) - - If x = 0 Then - c.Top = 0 - Else - c.Top = previous.Top + previous.Height + CInt(fh * 0.2) - End If - - c.Left = CInt(fh * 0.7) - c.Width = ClientSize.Width - CInt(fh * 0.7 * 2) - - If TypeOf c Is LabelEx Then - If c.Name = "ExpandedInformation" AndAlso Form.blDetails.Text = "Show Details" Then - c.Visible = False - c.Height = 0 - Else - c.Visible = True - Dim sz = g.MeasureString(c.Text, c.Font, c.Width) - c.Height = CInt(sz.Height + fh / 2) - End If - End If - - If TryCast(c, CommandButton)?.AdjustSize() Then - LineBreaks += 1 - End If - - previous = c - Next - End Using - End Sub - End Class - - - Public Class DispNameAttribute - Inherits DisplayNameAttribute - - Sub New(name As String) - DisplayNameValue = name - End Sub - - Shared Function GetValueForEnum(value As Object) As String - For Each i In value.GetType.GetFields - If i.GetValue(value).Equals(value) Then - For Each i2 In i.GetCustomAttributes(False) - If i2.GetType Is GetType(DispNameAttribute) Then - Return DirectCast(i2, DispNameAttribute).DisplayName - End If - Next - - Return i.Name - End If - Next - - Return "Unknown Type" - End Function - - Shared Function GetNamesForEnum(Of T)() As String() - Dim l As New List(Of String) - - For Each i As T In System.Enum.GetValues(GetType(T)) - l.Add(GetValueForEnum(i)) - Next - - Return l.ToArray - End Function - - Shared Function GetValue(attributes As Object()) As String - For Each i In attributes - If TypeOf i Is DispNameAttribute Then - Return DirectCast(i, DispNameAttribute).DisplayName - End If - Next - - Return Nothing - End Function - End Class - - Public Class TextBoxEx - Inherits TextBox - - Private _blockOnTextChanged As Boolean = False - Private _borderColor As Color - Private _borderFocusedColor As Color - - Public Property BorderColor As Color - Get - Return _borderColor - End Get - Set(value As Color) - _borderColor = value - End Set - End Property - - Private Function ShouldSerializeBorderColor() As Boolean - Return BorderColor <> Color.Empty - End Function - - Public Property BorderFocusedColor As Color - Get - Return _borderFocusedColor - End Get - Set(value As Color) - _borderFocusedColor = value - 'Native.RedrawWindow(Handle, IntPtr.Zero, IntPtr.Zero, RDW_FRAME Or RDW_IUPDATENOW Or RDW_INVALIDATE) - End Set - End Property - - Private Function ShouldSerializeBorderFocusedColor() As Boolean - Return BorderFocusedColor <> Color.Empty - End Function - - - Shadows Property Name() As String - Get - Return MyBase.Name - End Get - Set(value As String) - MyBase.Name = value - End Set - End Property - - - Shadows Property TabIndex As Integer - Get - Return MyBase.TabIndex - End Get - Set(value As Integer) - MyBase.TabIndex = value - End Set - End Property - - Sub New() - 'ApplyTheme() - BorderStyle = BorderStyle.None - - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.General.Controls.TextBox.BackColor - ' ForeColor = theme.General.Controls.TextBox.ForeColor - ' BorderColor = theme.General.Controls.TextBox.BorderColor - ' BorderFocusedColor = theme.General.Controls.TextBox.BorderFocusedColor - ' ResumeLayout() - 'End Sub - - Public Sub SetTextWithoutTextChangedEvent(text As String) - _blockOnTextChanged = True - Me.Text = text - _blockOnTextChanged = False - End Sub - - Protected Overrides Sub OnTextChanged(e As EventArgs) - If Not _blockOnTextChanged Then - MyBase.OnTextChanged(e) - End If - End Sub - End Class - - Public Class TextEdit - Inherits UserControl - - Private _backReadonlyColor As Color - Private _borderColor As Color - Private _borderFocusedColor As Color - Private _borderHoverColor As Color - Private _drawBorder As Integer = -1 - - Public WithEvents TextBox As New TextBoxEx - - Public Shadows Event DoubleClick(sender As Object, e As EventArgs) - Public Shadows Event KeyDown(sender As Object, e As KeyEventArgs) - Public Shadows Event MouseDown(sender As Object, e As MouseEventArgs) - Public Shadows Event MouseWheel(sender As Object, e As MouseEventArgs) - Public Shadows Event TextChanged(sender As Object, e As EventArgs) - - Public Property BackReadonlyColor As Color - Get - Return _backReadonlyColor - End Get - Set(value As Color) - _backReadonlyColor = value - Invalidate() - End Set - End Property - - Private Function ShouldSerializeBackReadonlyColor() As Boolean - Return BackReadonlyColor <> Color.Empty - End Function - - Public Property BorderColor As Color - Get - Return _borderColor - End Get - Set(value As Color) - _borderColor = value - Invalidate() - End Set - End Property - - Private Function ShouldSerializeBorderColor() As Boolean - Return BorderColor <> Color.Empty - End Function - - Public Property BorderFocusedColor As Color - Get - Return _borderFocusedColor - End Get - Set(value As Color) - _borderFocusedColor = value - Invalidate() - End Set - End Property - - Private Function ShouldSerializeBorderFocusedColor() As Boolean - Return BorderFocusedColor <> Color.Empty - End Function - - Public Property BorderHoverColor As Color - Get - Return _borderHoverColor - End Get - Set(value As Color) - _borderHoverColor = value - Invalidate() - End Set - End Property - - Private Function ShouldSerializeBorderHoverColor() As Boolean - Return BorderHoverColor <> Color.Empty - End Function - - ReadOnly Property DrawBorder As Integer - Get - If _drawBorder < 0 Then - _drawBorder = 1 - End If - - Return _drawBorder - End Get - End Property - - - Property [ReadOnly] As Boolean - Get - Return TextBox.ReadOnly - End Get - Set(value As Boolean) - TextBox.ReadOnly = value - Invalidate() - End Set - End Property - - - - Overrides Property Text As String - Get - Return TextBox.Text - End Get - Set(value As String) - TextBox.Text = value - MyBase.Text = value - End Set - End Property - - - Shadows Property TabIndex As Integer - Get - Return MyBase.TabIndex - End Get - Set(value As Integer) - MyBase.TabIndex = value - End Set - End Property - - Sub New() - SetStyle(ControlStyles.ResizeRedraw, True) - TextBox.BorderStyle = BorderStyle.None - Controls.Add(TextBox) - - AddHandler TextBox.DoubleClick, Sub(sender As Object, e As EventArgs) RaiseEvent DoubleClick(sender, e) - AddHandler TextBox.KeyDown, Sub(sender As Object, e As KeyEventArgs) RaiseEvent KeyDown(sender, e) - AddHandler TextBox.MouseDown, Sub(sender As Object, e As MouseEventArgs) RaiseEvent MouseDown(sender, e) - AddHandler TextBox.MouseWheel, Sub(sender As Object, e As MouseEventArgs) RaiseEvent MouseWheel(sender, e) - AddHandler TextBox.TextChanged, Sub(sender As Object, e As EventArgs) RaiseEvent TextChanged(sender, e) - AddHandler TextBox.GotFocus, AddressOf TextBox_GotFocus - AddHandler TextBox.LostFocus, AddressOf TextBox_LostFocus - AddHandler TextBox.MouseEnter, AddressOf TextBox_GotFocus - AddHandler TextBox.MouseLeave, AddressOf TextBox_LostFocus - - 'ApplyTheme() - - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.General.Controls.TextEdit.BackColor - ' BackReadonlyColor = theme.General.Controls.TextEdit.BackReadonlyColor - ' ForeColor = theme.General.Controls.TextEdit.ForeColor - ' BorderColor = theme.General.Controls.TextEdit.BorderColor - ' BorderFocusedColor = theme.General.Controls.TextEdit.BorderFocusedColor - ' BorderHoverColor = theme.General.Controls.TextEdit.BorderHoverColor - ' ResumeLayout() - 'End Sub - - Sub TextBox_GotFocus(sender As Object, e As EventArgs) - Invalidate() - End Sub - - Sub TextBox_LostFocus(sender As Object, e As EventArgs) - Invalidate() - End Sub - - Protected Overrides Sub OnLayout(args As LayoutEventArgs) - MyBase.OnLayout(args) - - If TextBox.Multiline Then - TextBox.Top = 2 - TextBox.Left = 2 - TextBox.Width = ClientSize.Width - 4 - TextBox.Height = ClientSize.Height - 4 - Else - TextBox.Top = ((ClientSize.Height - TextBox.Height) \ 2) - TextBox.Left = 2 - TextBox.Width = ClientSize.Width - 4 - Dim h = TextRenderer.MeasureText("gG", TextBox.Font).Height - - If TextBox.Height < h Then - TextBox.Multiline = True - TextBox.MinimumSize = New Size(0, h) - TextBox.Multiline = False - End If - End If - End Sub - - Protected Overrides Sub OnPaint(e As PaintEventArgs) - MyBase.OnPaint(e) - - If Not [ReadOnly] AndAlso DrawBorder > 0 Then - Dim borderCol = If(TextBox.Focused OrElse Not GetChildAtPoint(PointToClient(Cursor.Position)) Is Nothing, BorderFocusedColor, BorderColor) - borderCol = If(GetChildAtPoint(PointToClient(Cursor.Position)) IsNot Nothing, BorderHoverColor, borderCol) - ControlPaint.DrawBorder(e.Graphics, ClientRectangle, borderCol, ButtonBorderStyle.Solid) - End If - End Sub - End Class - - Public Class StackPanel - Inherits FlowLayoutPanel - - Protected Overrides Sub OnLayout(levent As LayoutEventArgs) - MyBase.OnLayout(levent) - - If Not WrapContents AndAlso (FlowDirection = FlowDirection.TopDown OrElse FlowDirection = FlowDirection.BottomUp) Then - For Each i As Control In Controls - If (i.Anchor And AnchorStyles.Right) = AnchorStyles.Right AndAlso - (i.Anchor And AnchorStyles.Left) = AnchorStyles.Left Then - - i.Left = i.Margin.Left - i.Width = ClientSize.Width - i.Margin.Horizontal - ElseIf (i.Anchor And AnchorStyles.Right) = AnchorStyles.Right Then - i.Left = ClientSize.Width - (i.Width + i.Margin.Right) - End If - Next - End If - End Sub - End Class - - Public Class PanelEx - Inherits Panel - - Private ShowNiceBorderValue As Boolean - - Sub New() - SetStyle(ControlStyles.ResizeRedraw, True) - End Sub - - - - Property ShowNiceBorder() As Boolean - Get - Return ShowNiceBorderValue - End Get - Set(Value As Boolean) - ShowNiceBorderValue = Value - Invalidate() - End Set - End Property - - Protected Overrides Sub OnPaint(e As PaintEventArgs) - MyBase.OnPaint(e) - - If ShowNiceBorder AndAlso VisualStyleInformation.IsEnabledByUser Then - ControlPaint.DrawBorder(e.Graphics, ClientRectangle, - VisualStyleInformation.TextControlBorder, ButtonBorderStyle.Solid) - End If - End Sub - End Class - - Public Class ButtonLabel - Inherits Label - - Property LinkColor As Color = Color.Empty - Property LinkHoverColor As Color = Color.Empty - - Property ClickAction As Action - - Sub New() - ApplyTheme() - End Sub - - Private Function ShouldSerializeLinkColor() As Boolean - Return LinkColor <> Color.Empty - End Function - - Private Function ShouldSerializeLinkHoverColor() As Boolean - Return LinkHoverColor <> Color.Empty - End Function - - Sub ApplyTheme() - If DesignHelp.IsDesignMode Then - Exit Sub - End If - - BackColor = Colors.Window - ForeColor = Colors.Link - LinkColor = Colors.Link - LinkHoverColor = Colors.LinkHover - End Sub - - Protected Overrides Sub OnMouseEnter(e As EventArgs) - ForeColor = LinkHoverColor - MyBase.OnMouseEnter(e) - End Sub - - Protected Overrides Sub OnMouseLeave(e As EventArgs) - ForeColor = LinkColor - MyBase.OnMouseLeave(e) - End Sub - - Protected Overrides Sub OnClick(e As EventArgs) - MyBase.OnClick(e) - ClickAction?.Invoke - End Sub - End Class - - Class CommandButton - Inherits Button - - Property Title As String - Property Description As String - - Private _TitleFont As Font - - ReadOnly Property TitleFont As Font - Get - If _TitleFont Is Nothing Then - _TitleFont = New Font(Font.FontFamily, 11) - End If - - Return _TitleFont - End Get - End Property - - Sub New() - 'If Not DesignHelp.IsDesignMode Then - ' MinimumSize = New Size(20, 20) - ' UseCompatibleTextRendering = False - ' UseVisualStyleBackColor = False - ' FlatStyle = FlatStyle.Flat - 'End If - - FlatAppearance.BorderSize = 2 - - 'ApplyTheme() - - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.TaskDialog.CommandButton.BackColor - ' ForeColor = theme.TaskDialog.CommandButton.ForeColor - ' FlatAppearance.BorderColor = theme.TaskDialog.CommandButton.BorderColor - ' ResumeLayout() - 'End Sub - - - Function AdjustSize() As Boolean - Dim titleFontHeight = TitleFont.Height - Dim h As Integer - Dim hasLineBreak As Boolean - - If Title <> "" AndAlso Description <> "" Then - Dim ts = GetTitleSize() - Dim ds = GetDescriptionSize() - h = CInt(titleFontHeight * 0.2 * 2) + ts.Height + ds.Height - - If titleFontHeight * 2 < ts.Height Then - hasLineBreak = True - End If - ElseIf Title <> "" Then - Dim ts = GetTitleSize() - h = CInt(titleFontHeight * 0.2 * 2) + ts.Height - - If titleFontHeight * 2 < ts.Height Then - hasLineBreak = True - End If - ElseIf Description <> "" Then - Dim ds = GetDescriptionSize() - h = CInt(titleFontHeight * 0.2 * 2) + ds.Height - - If FontHeight * 2 < ds.Height Then - hasLineBreak = True - End If - End If - - ClientSize = New Size(ClientSize.Width, h) - Return hasLineBreak - End Function - - Function GetTitleSize(Optional g1 As Graphics = Nothing) As Size - If Title = "" Then - Exit Function - End If - - Dim g2 = g1 - - If g2 Is Nothing Then - g2 = CreateGraphics() - End If - - Dim tf = TitleFont.Height - Dim w = ClientSize.Width - CInt(tf * 0.3 * 2) - Dim sz = g2.MeasureString(Title, TitleFont, w) - - If g1 Is Nothing Then - g2.Dispose() - End If - - Return New Size(CInt(sz.Width), CInt(sz.Height)) - End Function - - Function GetDescriptionSize(Optional g1 As Graphics = Nothing) As Size - If Description = "" Then - Exit Function - End If - - Dim g2 = g1 - - If g2 Is Nothing Then - g2 = CreateGraphics() - End If - - Dim tf = TitleFont.Height - Dim w = ClientSize.Width - CInt(tf * 0.3 * 2) - Dim sz = g2.MeasureString(Description, Font, w) - - If g1 Is Nothing Then - g2.Dispose() - End If - - Return New Size(CInt(sz.Width), CInt(sz.Height)) - End Function - - Protected Overrides Sub OnGotFocus(e As EventArgs) - MyBase.OnGotFocus(e) - End Sub - - Protected Overrides Sub OnLostFocus(e As EventArgs) - MyBase.OnLostFocus(e) - End Sub - - Protected Overrides Sub OnPaint(e As PaintEventArgs) - MyBase.OnPaint(e) - - Dim g = e.Graphics - g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias - Dim titleFontHeight = TitleFont.Height - - Dim x = CInt(titleFontHeight * 0.3) - Dim y = CInt(titleFontHeight * 0.2) - Dim w = ClientSize.Width - x * 2 - Dim h = ClientSize.Height - CInt(titleFontHeight * 0.2 * 2) - Dim r = New Rectangle(x, y, w, h) - - If Title <> "" AndAlso Description <> "" Then - TextRenderer.DrawText(g, Title, TitleFont, r, ForeColor, TextFormatFlags.Left Or TextFormatFlags.WordBreak) - y = CInt(titleFontHeight * 0.2) + GetTitleSize().Height - r = New Rectangle(x, y, w, h) - TextRenderer.DrawText(g, Description, Font, r, ForeColor, TextFormatFlags.Left Or TextFormatFlags.WordBreak) - ElseIf Title <> "" Then - TextRenderer.DrawText(g, Title, TitleFont, r, ForeColor, TextFormatFlags.Left Or TextFormatFlags.WordBreak) - ElseIf Description <> "" Then - TextRenderer.DrawText(g, Description, Font, r, ForeColor, TextFormatFlags.Left Or TextFormatFlags.WordBreak) - End If - End Sub - - Protected Overrides Sub Dispose(disposing As Boolean) - 'RemoveHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - TitleFont.Dispose() - MyBase.Dispose(disposing) - End Sub - End Class - - Public Class ButtonEx - Inherits Button - - Private _backDisabledColor As Color - Private _foreDisabledColor As Color - Private _text As String = "" - - - Property ShowMenuSymbol As Boolean - - - - Property ClickAction As Action - - Public Property BackDisabledColor As Color - Get - Return _backDisabledColor - End Get - Set(value As Color) - _backDisabledColor = value - End Set - End Property - - Private Function ShouldSerializeBackDisabledColor() As Boolean - Return BackDisabledColor <> Color.Empty - End Function - - Public Property ForeDisabledColor As Color - Get - Return _foreDisabledColor - End Get - Set(value As Color) - _foreDisabledColor = value - End Set - End Property - - Private Function ShouldSerializeForeDisabledColor() As Boolean - Return ForeDisabledColor <> Color.Empty - End Function - - - Shadows Property Name As String - Get - Return MyBase.Name - End Get - Set(value As String) - MyBase.Name = value - End Set - End Property - - - Shadows Property TabIndex As Integer - Get - Return MyBase.TabIndex - End Get - Set(value As Integer) - MyBase.TabIndex = value - End Set - End Property - - Protected Overrides ReadOnly Property ShowFocusCues As Boolean - Get - Return True - End Get - End Property - - 'The designer is not able to serialize the Text property probably - 'because it shadows the base Text property, Text2 is used as workaround - Property Text2 As String - Get - Return _text - End Get - Set(value As String) - _text = value - End Set - End Property - - Shadows Property Text As String - Get - Return _text - End Get - Set(value As String) - _text = value - - If AutoSize Then - Dim textSize = TextRenderer.MeasureText(_text, Font) - Dim fh = Font.Height - MinimumSize = New Size(CInt(fh * 2.2), fh) - AutoSizeMode = AutoSizeMode.GrowOnly - Size = New Size(textSize.Width + Padding.Horizontal + fh, textSize.Height + CInt(fh * 0.45)) - End If - - Invalidate(True) - End Set - End Property - - Private Function ShouldSerializeUseVisualStyleBackColor() As Boolean - Return False - End Function - - Protected Overrides ReadOnly Property DefaultSize As Size - Get - Return New Size(250, 70) - End Get - End Property - - Sub New() - SetStyle(ControlStyles.ResizeRedraw, True) - - Padding = New Padding(0) - - If Not DesignHelp.IsDesignMode Then - MinimumSize = New Size(20, 20) - UseCompatibleTextRendering = True - UseVisualStyleBackColor = False - FlatStyle = FlatStyle.Flat - End If - - FlatAppearance.BorderSize = 2 - - 'ApplyTheme() - - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.General.Controls.Button.BackColor - ' BackDisabledColor = theme.General.Controls.Button.BackDisabledColor - ' ForeColor = theme.General.Controls.Button.ForeColor - ' ForeDisabledColor = theme.General.Controls.Button.ForeDisabledColor - ' FlatAppearance.BorderColor = theme.General.Controls.Button.BorderColor - ' ResumeLayout() - 'End Sub - - Protected Overrides Sub OnClick(e As EventArgs) - ClickAction?.Invoke() - ContextMenuStrip?.Show(Me, 0, Height) - MyBase.OnClick(e) - End Sub - - Protected Overrides Sub OnPaint(e As PaintEventArgs) - MyBase.OnPaint(e) - - e.Graphics.SmoothingMode = SmoothingMode.AntiAlias - - Dim fore = If(Enabled, ForeColor, ForeDisabledColor) - Dim flags As TextFormatFlags - - Select Case TextAlign - Case Drawing.ContentAlignment.BottomCenter - flags = TextFormatFlags.Bottom Or TextFormatFlags.HorizontalCenter - Case Drawing.ContentAlignment.BottomLeft - flags = TextFormatFlags.Bottom Or TextFormatFlags.Left - Case Drawing.ContentAlignment.BottomRight - flags = TextFormatFlags.Bottom Or TextFormatFlags.Right - Case Drawing.ContentAlignment.MiddleCenter - flags = TextFormatFlags.VerticalCenter Or TextFormatFlags.HorizontalCenter - Case Drawing.ContentAlignment.MiddleLeft - flags = TextFormatFlags.VerticalCenter Or TextFormatFlags.Left - Case Drawing.ContentAlignment.MiddleRight - flags = TextFormatFlags.VerticalCenter Or TextFormatFlags.Right - Case Drawing.ContentAlignment.TopCenter - flags = TextFormatFlags.Top Or TextFormatFlags.HorizontalCenter - Case Drawing.ContentAlignment.TopLeft - flags = TextFormatFlags.Top Or TextFormatFlags.Left - Case Drawing.ContentAlignment.TopRight - flags = TextFormatFlags.Top Or TextFormatFlags.Right - End Select - - Using foreBrush = New SolidBrush(fore) - Dim rect = ClientRectangle - rect.Offset(0, Padding.Top - If(FlatStyle.HasFlag(FlatStyle.Flat), FlatAppearance.BorderSize \ 2, 0)) - - TextRenderer.DrawText(e.Graphics, Text, Font, rect, fore, flags) - End Using - - If ShowMenuSymbol Then - Dim h = CInt(Font.Height * 0.3) - Dim w = h * 2 - - Dim x1 = If(Text = "", Width \ 2 - w \ 2, Width - w - CInt(w * 0.7)) - Dim y1 = CInt(Height / 2 - h / 2) - - Dim x2 = CInt(x1 + w / 2) - Dim y2 = y1 + h - - Dim x3 = x1 + w - Dim y3 = y1 - - Using pen = New Pen(fore, Font.Height / 16.0F) - e.Graphics.DrawLine(pen, x1, y1, x2, y2) - e.Graphics.DrawLine(pen, x2, y2, x3, y3) - End Using - End If - End Sub - End Class - - Public Class CheckBoxEx - Inherits CheckBox - - 'Private _theme As Theme - - 'Public ReadOnly Property Theme As Theme - ' Get - ' Return _theme - ' End Get - 'End Property - - - Shadows Property Name() As String - Get - Return MyBase.Name - End Get - Set(value As String) - MyBase.Name = value - End Set - End Property - - - Shadows Property TabIndex As Integer - Get - Return MyBase.TabIndex - End Get - Set(value As Integer) - MyBase.TabIndex = value - End Set - End Property - - Sub New() - SetStyle(ControlStyles.ResizeRedraw, True) - SetStyle(ControlStyles.UserPaint, True) - UseVisualStyleBackColor = False - FlatStyle = FlatStyle.Standard - FlatAppearance.BorderSize = 2 - - 'ApplyTheme() - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' _theme = theme - - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' If Appearance.HasFlag(Appearance.Normal) Then - ' FlatStyle = FlatStyle.Standard - ' FlatAppearance.BorderSize = 0 - - ' BackColor = theme.General.Controls.CheckBox.BackColor - ' ForeColor = theme.General.Controls.CheckBox.ForeColor - ' FlatAppearance.BorderColor = theme.General.Controls.CheckBox.BorderColor - ' FlatAppearance.CheckedBackColor = theme.General.Controls.CheckBox.BackColor - ' FlatAppearance.MouseOverBackColor = theme.General.Controls.CheckBox.BackHighlightColor - ' Else - ' FlatStyle = FlatStyle.Flat - ' FlatAppearance.BorderSize = 0 - - ' BackColor = theme.General.Controls.CheckBox.BackColor - ' ForeColor = theme.General.Controls.Button.ForeColor - ' FlatAppearance.BorderColor = theme.General.Controls.Button.BorderColor - ' FlatAppearance.CheckedBackColor = theme.General.Controls.Button.BackColor - ' FlatAppearance.MouseOverBackColor = theme.General.Controls.CheckBox.BackHoverColor - ' End If - ' ResumeLayout() - 'End Sub - - 'Protected Overrides Sub OnPaint(pevent As PaintEventArgs) - ' InvokePaintBackground(Me, pevent) - - ' pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias - ' Dim state As CheckBoxState = If(CheckState = CheckState.Checked, CheckBoxState.CheckedNormal, CheckBoxState.UncheckedNormal) - ' Dim glyphSize As Size = CheckBoxRendererEx.GetGlyphSize(pevent.Graphics, state) - ' Dim vPos As Integer = (Height - glyphSize.Height) \ 2 - ' Dim hPos As Integer = 1 - ' Dim glyphLocation As Point = New Point(hPos, vPos) - ' Dim textLocation As Point = New Point(hPos + glyphSize.Width + hPos, 1 + Height - (Height - CInt(pevent.Graphics.MeasureString(Text, Font).Height)) \ 3) - ' Dim textFlags As TextFormatFlags = TextFormatFlags.SingleLine Or TextFormatFlags.VerticalCenter - ' Dim fColor As ColorHSL = If(Checked, _theme.General.Controls.CheckBox.ForeCheckedColor, _theme.General.Controls.CheckBox.ForeColor) - - ' CheckBoxRendererEx.DrawCheckBox(pevent.Graphics, glyphLocation, state) - ' TextRenderer.DrawText(pevent.Graphics, Text, Font, textLocation, fColor, textFlags) - 'End Sub - - Protected Overrides Sub OnPaintBackground(pevent As PaintEventArgs) - MyBase.OnPaintBackground(pevent) - End Sub - - Protected Overrides Sub OnCheckedChanged(e As EventArgs) - MyBase.OnCheckedChanged(e) - End Sub - - Private Function ShouldSerializeUseVisualStyleBackColor() As Boolean - Return False - End Function - End Class - - Public Class MenuButtonEx - Inherits ButtonEx - - Event ValueChangedUser(value As Object) - - - Property Items As New List(Of Object) - Property Menu As New ContextMenuStripEx - Property ShowPath As Boolean - - Sub New() - Menu.ShowImageMargin = False - ShowMenuSymbol = True - Padding = New Padding(4, 0, 0, 0) - AddHandler Menu.Opening, AddressOf MenuOpening - End Sub - - Sub MenuOpening(sender As Object, e As CancelEventArgs) - Menu.MinimumSize = New Size(Width, 0) - Dim minItemSize As Integer = Menu.MinimumSize.Width - - For Each mi As MenuItemEx In Menu.Items - mi.Font = New Font("Segoe UI", 9, If(Value IsNot Nothing AndAlso Value.Equals(mi.Tag), FontStyle.Bold, FontStyle.Regular)) - mi.AutoSize = True - minItemSize = Math.Max(minItemSize, mi.Width) - Next - - For Each mi As MenuItemEx In Menu.Items - mi.AutoSize = False - mi.Width = minItemSize - Next - End Sub - - Private ValueValue As Object - - - Property Value As Object - Get - Return ValueValue - End Get - Set(value As Object) - If Menu.Items.Count = 0 Then - If TypeOf value Is System.Enum Then - For Each i In System.Enum.GetValues(value.GetType) - Dim text = DispNameAttribute.GetValueForEnum(i) - Dim temp = i - - MenuItemEx.Add(Menu.Items, text, Sub(o As Object) OnAction(text, o), temp, Nothing).Tag = temp - Next - End If - End If - - If Not value Is Nothing Then - For Each i In Menu.Items.OfType(Of MenuItemEx)() - If value.Equals(i.Tag) Then Text = i.Text - - If i.DropDownItems.Count > 0 Then - For Each i2 In i.DropDownItems.OfType(Of MenuItemEx)() - If value.Equals(i2.Tag) Then - If ShowPath Then - Text = i2.Path - Else - Text = i2.Text - End If - End If - Next - End If - Next - End If - - If Text = "" AndAlso Not value Is Nothing Then - Text = value.ToString - End If - - ValueValue = value - End Set - End Property - - Protected Overrides Sub OnMouseDown(e As MouseEventArgs) - If e.Button = MouseButtons.Left Then - Menu.Show(Me, 0, Height) - Else - MyBase.OnMouseDown(e) - End If - End Sub - - Protected Overridable Sub OnValueChanged(value As Object) - RaiseEvent ValueChangedUser(value) - End Sub - - Sub AddRange(items As IEnumerable(Of Object)) - For Each i In items - Add(i.ToString, i, Nothing) - Next - End Sub - - Function Add(path As String, obj As Object, Optional tip As String = Nothing) As MenuItemEx - Items.Add(obj) - Dim name = path - - If path.Contains("|") Then - name = StringHelp.RightLast(path, "|").Trim - End If - - Dim ret = MenuItemEx.Add(Menu.Items, path, Sub(o As Object) OnAction(name, o), obj, tip) - ret.Tag = obj - ret.Path = path - Return ret - End Function - - Sub Clear() - Items.Clear() - ClearAndDisposeToolStripItems(Menu.Items) - End Sub - - Shared Sub ClearAndDisposeToolStripItems(instance As ToolStripItemCollection) - For Each i In instance.OfType(Of IDisposable).ToArray - i.Dispose() - Next - - instance.Clear() - End Sub - - Sub OnAction(text As String, value As Object) - Me.Text = text - Me.Value = value - OnValueChanged(value) - End Sub - - Function GetValue(Of T)() As T - Return DirectCast(Value, T) - End Function - - Function GetInt() As Integer - Return DirectCast(Value, Integer) - End Function - - Protected Overrides Sub Dispose(disposing As Boolean) - Menu.Dispose() - MyBase.Dispose(disposing) - End Sub - - Public Class ContextMenuStripEx - Inherits ContextMenuStrip - - Private FormValue As Form - - Sub New() - MyBase.New() - 'ApplyTheme() - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - Sub New(container As IContainer) - MyBase.New(container) - 'ApplyTheme() - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.General.Controls.ToolStrip.DropdownBackgroundDefaultColor - ' ResumeLayout() - 'End Sub - - Protected Overrides Sub OnHandleCreated(e As EventArgs) - MyBase.OnHandleCreated(e) - 'g.SetRenderer(Me) - Font = New Font("Segoe UI", 9) - End Sub - - - Property Form As Form - Get - Return FormValue - End Get - Set(value As Form) - AddHandler value.Disposed, Sub() Dispose() - FormValue = value - value.KeyPreview = True - End Set - End Property - - Function Add(path As String) As MenuItemEx - Return Add(path, Nothing) - End Function - - Function Add(path As String, action As Action) As MenuItemEx - Return Add(path, action, True) - End Function - - Function Add(path As String, action As Action, key As Keys) As MenuItemEx - Return Add(path, action, key, True, Nothing, Nothing) - End Function - - Function Add(path As String, action As Action, key As Keys, symbol As Symbol) As MenuItemEx - Return Add(path, action, key, True, Nothing, Nothing, symbol) - End Function - - Function Add(path As String, action As Action, key As Keys, enabled As Boolean) As MenuItemEx - Return Add(path, action, key, enabled, Nothing, Nothing) - End Function - - Function Add(path As String, action As Action, help As String) As MenuItemEx - Return Add(path, action, True, help) - End Function - - Function Add(path As String, action As Action, enabled As Boolean) As MenuItemEx - Return Add(path, action, enabled, Nothing) - End Function - - Function Add(path As String, action As Action, key As Keys, help As String) As MenuItemEx - Return Add(path, action, key, True, Nothing, help) - End Function - - Function Add(path As String, action As Action, key As Keys, enabledFunc As Func(Of Boolean)) As MenuItemEx - Return Add(path, action, key, True, enabledFunc) - End Function - - Function Add(path As String, action As Action, key As Keys, enabledFunc As Func(Of Boolean), help As String) As MenuItemEx - Return Add(path, action, key, True, enabledFunc, help) - End Function - - Function Add(path As String, action As Action, enabled As Boolean, help As String) As MenuItemEx - Return Add(path, action, Keys.None, enabled, Nothing, help) - End Function - - Function Add(path As String, action As Action, enabledFunc As Func(Of Boolean), help As String) As MenuItemEx - Return Add(path, action, Keys.None, True, enabledFunc, help) - End Function - - Function Add( - path As String, - action As Action, - key As Keys, - enabled As Boolean, - enabledFunc As Func(Of Boolean), - Optional help As String = Nothing, - Optional symbol As Symbol = Symbol.None) As MenuItemEx - - Dim ret = MenuItemEx.Add(Items, path, action) - - If ret Is Nothing Then - Exit Function - End If - - ret.Form = Form - ret.Enabled = enabled - ret.EnabledFunc = enabledFunc - - AddHandler Opening, AddressOf ret.Opening - - Return ret - End Function - - ''I wasn't able to find out why it's only needed in some menus - 'Sub ApplyMarginFix() - ' For Each i In GetItems.OfType(Of MenuItemEx) - ' i.ShortcutKeyDisplayString += " ".Multiply(CInt(g.DPI / 96)) - ' Next - 'End Sub - - Function GetItems() As List(Of ToolStripItem) - Dim ret As New List(Of ToolStripItem) - AddItemsRecursive(Items, ret) - Return ret - End Function - - Shared Sub AddItemsRecursive(searchList As ToolStripItemCollection, returnList As List(Of ToolStripItem)) - For Each i As ToolStripItem In searchList - returnList.Add(i) - - If TypeOf i Is ToolStripDropDownItem Then - AddItemsRecursive(DirectCast(i, ToolStripDropDownItem).DropDownItems, returnList) - End If - Next - End Sub - End Class - - Public Class MenuItemEx - Inherits ToolStripMenuItem - - Shared Property UseTooltips As Boolean - - Private Action As Action - - - Property Form As Form - - - Property EnabledFunc As Func(Of Boolean) - - - Property VisibleFunc As Func(Of Boolean) - - - Property Path As String - - Sub New() - MyBase.New() - End Sub - - Sub New(text As String) - MyBase.New(text) - End Sub - - Sub New(text As String, a As Action) - Me.New(text, a, Nothing) - End Sub - - Sub New(text As String, - action As Action, - Optional tooltip As String = Nothing, - Optional enabled As Boolean = True) - - Me.Text = text - Me.Action = action - Me.Enabled = enabled - End Sub - - Sub Opening(sender As Object, e As CancelEventArgs) - If Not EnabledFunc Is Nothing Then - Enabled = EnabledFunc.Invoke - End If - - If Not VisibleFunc Is Nothing Then - Visible = VisibleFunc.Invoke - End If - End Sub - - Shared Function Add(Of T)( - items As ToolStripItemCollection, - path As String, - action As Action(Of T), - value As T, - Optional help As String = Nothing) As MenuItemEx - - Return Add(items, path, Sub() action(value), help) - End Function - - Shared Function Add(items As ToolStripItemCollection, path As String) As MenuItemEx - Return Add(items, path, Nothing) - End Function - - Shared Function Add( - items As ToolStripItemCollection, path As String, action As Action) As MenuItemEx - - Return Add(items, path, action, Symbol.None, Nothing) - End Function - - Shared Function Add( - items As ToolStripItemCollection, - path As String, - action As Action, - tip As String) As MenuItemEx - - Return Add(items, path, action, Symbol.None, tip) - End Function - - Shared Function Add( - items As ToolStripItemCollection, - path As String, - action As Action, - symbol As Symbol, - Optional tip As String = Nothing) As MenuItemEx - - Dim a = path.Split({" | "}, StringSplitOptions.RemoveEmptyEntries) - Dim l = items - Dim p = "" - - For x = 0 To a.Length - 1 - p += If(x = 0, "", " | ") + a(x) - Dim found = False - - For Each i In l.OfType(Of ToolStripMenuItem)() - If x < a.Length - 1 Then - If i.Text = a(x) Then - found = True - l = i.DropDownItems - End If - End If - Next - - If Not found Then - If x = a.Length - 1 Then - If a(x) = "-" Then - l.Add(New ToolStripSeparator) - Else - Dim item As New MenuItemEx(a(x), action, tip) - item.Path = p - l.Add(item) - l = item.DropDownItems - Return item - End If - Else - Dim item As New MenuItemEx() - item.Text = a(x) - item.Path = p - l.Add(item) - l = item.DropDownItems - End If - End If - Next - End Function - - Overrides Function GetPreferredSize(constrainingSize As Size) As Size - Dim ret = MyBase.GetPreferredSize(constrainingSize) - ret.Height = CInt(Font.Height * 1.4) - Return ret - End Function - - Protected Overrides Sub Dispose(disposing As Boolean) - MyBase.Dispose(disposing) - Action = Nothing - EnabledFunc = Nothing - VisibleFunc = Nothing - Form = Nothing - End Sub - - Sub CloseAll(item As Object) - If TypeOf item Is ToolStripItem Then - Dim d = DirectCast(item, ToolStripItem) - CloseAll(d.Owner) - End If - - If TypeOf item Is ToolStripDropDown Then - Dim d = DirectCast(item, ToolStripDropDown) - d.Close() - CloseAll(d.OwnerItem) - End If - End Sub - - Protected Overrides Sub OnClick(e As EventArgs) - Application.DoEvents() - - If Not Action Is Nothing Then - Action() - End If - - MyBase.OnClick(e) - End Sub - End Class - End Class - - Public Class LabelEx - Inherits Label - - Sub New() - TextAlign = Drawing.ContentAlignment.MiddleLeft - 'ApplyTheme() - - 'AddHandler ThemeManager.CurrentThemeChanged, AddressOf OnThemeChanged - End Sub - - 'Sub OnThemeChanged(theme As Theme) - ' ApplyTheme(theme) - 'End Sub - - 'Sub ApplyTheme() - ' ApplyTheme(ThemeManager.CurrentTheme) - 'End Sub - - 'Sub ApplyTheme(theme As Theme) - ' If DesignHelp.IsDesignMode Then - ' Exit Sub - ' End If - - ' SuspendLayout() - ' BackColor = theme.General.Controls.Label.BackColor - ' ForeColor = theme.General.Controls.Label.ForeColor - ' ResumeLayout() - 'End Sub - - - Shadows Property Name() As String - Get - Return MyBase.Name - End Get - Set(value As String) - MyBase.Name = value - End Set - End Property - - - Shadows Property TabIndex As Integer - Get - Return MyBase.TabIndex - End Get - Set(value As Integer) - MyBase.TabIndex = value - End Set - End Property - End Class - - Public Class DesignHelp - Private Shared IsDesignModeValue As Boolean? - - Shared ReadOnly Property IsDesignMode As Boolean - Get - If Not IsDesignModeValue.HasValue Then - IsDesignModeValue = Process.GetCurrentProcess.ProcessName = "devenv" - End If - - Return IsDesignModeValue.Value - End Get - End Property - End Class - - Public Class Colors - Shared Property Link As Color = Color.RoyalBlue - Shared Property LinkHover As Color = Color.CornflowerBlue - Shared Property Window As Color = SystemColors.Control - End Class - - Sub blDetails_Click(sender As Object, e As EventArgs) Handles blDetails.Click - paMain.ScrollControlIntoView(paMain.Controls(0)) - - If blDetails.Text = "Show Details" Then - blDetails.Text = "Hide Details" - Else - Width = FontHeight * 22 - blDetails.Text = "Show Details" - End If - - paMain.PerformLayout() - AdjustSize() - AdjustSize() - End Sub - - Sub InputTextEditTextBoxKeyDown(sender As Object, e As KeyEventArgs) - If e.KeyData = Keys.Enter AndAlso Not AcceptButton Is Nothing Then - AcceptButton.PerformClick() - End If - End Sub - - ReadOnly Property IsDisposingOrDisposed As Boolean - Get - Try - Return Disposing OrElse IsDisposed - Catch - Return True - End Try - End Get - End Property -End Class diff --git a/src/mpv.net.csproj b/src/mpv.net.csproj index 972e5df..388a4ef 100644 --- a/src/mpv.net.csproj +++ b/src/mpv.net.csproj @@ -110,8 +110,11 @@ Designer MSBuild:Compile + + + @@ -146,12 +149,11 @@ MainForm.cs - + - SetupWindow.xaml @@ -231,12 +233,6 @@ Designer - - - {cfbe6e6c-b711-42bb-b5ed-487d4767fe2b} - TaskDialog - -