#49, #55, #56, version 0.9.2.25

This commit is contained in:
Markus Hofknecht 2020-05-04 19:43:47 +02:00
parent 082ce6e385
commit 40138e7f2e
25 changed files with 4038 additions and 940 deletions

View file

@ -4,6 +4,8 @@ using System.Linq;
using System.Windows.Forms;
using SystemTrayMenu.DataClasses;
using SystemTrayMenu.Helper;
using SystemTrayMenu.UserInterface;
using SystemTrayMenu.UserInterface.Controls;
using SystemTrayMenu.Utilities;
using Menu = SystemTrayMenu.UserInterface.Menu;
@ -52,15 +54,9 @@ namespace SystemTrayMenu.Handler
{
if (!string.IsNullOrEmpty(Properties.Settings.Default.HotKey))
{
KeysConverter cvt = new KeysConverter();
Keys key = (Keys)cvt.ConvertFrom(
Properties.Settings.Default.HotKey);
try
{
hook.RegisterHotKey(
KeyboardHookModifierKeys.Control |
KeyboardHookModifierKeys.Alt,
key);
hook.RegisterHotKey(Properties.Settings.Default.HotKey);
hook.KeyPressed += hook_KeyPressed;
void hook_KeyPressed(object sender, KeyPressedEventArgs e)
{
@ -69,7 +65,7 @@ namespace SystemTrayMenu.Handler
}
catch (InvalidOperationException ex)
{
Log.Error($"key:'{key}'", ex);
//Log.Error($"key:'{key}'", ex);
Properties.Settings.Default.HotKey = string.Empty;
Properties.Settings.Default.Save();
MessageBox.Show(ex.Message);
@ -204,7 +200,7 @@ namespace SystemTrayMenu.Handler
SelectMatchedReverse(dgv, dgv.Rows.Count - 1))
{
RowDeselected(iMenuBefore, iRowBefore, dgvBefore);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
break;
@ -213,7 +209,7 @@ namespace SystemTrayMenu.Handler
SelectMatched(dgv, 0))
{
RowDeselected(iMenuBefore, iRowBefore, dgvBefore);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
break;
@ -234,7 +230,7 @@ namespace SystemTrayMenu.Handler
{
RowDeselected(iMenuBefore,
iRowBefore, dgvBefore);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
@ -251,7 +247,7 @@ namespace SystemTrayMenu.Handler
SelectMatched(dgv, 0))
{
RowDeselected(iMenuBefore, iRowBefore, dgvBefore);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
@ -270,7 +266,7 @@ namespace SystemTrayMenu.Handler
SelectMatched(dgv, 0))
{
RowDeselected(iMenuBefore, iRowBefore, dgvBefore);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
}
@ -298,7 +294,7 @@ namespace SystemTrayMenu.Handler
SelectMatched(dgv, 0, keyInput))
{
RowDeselected(iMenuBefore, iRowBefore, null);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
toClear = true;
}
else if (isStillSelected)
@ -308,7 +304,7 @@ namespace SystemTrayMenu.Handler
SelectMatched(dgv, 0, keyInput))
{
RowDeselected(iMenuBefore, iRowBefore, null);
RowSelected(dgv, iRowKey);
SelectRow(dgv, iRowKey);
}
else
{
@ -322,7 +318,12 @@ namespace SystemTrayMenu.Handler
{
ClearIsSelectedByKey(iMenuBefore, iRowBefore);
}
}
private void SelectRow(DataGridView dgv, int iRowKey)
{
InUse = true;
RowSelected(dgv, iRowKey);
}
private bool SelectMatched(DataGridView dgv,

View file

@ -15,7 +15,7 @@ namespace SystemTrayMenu
{
Log.Initialize();
SingleAppInstance.Initialize();
Language.Initialize();
Translator.Initialize();
Config.UpgradeIfNotUpgraded();
if (Config.LoadOrSetByUser())

View file

@ -2,6 +2,7 @@
using System;
using System.Windows.Forms;
using SystemTrayMenu.Business;
using SystemTrayMenu.Helpers.Hotkey;
using SystemTrayMenu.UserInterface;
using SystemTrayMenu.Utilities;
@ -23,15 +24,6 @@ namespace SystemTrayMenu
menuNotifyIcon.Click += MenuNotifyIcon_Click;
void MenuNotifyIcon_Click() => menus.SwitchOpenClose(true);
menuNotifyIcon.OpenLog += Log.OpenLogFile;
menuNotifyIcon.ChangeFolder += ChangeFolder;
void ChangeFolder()
{
if (Config.SetFolderByUser())
{
AppRestart.ByConfigChange();
}
}
menus.MainPreload();
}

View file

@ -41,7 +41,7 @@ namespace SystemTrayMenu
return pathOK;
}
public static bool SetFolderByUser()
public static bool SetFolderByUser(bool save = true)
{
bool pathOK = false;
bool userAborted = false;
@ -59,7 +59,10 @@ namespace SystemTrayMenu
pathOK = true;
Properties.Settings.Default.PathDirectory =
dialog.FileName;
Properties.Settings.Default.Save();
if (save)
{
Properties.Settings.Default.Save();
}
}
}
else

View file

@ -7,8 +7,6 @@ namespace SystemTrayMenu
internal static class MenuDefines
{
internal static string NotifyIconText = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyTitleAttribute>().Title;
internal static readonly List<string> Languages =
new List<string>() { "en", "de" };
internal static readonly Color File = Color.White;
internal static readonly Color Folder = Color.White;
internal static readonly Color ColorSelectedItem = AppColors.Blue;

View file

@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using SystemTrayMenu.UserInterface.Controls;
using SystemTrayMenu.Utilities;
namespace SystemTrayMenu.Helper
@ -76,11 +77,41 @@ namespace SystemTrayMenu.Helper
RegisterHotKey(keyModifiersNone, key);
}
internal void RegisterHotKey(string hotKeyString)
{
KeyboardHookModifierKeys modifiers = KeyboardHookModifierKeys.None;
string modifiersString = Properties.Settings.Default.HotKey;
if (!string.IsNullOrEmpty(modifiersString))
{
if (modifiersString.ToLower().Contains("alt"))
{
modifiers |= KeyboardHookModifierKeys.Alt;
}
if (modifiersString.ToLower().Contains("ctrl"))
{
modifiers |= KeyboardHookModifierKeys.Control;
}
if (modifiersString.ToLower().Contains("shift"))
{
modifiers |= KeyboardHookModifierKeys.Shift;
}
if (modifiersString.ToLower().Contains("win"))
{
modifiers |= KeyboardHookModifierKeys.Win;
}
}
RegisterHotKey(modifiers,
HotkeyControl.HotkeyFromString(
Properties.Settings.Default.HotKey));
}
/// <summary>
/// Registers a hot key in the system.
/// </summary>
/// <param name="modifier">The modifiers that are associated with the hot key.</param>
/// <param name="key">The key itself that is associated with the hot key.</param>
//internal void RegisterHotKey(KeyboardHookModifierKeys modifier, Keys key)
internal void RegisterHotKey(KeyboardHookModifierKeys modifier, Keys key)
{
RegisterHotKey((uint)modifier, key);
@ -94,7 +125,7 @@ namespace SystemTrayMenu.Helper
_window.Handle, _currentId, modifier, (uint)key))
{
throw new InvalidOperationException(
Language.Translate("Could not register the hot key."));
Translator.GetText("Could not register the hot key."));
}
}
@ -145,6 +176,7 @@ namespace SystemTrayMenu.Helper
[Flags]
internal enum KeyboardHookModifierKeys : uint
{
None = 0,
Alt = 1,
Control = 2,
Shift = 4,

View file

@ -35,5 +35,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.2.24")]
[assembly: AssemblyFileVersion("0.9.2.24")]
[assembly: AssemblyVersion("0.9.2.25")]
[assembly: AssemblyFileVersion("0.9.2.25")]

View file

@ -60,15 +60,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to (e.g. F10).
/// </summary>
internal static string _e_g__F10_ {
get {
return ResourceManager.GetString("(e.g. F10)", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>
@ -78,24 +69,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Activate autostart.
/// </summary>
internal static string Activate_autostart {
get {
return ResourceManager.GetString("Activate autostart", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ALT.
/// </summary>
internal static string ALT {
get {
return ResourceManager.GetString("ALT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Autostart.
/// </summary>
@ -105,6 +78,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
internal static string buttonCancel {
get {
return ResourceManager.GetString("buttonCancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Details.
/// </summary>
@ -141,24 +123,6 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to CTRL.
/// </summary>
internal static string CTRL {
get {
return ResourceManager.GetString("CTRL", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to English.
/// </summary>
internal static string English {
get {
return ResourceManager.GetString("English", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exit.
/// </summary>
@ -195,6 +159,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to General.
/// </summary>
internal static string General {
get {
return ResourceManager.GetString("General", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Deutsch.
/// </summary>
@ -205,20 +178,11 @@ namespace SystemTrayMenu.Resources {
}
/// <summary>
/// Looks up a localized string similar to Move the NotifyIcon per DragDrop from the SystemTray into the Taskbar.
/// Looks up a localized string similar to Hotkey.
/// </summary>
internal static string HintDragDropText {
internal static string Hotkey {
get {
return ResourceManager.GetString("HintDragDropText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SystemTrayMenu - Hint.
/// </summary>
internal static string HintDragDropTitle {
get {
return ResourceManager.GetString("HintDragDropTitle", resourceCulture);
return ResourceManager.GetString("Hotkey", resourceCulture);
}
}
@ -231,6 +195,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Launch on startup.
/// </summary>
internal static string Launch_on_startup {
get {
return ResourceManager.GetString("Launch on startup", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Log File.
/// </summary>
@ -250,11 +223,11 @@ namespace SystemTrayMenu.Resources {
}
/// <summary>
/// Looks up a localized string similar to Shortcut key.
/// Looks up a localized string similar to Settings.
/// </summary>
internal static string Shortcut_key {
internal static string Settings {
get {
return ResourceManager.GetString("Shortcut key", resourceCulture);
return ResourceManager.GetString("Settings", resourceCulture);
}
}
}

View file

@ -120,9 +120,6 @@
<data name="About" xml:space="preserve">
<value>Über</value>
</data>
<data name="Activate autostart" xml:space="preserve">
<value>Autostart aktivieren</value>
</data>
<data name="buttonOk" xml:space="preserve">
<value>OK</value>
</data>
@ -138,18 +135,6 @@
<data name="Folder empty" xml:space="preserve">
<value>Ordner leer</value>
</data>
<data name="ALT" xml:space="preserve">
<value>ALT</value>
</data>
<data name="CTRL" xml:space="preserve">
<value>STRG</value>
</data>
<data name="English" xml:space="preserve">
<value>English</value>
</data>
<data name="(e.g. F10)" xml:space="preserve">
<value>(z.B. F10)</value>
</data>
<data name="buttonDetails" xml:space="preserve">
<value>Details</value>
</data>
@ -162,12 +147,6 @@
<data name="German" xml:space="preserve">
<value>Deutsch</value>
</data>
<data name="HintDragDropText" xml:space="preserve">
<value>Ziehe das Notify-Icon per DragDrop vom SystemTray in die Taskleiste</value>
</data>
<data name="HintDragDropTitle" xml:space="preserve">
<value>SystemTrayMenu - Hinweis</value>
</data>
<data name="Language" xml:space="preserve">
<value>Sprache</value>
</data>
@ -177,10 +156,22 @@
<data name="Restart" xml:space="preserve">
<value>Neustart</value>
</data>
<data name="Shortcut key" xml:space="preserve">
<value>Tastenkombination</value>
</data>
<data name="Could not register the hot key." xml:space="preserve">
<value>Der Tastenkürzel konnte nicht registriert werden.</value>
</data>
<data name="buttonCancel" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="General" xml:space="preserve">
<value>Allgemein</value>
</data>
<data name="Hotkey" xml:space="preserve">
<value>Tastenkombination</value>
</data>
<data name="Launch on startup" xml:space="preserve">
<value>Mit Windows starten</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Einstellungen</value>
</data>
</root>

View file

@ -120,18 +120,12 @@
<data name="About" xml:space="preserve">
<value>About</value>
</data>
<data name="Activate autostart" xml:space="preserve">
<value>Activate autostart</value>
</data>
<data name="buttonOk" xml:space="preserve">
<value>OK</value>
</data>
<data name="Autostart" xml:space="preserve">
<value>Autostart</value>
</data>
<data name="English" xml:space="preserve">
<value>English</value>
</data>
<data name="Exit" xml:space="preserve">
<value>Exit</value>
</data>
@ -141,15 +135,6 @@
<data name="Folder empty" xml:space="preserve">
<value>Folder empty</value>
</data>
<data name="ALT" xml:space="preserve">
<value>ALT</value>
</data>
<data name="CTRL" xml:space="preserve">
<value>CTRL</value>
</data>
<data name="(e.g. F10)" xml:space="preserve">
<value>(e.g. F10)</value>
</data>
<data name="buttonDetails" xml:space="preserve">
<value>Details</value>
</data>
@ -162,12 +147,6 @@
<data name="German" xml:space="preserve">
<value>Deutsch</value>
</data>
<data name="HintDragDropText" xml:space="preserve">
<value>Move the NotifyIcon per DragDrop from the SystemTray into the Taskbar</value>
</data>
<data name="HintDragDropTitle" xml:space="preserve">
<value>SystemTrayMenu - Hint</value>
</data>
<data name="Language" xml:space="preserve">
<value>Language</value>
</data>
@ -177,10 +156,22 @@
<data name="Restart" xml:space="preserve">
<value>Restart</value>
</data>
<data name="Shortcut key" xml:space="preserve">
<value>Shortcut key</value>
</data>
<data name="Could not register the hot key." xml:space="preserve">
<value>Couldnt register the hot key.</value>
</data>
<data name="buttonCancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="General" xml:space="preserve">
<value>General</value>
</data>
<data name="Hotkey" xml:space="preserve">
<value>Hotkey</value>
</data>
<data name="Launch on startup" xml:space="preserve">
<value>Launch on startup</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
</root>

View file

@ -117,6 +117,8 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<OutputPath>bin\x64\</OutputPath>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Clearcove.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -157,11 +159,14 @@
<Compile Include="UserInterface\AboutBox.Designer.cs">
<DependentUpon>AboutBox.cs</DependentUpon>
</Compile>
<Compile Include="UserInterface\AskHotKeyForm.cs">
<Compile Include="UserInterface\Controls\HotkeyControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UserInterface\SettingsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UserInterface\AskHotKeyForm.Designer.cs">
<DependentUpon>AskHotKeyForm.cs</DependentUpon>
<Compile Include="UserInterface\SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="DataClasses\MenuData.cs" />
<Compile Include="DataClasses\RowData.cs" />
@ -180,7 +185,7 @@
<Compile Include="Utilities\Log.cs" />
<Compile Include="Utilities\Shares.cs" />
<Compile Include="Utilities\SingleAppInstance.cs" />
<Compile Include="Utilities\Language.cs" />
<Compile Include="Utilities\Translator.cs" />
<Compile Include="Utilities\Scaling.cs" />
<Compile Include="UserInterface\ShellContextMenu\ShellContextMenuException.cs" />
<Compile Include="UserInterface\ShellContextMenu\ShellHelper.cs" />
@ -230,8 +235,8 @@
<EmbeddedResource Include="UserInterface\AboutBox.resx">
<DependentUpon>AboutBox.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserInterface\AskHotKeyForm.resx">
<DependentUpon>AskHotKeyForm.cs</DependentUpon>
<EmbeddedResource Include="UserInterface\SettingsForm.resx">
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UserInterface\Menu.resx">
<DependentUpon>Menu.cs</DependentUpon>

View file

@ -26,9 +26,9 @@ namespace SystemTrayMenu.UserInterface
public AboutBox()
{
InitializeComponent();
buttonOk.Text = Language.Translate("buttonOk");
buttonDetails.Text = Language.Translate("buttonDetails");
buttonSystemInfo.Text = Language.Translate("buttonSystemInfo");
buttonOk.Text = Translator.GetText("buttonOk");
buttonDetails.Text = Translator.GetText("buttonDetails");
buttonSystemInfo.Text = Translator.GetText("buttonSystemInfo");
}
private bool _IsPainted = false;

View file

@ -7,6 +7,8 @@ using System.Drawing.Imaging;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using SystemTrayMenu.UserInterface;
using SystemTrayMenu.Utilities;
@ -15,134 +17,85 @@ namespace SystemTrayMenu.Helper
{
internal class AppContextMenu
{
public event EventHandlerEmpty ClickedChangeFolder;
public event EventHandlerEmpty ClickedOpenLog;
public event EventHandlerEmpty ClickedRestart;
public event EventHandlerEmpty ClickedExit;
// ArrayLists used to enforce the use of proper modifiers.
// Shift+A isn't a valid hotkey, for instance, as it would screw up when the user is typing.
private readonly IList<int> _needNonShiftModifier = new List<int>();
private readonly IList<int> _needNonAltGrModifier = new List<int>();
/// <summary>
/// Populates the ArrayLists specifying disallowed hotkeys
/// such as Shift+A, Ctrl+Alt+4 (would produce a dollar sign) etc
/// </summary>
private void PopulateModifierLists()
{
// Shift + 0 - 9, A - Z
for (Keys k = Keys.D0; k <= Keys.Z; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Numpad keys
for (Keys k = Keys.NumPad0; k <= Keys.NumPad9; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Misc (,;<./ etc)
for (Keys k = Keys.Oem1; k <= Keys.OemBackslash; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Space, PgUp, PgDn, End, Home
for (Keys k = Keys.Space; k <= Keys.Home; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Misc keys that we can't loop through
_needNonShiftModifier.Add((int)Keys.Insert);
_needNonShiftModifier.Add((int)Keys.Help);
_needNonShiftModifier.Add((int)Keys.Multiply);
_needNonShiftModifier.Add((int)Keys.Add);
_needNonShiftModifier.Add((int)Keys.Subtract);
_needNonShiftModifier.Add((int)Keys.Divide);
_needNonShiftModifier.Add((int)Keys.Decimal);
_needNonShiftModifier.Add((int)Keys.Return);
_needNonShiftModifier.Add((int)Keys.Escape);
_needNonShiftModifier.Add((int)Keys.NumLock);
// Ctrl+Alt + 0 - 9
for (Keys k = Keys.D0; k <= Keys.D9; k++)
{
_needNonAltGrModifier.Add((int)k);
}
}
public ContextMenuStrip Create()
{
ContextMenuStrip menu = new ContextMenuStrip
{
BackColor = SystemColors.Control
};
ToolStripMenuItem changeFolder = new ToolStripMenuItem
ToolStripMenuItem settings = new ToolStripMenuItem()
{
Text = Language.Translate("Folder")
ImageScaling = ToolStripItemImageScaling.SizeToFit,
Text = Translator.GetText("Settings")
};
changeFolder.Click += ChangeFolder_Click;
void ChangeFolder_Click(object sender, EventArgs e)
settings.Click += Settings_Click;
void Settings_Click(object sender, EventArgs e)
{
ClickedChangeFolder.Invoke();
}
menu.Items.Add(changeFolder);
ToolStripMenuItem changeLanguage = new ToolStripMenuItem()
{
Name = "changeLanguage",
Text = Language.Translate("Language")
};
foreach (CultureInfo cultureInfo in
GetCultureList(CultureTypes.AllCultures))
{
if (MenuDefines.Languages.Contains(cultureInfo.Name))
SettingsForm settingsForm = new SettingsForm();
if (settingsForm.ShowDialog() == DialogResult.OK)
{
ToolStripItem language = changeLanguage.DropDownItems.
Add(Language.Translate(cultureInfo.EnglishName));
language.Click += Language_Click;
void Language_Click(object sender, EventArgs e)
{
string twoLetter = cultureInfo.Name.Substring(0, 2);
Properties.Settings.Default.CurrentCultureInfoName =
twoLetter;
Properties.Settings.Default.Save();
ClickedRestart.Invoke();
}
if (cultureInfo.Name == Properties.Settings.Default.
CurrentCultureInfoName)
{
language.Image = Properties.Resources.Selected;
language.ImageScaling = ToolStripItemImageScaling.None;
language.Image = ResizeImage(language.Image);
}
AppRestart.ByConfigChange();
}
}
menu.Items.Add(changeLanguage);
ToolStripMenuItem autostart = new ToolStripMenuItem
{
Text = Language.Translate("Autostart")
};
//autostart.Image.HorizontalResolution.wi.c.sc.Select .ImageScaling = ToolStripItemImageScaling.None;
if (Properties.Settings.Default.IsAutostartActivated)
{
autostart.Image = Properties.Resources.Selected;
}
else
{
autostart.Image = Properties.Resources.NotSelected;
}
autostart.ImageScaling = ToolStripItemImageScaling.None;
autostart.Image = ResizeImage(autostart.Image);
autostart.Click += Autostart_Click;
void Autostart_Click(object sender, EventArgs e)
{
if (Properties.Settings.Default.IsAutostartActivated)
{
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",
true);
key.DeleteValue("SystemTrayMenu", false);
Properties.Settings.Default.IsAutostartActivated = false;
}
else
{
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",
true);
key.SetValue(
Assembly.GetExecutingAssembly().GetName().Name,
Assembly.GetEntryAssembly().Location);
Properties.Settings.Default.IsAutostartActivated = true;
}
Properties.Settings.Default.Save();
ClickedRestart.Invoke();
}
menu.Items.Add(autostart);
ToolStripMenuItem hotKey = new ToolStripMenuItem();
string hotKeyText =
$"{Language.Translate("CTRL")} + " +
$"{Language.Translate("ALT")} + ";
hotKey.ImageScaling = ToolStripItemImageScaling.SizeToFit;
if (string.IsNullOrEmpty(Properties.Settings.Default.HotKey))
{
hotKey.Image = Properties.Resources.NotSelected;
hotKey.Text = hotKeyText + "? ";
}
else
{
hotKey.Image = Properties.Resources.Selected;
hotKey.Text = hotKeyText +
$"{Properties.Settings.Default.HotKey}";
}
hotKey.ImageScaling = ToolStripItemImageScaling.None;
hotKey.Image = ResizeImage(hotKey.Image);
hotKey.Click += HotKey_Click;
void HotKey_Click(object sender, EventArgs e)
{
AskHotKeyForm askHotKey = new AskHotKeyForm();
if (askHotKey.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.HotKey = askHotKey.NewHotKey;
Properties.Settings.Default.Save();
ClickedRestart?.Invoke();
}
}
menu.Items.Add(hotKey);
menu.Items.Add(settings);
ToolStripSeparator seperator = new ToolStripSeparator
{
@ -152,7 +105,7 @@ namespace SystemTrayMenu.Helper
ToolStripMenuItem openLog = new ToolStripMenuItem
{
Text = Language.Translate("Log File")
Text = Translator.GetText("Log File")
};
openLog.Click += OpenLog_Click;
void OpenLog_Click(object sender, EventArgs e)
@ -165,7 +118,7 @@ namespace SystemTrayMenu.Helper
ToolStripMenuItem about = new ToolStripMenuItem
{
Text = Language.Translate("About")
Text = Translator.GetText("About")
};
about.Click += About_Click;
void About_Click(object sender, EventArgs e)
@ -201,7 +154,7 @@ namespace SystemTrayMenu.Helper
ToolStripMenuItem restart = new ToolStripMenuItem
{
Text = Language.Translate("Restart")
Text = Translator.GetText("Restart")
};
restart.Click += Restart_Click;
void Restart_Click(object sender, EventArgs e)
@ -212,7 +165,7 @@ namespace SystemTrayMenu.Helper
ToolStripMenuItem exit = new ToolStripMenuItem
{
Text = Language.Translate("Exit")
Text = Translator.GetText("Exit")
};
exit.Click += Exit_Click;
void Exit_Click(object sender, EventArgs e)
@ -224,6 +177,199 @@ namespace SystemTrayMenu.Helper
return menu;
}
#warning verify if we need this
private Keys GetModfiersForHotkey(Keys hotkey)
{
PopulateModifierLists();
Keys _modifiers = Keys.None;
string Text = string.Empty;
bool bCalledProgramatically = false;
// No hotkey set
if (hotkey == Keys.None)
{
Text = "";
return Keys.None;
}
// LWin/RWin doesn't work as hotkeys (neither do they work as modifier keys in .NET 2.0)
if (hotkey == Keys.LWin || hotkey == Keys.RWin)
{
Text = "";
return Keys.None;
}
// Only validate input if it comes from the user
if (bCalledProgramatically == false)
{
// No modifier or shift only, AND a hotkey that needs another modifier
if ((_modifiers == Keys.Shift || _modifiers == Keys.None) && _needNonShiftModifier.Contains((int)hotkey))
{
if (_modifiers == Keys.None)
{
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+<key> won't work...
if (_needNonAltGrModifier.Contains((int)hotkey) == false)
{
_modifiers = Keys.Alt | Keys.Control;
}
else
{
// ... in that case, use Shift+Alt instead.
_modifiers = Keys.Alt | Keys.Shift;
}
}
else
{
// User pressed Shift and an invalid key (e.g. a letter or a number),
// that needs another set of modifier keys
hotkey = Keys.None;
Text = "";
return Keys.None;
}
}
// Check all Ctrl+Alt keys
if ((_modifiers == (Keys.Alt | Keys.Control)) && _needNonAltGrModifier.Contains((int)hotkey))
{
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
hotkey = Keys.None;
Text = "";
return Keys.None;
}
}
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
// will show up as "Control + ControlKey", etc.
if (hotkey == Keys.Menu /* Alt */ || hotkey == Keys.ShiftKey || hotkey == Keys.ControlKey)
{
hotkey = Keys.None;
}
return _modifiers;
//Text = HotkeyToLocalizedString(_modifiers, _hotkey);
}
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode);
}
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
{
StringBuilder hotkeyString = new StringBuilder();
if ((modifierKeyCode & Keys.Alt) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Alt)).Append(" + ");
}
if ((modifierKeyCode & Keys.Control) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Control)).Append(" + ");
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Shift)).Append(" + ");
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
hotkeyString.Append("Win").Append(" + ");
}
return hotkeyString.ToString();
}
private enum MapType : uint
{
MAPVK_VK_TO_VSC = 0, //The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK = 1, //The uCode parameter is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_CHAR = 2, //The uCode parameter is a virtual-key code and is translated into an unshifted character value in the low order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK_EX = 3, //The uCode parameter is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_VSC_EX = 4 //The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If the scan code is an extended scan code, the high byte of the uCode value can contain either 0xe0 or 0xe1 to specify the extended scan code. If there is no translation, the function returns 0.
}
public static string GetKeyName(Keys givenKey)
{
StringBuilder keyName = new StringBuilder();
const uint numpad = 55;
Keys virtualKey = givenKey;
string keyString;
// Make VC's to real keys
switch (virtualKey)
{
case Keys.Alt:
virtualKey = Keys.LMenu;
break;
case Keys.Control:
virtualKey = Keys.ControlKey;
break;
case Keys.Shift:
virtualKey = Keys.LShiftKey;
break;
case Keys.Multiply:
GetKeyNameText(numpad << 16, keyName, 100);
keyString = keyName.ToString().Replace("*", "").Trim().ToLower();
if (keyString.IndexOf("(", StringComparison.Ordinal) >= 0)
{
return "* " + keyString;
}
keyString = keyString.Substring(0, 1).ToUpper() + keyString.Substring(1).ToLower();
return keyString + " *";
case Keys.Divide:
GetKeyNameText(numpad << 16, keyName, 100);
keyString = keyName.ToString().Replace("*", "").Trim().ToLower();
if (keyString.IndexOf("(", StringComparison.Ordinal) >= 0)
{
return "/ " + keyString;
}
keyString = keyString.Substring(0, 1).ToUpper() + keyString.Substring(1).ToLower();
return keyString + " /";
}
uint scanCode = MapVirtualKey((uint)virtualKey, (uint)MapType.MAPVK_VK_TO_VSC);
// because MapVirtualKey strips the extended bit for some keys
switch (virtualKey)
{
case Keys.Left:
case Keys.Up:
case Keys.Right:
case Keys.Down: // arrow keys
case Keys.Prior:
case Keys.Next: // page up and page down
case Keys.End:
case Keys.Home:
case Keys.Insert:
case Keys.Delete:
case Keys.NumLock:
//Log.Debug("Modifying Extended bit");
scanCode |= 0x100; // set extended bit
break;
case Keys.PrintScreen: // PrintScreen
scanCode = 311;
break;
case Keys.Pause: // PrintScreen
scanCode = 69;
break;
}
scanCode |= 0x200;
if (GetKeyNameText(scanCode << 16, keyName, 100) != 0)
{
string visibleName = keyName.ToString();
if (visibleName.Length > 1)
{
visibleName = visibleName.Substring(0, 1) + visibleName.Substring(1).ToLower();
}
return visibleName;
}
else
{
return givenKey.ToString();
}
}
[DllImport("user32.dll", SetLastError = true)]
private static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern int GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize);
/// <summary>
/// https://www.codeproject.com/Tips/744914/
/// Sorted-list-of-available-cultures-in-NET

View file

@ -13,7 +13,6 @@ namespace SystemTrayMenu.UserInterface
internal class MenuNotifyIcon : IDisposable
{
public event EventHandlerEmpty Click;
public event EventHandlerEmpty ChangeFolder;
public event EventHandlerEmpty OpenLog;
public event EventHandlerEmpty Restart;
public event EventHandlerEmpty Exit;
@ -39,11 +38,6 @@ namespace SystemTrayMenu.UserInterface
notifyIcon.Visible = true;
notifyIcon.Icon = R.SystemTrayMenu;
AppContextMenu contextMenus = new AppContextMenu();
contextMenus.ClickedChangeFolder += ClickedChangeFolder;
void ClickedChangeFolder()
{
ChangeFolder.Invoke();
}
contextMenus.ClickedOpenLog += ClickedOpenLog;
void ClickedOpenLog()

View file

@ -1,139 +0,0 @@
namespace SystemTrayMenu.UserInterface
{
partial class AskHotKeyForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AskHotKeyForm));
this.tableLayoutPanelMain = new System.Windows.Forms.TableLayoutPanel();
this.labelText = new System.Windows.Forms.Label();
this.tableLayoutPanelBottom = new System.Windows.Forms.TableLayoutPanel();
this.buttonOk = new System.Windows.Forms.Button();
this.labelCaption = new System.Windows.Forms.Label();
this.tableLayoutPanelMain.SuspendLayout();
this.tableLayoutPanelBottom.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanelMain
//
this.tableLayoutPanelMain.AutoSize = true;
this.tableLayoutPanelMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelMain.ColumnCount = 1;
this.tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelMain.Controls.Add(this.labelText, 0, 1);
this.tableLayoutPanelMain.Controls.Add(this.tableLayoutPanelBottom, 0, 2);
this.tableLayoutPanelMain.Controls.Add(this.labelCaption, 0, 0);
this.tableLayoutPanelMain.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanelMain.Name = "tableLayoutPanelMain";
this.tableLayoutPanelMain.RowCount = 3;
this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMain.Size = new System.Drawing.Size(121, 77);
this.tableLayoutPanelMain.TabIndex = 0;
//
// labelText
//
this.labelText.AutoSize = true;
this.labelText.Location = new System.Drawing.Point(3, 21);
this.labelText.Margin = new System.Windows.Forms.Padding(3, 8, 3, 8);
this.labelText.Name = "labelText";
this.labelText.Size = new System.Drawing.Size(67, 13);
this.labelText.TabIndex = 1;
this.labelText.Text = "Ctrl + Alt + ?)";
//
// tableLayoutPanelBottom
//
this.tableLayoutPanelBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanelBottom.AutoSize = true;
this.tableLayoutPanelBottom.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelBottom.ColumnCount = 3;
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanelBottom.Controls.Add(this.buttonOk, 1, 0);
this.tableLayoutPanelBottom.Location = new System.Drawing.Point(3, 45);
this.tableLayoutPanelBottom.Name = "tableLayoutPanelBottom";
this.tableLayoutPanelBottom.RowCount = 1;
this.tableLayoutPanelBottom.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelBottom.Size = new System.Drawing.Size(115, 29);
this.tableLayoutPanelBottom.TabIndex = 1;
//
// buttonOk
//
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonOk.Location = new System.Drawing.Point(20, 3);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 2;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
//
// labelCaption
//
this.labelCaption.AutoSize = true;
this.labelCaption.Location = new System.Drawing.Point(3, 0);
this.labelCaption.MaximumSize = new System.Drawing.Size(217, 0);
this.labelCaption.Name = "labelCaption";
this.labelCaption.Size = new System.Drawing.Size(115, 13);
this.labelCaption.TabIndex = 0;
this.labelCaption.Text = "Shortcut key (e.g. F10)";
//
// AskHotKeyForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(302, 221);
this.Controls.Add(this.tableLayoutPanelMain);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AskHotKeyForm";
this.Padding = new System.Windows.Forms.Padding(0, 0, 10, 0);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AskHotKeyForm";
this.tableLayoutPanelMain.ResumeLayout(false);
this.tableLayoutPanelMain.PerformLayout();
this.tableLayoutPanelBottom.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelMain;
private System.Windows.Forms.Button buttonOk;
private System.Windows.Forms.Label labelCaption;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelBottom;
private System.Windows.Forms.Label labelText;
}
}

View file

@ -1,123 +0,0 @@
using System;
using System.Windows.Forms;
using SystemTrayMenu.Utilities;
namespace SystemTrayMenu.UserInterface
{
public partial class AskHotKeyForm : Form
{
public string NewHotKey => newHotKey;
private string newHotKey = string.Empty;
public AskHotKeyForm()
{
InitializeComponent();
Text = Language.Translate("Shortcut key");
labelCaption.Text = $"{Language.Translate("Shortcut key")} " +
$"{Language.Translate("(e.g. F10)")}";
labelText.Text =
Language.Translate("CTRL") + " + " +
Language.Translate("ALT") + " + ?";
buttonOk.Text = Language.Translate("buttonOk");
}
private void ButtonOk_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.None;
Close();
}
protected override bool ProcessCmdKey(ref Message msg, Keys keys)
{
switch (keys)
{
case Keys.Space:
case Keys.D0:
case Keys.D1:
case Keys.D2:
case Keys.D3:
case Keys.D4:
case Keys.D5:
case Keys.D6:
case Keys.D7:
case Keys.D8:
case Keys.D9:
case Keys.A:
case Keys.B:
case Keys.C:
case Keys.D:
case Keys.E:
case Keys.F:
case Keys.G:
case Keys.H:
case Keys.I:
case Keys.J:
case Keys.K:
case Keys.L:
case Keys.M:
case Keys.N:
case Keys.O:
case Keys.P:
case Keys.Q:
case Keys.R:
case Keys.S:
case Keys.T:
case Keys.U:
case Keys.V:
case Keys.W:
case Keys.X:
case Keys.Y:
case Keys.Z:
case Keys.NumPad0:
case Keys.NumPad1:
case Keys.NumPad2:
case Keys.NumPad3:
case Keys.NumPad4:
case Keys.NumPad5:
case Keys.NumPad6:
case Keys.NumPad7:
case Keys.NumPad8:
case Keys.NumPad9:
case Keys.F1:
case Keys.F2:
case Keys.F3:
case Keys.F4:
case Keys.F5:
case Keys.F6:
case Keys.F7:
case Keys.F8:
case Keys.F9:
case Keys.F10:
case Keys.F11:
case Keys.F12:
case Keys.F13:
case Keys.F14:
case Keys.F15:
case Keys.F16:
case Keys.F17:
case Keys.F18:
case Keys.F19:
case Keys.F20:
case Keys.F21:
case Keys.F22:
case Keys.F23:
case Keys.F24:
newHotKey = keys.ToString();
DialogResult = DialogResult.OK;
Close();
break;
case Keys.Back:
case Keys.Delete:
newHotKey = string.Empty;
DialogResult = DialogResult.OK;
Close();
break;
default:
break;
}
return base.ProcessCmdKey(ref msg, keys);
}
}
}

View file

@ -1,377 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAMAEBAAAAEAIABoBAAANgAAACAgAAABACAAqBAAAJ4EAAAwMAAAAQAgAKglAABGFQAAKAAAABAA
AAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAA
AAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAJAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root>

View file

@ -0,0 +1,691 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;
using SystemTrayMenu.Utilities;
namespace SystemTrayMenu.UserInterface.Controls
{
/// <summary>
/// A simple control that allows the user to select pretty much any valid hotkey combination
/// See: http://www.codeproject.com/KB/buttons/hotkeycontrol.aspx
/// But is modified to fit in Greenshot, and have localized support
/// </summary>
public sealed class HotkeyControl : TextBox
{
// Delegates for hooking up events.
public delegate void HotKeyHandler();
private static readonly EventDelay EventDelay = new EventDelay(TimeSpan.FromMilliseconds(600).Ticks);
private static readonly bool IsWindows7OrOlder = Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1;
// Holds the list of hotkeys
private static readonly IDictionary<int, HotKeyHandler> KeyHandlers = new Dictionary<int, HotKeyHandler>();
private static int _hotKeyCounter = 1;
private const uint WM_HOTKEY = 0x312;
private static IntPtr _hotkeyHwnd;
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Modifiers : uint
{
NONE = 0,
ALT = 1,
CTRL = 2,
SHIFT = 4,
WIN = 8,
NO_REPEAT = 0x4000
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum MapType : uint
{
MAPVK_VK_TO_VSC = 0, //The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK = 1, //The uCode parameter is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_CHAR = 2, //The uCode parameter is a virtual-key code and is translated into an unshifted character value in the low order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK_EX = 3, //The uCode parameter is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_VSC_EX = 4 //The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If the scan code is an extended scan code, the high byte of the uCode value can contain either 0xe0 or 0xe1 to specify the extended scan code. If there is no translation, the function returns 0.
}
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint virtualKeyCode);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll", SetLastError = true)]
private static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern int GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize);
// These variables store the current hotkey and modifier(s)
private Keys _hotkey = Keys.None;
private Keys _modifiers = Keys.None;
// ArrayLists used to enforce the use of proper modifiers.
// Shift+A isn't a valid hotkey, for instance, as it would screw up when the user is typing.
private readonly IList<int> _needNonShiftModifier = new List<int>();
private readonly IList<int> _needNonAltGrModifier = new List<int>();
private readonly ContextMenu _dummy = new ContextMenu();
/// <summary>
/// Used to make sure that there is no right-click menu available
/// </summary>
public override ContextMenu ContextMenu
{
get
{
return _dummy;
}
set
{
base.ContextMenu = _dummy;
}
}
/// <summary>
/// Forces the control to be non-multiline
/// </summary>
public override bool Multiline
{
get
{
return base.Multiline;
}
set
{
// Ignore what the user wants; force Multiline to false
base.Multiline = false;
}
}
/// <summary>
/// Creates a new HotkeyControl
/// </summary>
public HotkeyControl()
{
ContextMenu = _dummy; // Disable right-clicking
Text = "None";
// Handle events that occurs when keys are pressed
KeyPress += HotkeyControl_KeyPress;
KeyUp += HotkeyControl_KeyUp;
KeyDown += HotkeyControl_KeyDown;
PopulateModifierLists();
}
/// <summary>
/// Populates the ArrayLists specifying disallowed hotkeys
/// such as Shift+A, Ctrl+Alt+4 (would produce a dollar sign) etc
/// </summary>
private void PopulateModifierLists()
{
// Shift + 0 - 9, A - Z
for (Keys k = Keys.D0; k <= Keys.Z; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Numpad keys
for (Keys k = Keys.NumPad0; k <= Keys.NumPad9; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Misc (,;<./ etc)
for (Keys k = Keys.Oem1; k <= Keys.OemBackslash; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Shift + Space, PgUp, PgDn, End, Home
for (Keys k = Keys.Space; k <= Keys.Home; k++)
{
_needNonShiftModifier.Add((int)k);
}
// Misc keys that we can't loop through
_needNonShiftModifier.Add((int)Keys.Insert);
_needNonShiftModifier.Add((int)Keys.Help);
_needNonShiftModifier.Add((int)Keys.Multiply);
_needNonShiftModifier.Add((int)Keys.Add);
_needNonShiftModifier.Add((int)Keys.Subtract);
_needNonShiftModifier.Add((int)Keys.Divide);
_needNonShiftModifier.Add((int)Keys.Decimal);
_needNonShiftModifier.Add((int)Keys.Return);
_needNonShiftModifier.Add((int)Keys.Escape);
_needNonShiftModifier.Add((int)Keys.NumLock);
// Ctrl+Alt + 0 - 9
for (Keys k = Keys.D0; k <= Keys.D9; k++)
{
_needNonAltGrModifier.Add((int)k);
}
}
/// <summary>
/// Resets this hotkey control to None
/// </summary>
public new void Clear()
{
Hotkey = Keys.None;
HotkeyModifiers = Keys.None;
}
/// <summary>
/// Fires when a key is pushed down. Here, we'll want to update the text in the box
/// to notify the user what combination is currently pressed.
/// </summary>
private void HotkeyControl_KeyDown(object sender, KeyEventArgs e)
{
// Clear the current hotkey
if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete)
{
ResetHotkey();
}
else
{
_modifiers = e.Modifiers;
_hotkey = e.KeyCode;
Redraw();
}
}
/// <summary>
/// Fires when all keys are released. If the current hotkey isn't valid, reset it.
/// Otherwise, do nothing and keep the text and hotkey as it was.
/// </summary>
private void HotkeyControl_KeyUp(object sender, KeyEventArgs e)
{
// Somehow the PrintScreen only comes as a keyup, therefore we handle it here.
if (e.KeyCode == Keys.PrintScreen)
{
_modifiers = e.Modifiers;
_hotkey = e.KeyCode;
Redraw();
}
if (_hotkey == Keys.None && ModifierKeys == Keys.None)
{
ResetHotkey();
}
}
/// <summary>
/// Prevents the letter/whatever entered to show up in the TextBox
/// Without this, a "A" key press would appear as "aControl, Alt + A"
/// </summary>
private void HotkeyControl_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
/// <summary>
/// Handles some misc keys, such as Ctrl+Delete and Shift+Insert
/// </summary>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Delete || keyData == (Keys.Control | Keys.Delete))
{
ResetHotkey();
return true;
}
// Paste
if (keyData == (Keys.Shift | Keys.Insert))
{
return true; // Don't allow
}
// Allow the rest
return base.ProcessCmdKey(ref msg, keyData);
}
/// <summary>
/// Clears the current hotkey and resets the TextBox
/// </summary>
public void ResetHotkey()
{
_hotkey = Keys.None;
_modifiers = Keys.None;
Redraw();
}
/// <summary>
/// Used to get/set the hotkey (e.g. Keys.A)
/// </summary>
public Keys Hotkey
{
get
{
return _hotkey;
}
set
{
_hotkey = value;
Redraw(true);
}
}
/// <summary>
/// Used to get/set the hotkey (e.g. Keys.A)
/// </summary>
public void SetHotkey(string hotkey)
{
_hotkey = HotkeyFromString(hotkey);
_modifiers = HotkeyModifiersFromString(hotkey);
Redraw(true);
}
/// <summary>
/// Used to get/set the modifier keys (e.g. Keys.Alt | Keys.Control)
/// </summary>
public Keys HotkeyModifiers
{
get
{
return _modifiers;
}
set
{
_modifiers = value;
Redraw(true);
}
}
/// <summary>
/// Redraws the TextBox when necessary.
/// </summary>
/// <param name="bCalledProgramatically">Specifies whether this function was called by the Hotkey/HotkeyModifiers properties or by the user.</param>
private void Redraw(bool bCalledProgramatically = false)
{
// No hotkey set
if (_hotkey == Keys.None)
{
Text = "";
return;
}
// LWin/RWin doesn't work as hotkeys (neither do they work as modifier keys in .NET 2.0)
if (_hotkey == Keys.LWin || _hotkey == Keys.RWin)
{
Text = "";
return;
}
// Only validate input if it comes from the user
if (bCalledProgramatically == false)
{
// No modifier or shift only, AND a hotkey that needs another modifier
if ((_modifiers == Keys.Shift || _modifiers == Keys.None) && _needNonShiftModifier.Contains((int)_hotkey))
{
if (_modifiers == Keys.None)
{
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+<key> won't work...
if (_needNonAltGrModifier.Contains((int)_hotkey) == false)
{
_modifiers = Keys.Alt | Keys.Control;
}
else
{
// ... in that case, use Shift+Alt instead.
_modifiers = Keys.Alt | Keys.Shift;
}
}
else
{
// User pressed Shift and an invalid key (e.g. a letter or a number),
// that needs another set of modifier keys
_hotkey = Keys.None;
Text = "";
return;
}
}
// Check all Ctrl+Alt keys
if ((_modifiers == (Keys.Alt | Keys.Control)) && _needNonAltGrModifier.Contains((int)_hotkey))
{
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
_hotkey = Keys.None;
Text = "";
return;
}
}
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
// will show up as "Control + ControlKey", etc.
if (_hotkey == Keys.Menu /* Alt */ || _hotkey == Keys.ShiftKey || _hotkey == Keys.ControlKey)
{
_hotkey = Keys.None;
}
Text = HotkeyToLocalizedString(_modifiers, _hotkey);
}
public override string ToString()
{
return HotkeyToString(HotkeyModifiers, Hotkey);
}
public static string GetLocalizedHotkeyStringFromString(string hotkeyString)
{
Keys virtualKeyCode = HotkeyFromString(hotkeyString);
Keys modifiers = HotkeyModifiersFromString(hotkeyString);
return HotkeyToLocalizedString(modifiers, virtualKeyCode);
}
public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToString(modifierKeyCode) + virtualKeyCode;
}
public static string HotkeyModifiersToString(Keys modifierKeyCode)
{
StringBuilder hotkeyString = new StringBuilder();
if ((modifierKeyCode & Keys.Alt) > 0)
{
hotkeyString.Append("Alt").Append(" + ");
}
if ((modifierKeyCode & Keys.Control) > 0)
{
hotkeyString.Append("Ctrl").Append(" + ");
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
hotkeyString.Append("Shift").Append(" + ");
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
hotkeyString.Append("Win").Append(" + ");
}
return hotkeyString.ToString();
}
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode);
}
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
{
StringBuilder hotkeyString = new StringBuilder();
if ((modifierKeyCode & Keys.Alt) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Alt)).Append(" + ");
}
if ((modifierKeyCode & Keys.Control) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Control)).Append(" + ");
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Shift)).Append(" + ");
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
hotkeyString.Append("Win").Append(" + ");
}
return hotkeyString.ToString();
}
public static Keys HotkeyModifiersFromString(string modifiersString)
{
Keys modifiers = Keys.None;
if (!string.IsNullOrEmpty(modifiersString))
{
if (modifiersString.ToLower().Contains("alt"))
{
modifiers |= Keys.Alt;
}
if (modifiersString.ToLower().Contains("ctrl"))
{
modifiers |= Keys.Control;
}
if (modifiersString.ToLower().Contains("shift"))
{
modifiers |= Keys.Shift;
}
if (modifiersString.ToLower().Contains("win"))
{
modifiers |= Keys.LWin;
}
}
return modifiers;
}
public static Keys HotkeyFromString(string hotkey)
{
Keys key = Keys.None;
if (!string.IsNullOrEmpty(hotkey))
{
if (hotkey.LastIndexOf('+') > 0)
{
hotkey = hotkey.Remove(0, hotkey.LastIndexOf('+') + 1).Trim();
}
key = (Keys)Enum.Parse(typeof(Keys), hotkey);
}
return key;
}
public static void RegisterHotkeyHwnd(IntPtr hWnd)
{
_hotkeyHwnd = hWnd;
}
public static int RegisterHotKey(string hotkey, HotKeyHandler handler)
{
return RegisterHotKey(HotkeyModifiersFromString(hotkey), HotkeyFromString(hotkey), handler);
}
/// <summary>
/// Register a hotkey
/// </summary>
/// <param name="modifierKeyCode">The modifier, e.g.: Modifiers.CTRL, Modifiers.NONE or Modifiers.ALT</param>
/// <param name="virtualKeyCode">The virtual key code</param>
/// <param name="handler">A HotKeyHandler, this will be called to handle the hotkey press</param>
/// <returns>the hotkey number, -1 if failed</returns>
public static int RegisterHotKey(Keys modifierKeyCode, Keys virtualKeyCode, HotKeyHandler handler)
{
if (virtualKeyCode == Keys.None)
{
Log.Info("Trying to register a Keys.none hotkey, ignoring");
return 0;
}
// Convert Modifiers to fit HKM_SETHOTKEY
uint modifiers = 0;
if ((modifierKeyCode & Keys.Alt) > 0)
{
modifiers |= (uint)Modifiers.ALT;
}
if ((modifierKeyCode & Keys.Control) > 0)
{
modifiers |= (uint)Modifiers.CTRL;
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
modifiers |= (uint)Modifiers.SHIFT;
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
modifiers |= (uint)Modifiers.WIN;
}
// Disable repeating hotkey for Windows 7 and beyond, as described in #1559
if (IsWindows7OrOlder)
{
modifiers |= (uint)Modifiers.NO_REPEAT;
}
if (RegisterHotKey(_hotkeyHwnd, _hotKeyCounter, modifiers, (uint)virtualKeyCode))
{
KeyHandlers.Add(_hotKeyCounter, handler);
return _hotKeyCounter++;
}
else
{
Log.Info($"Couldn't register hotkey modifier {modifierKeyCode} virtualKeyCode {virtualKeyCode}");
return -1;
}
}
public static void UnregisterHotkeys()
{
foreach (int hotkey in KeyHandlers.Keys)
{
UnregisterHotKey(_hotkeyHwnd, hotkey);
}
// Remove all key handlers
KeyHandlers.Clear();
}
public static void UnregisterHotkey(int hotkey)
{
bool removeHotkey = false;
foreach (int availableHotkey in KeyHandlers.Keys)
{
if (availableHotkey == hotkey)
{
UnregisterHotKey(_hotkeyHwnd, hotkey);
removeHotkey = true;
}
}
if (removeHotkey)
{
// Remove key handler
KeyHandlers.Remove(hotkey);
}
}
/// <summary>
/// Handle WndProc messages for the hotkey
/// </summary>
/// <param name="m"></param>
/// <returns>true if the message was handled</returns>
public static bool HandleMessages(ref Message m)
{
if (m.Msg != WM_HOTKEY)
{
return false;
}
// Call handler
if (!IsWindows7OrOlder && !EventDelay.Check())
{
return true;
}
HotKeyHandler handler;
if (KeyHandlers.TryGetValue((int)m.WParam, out handler))
{
handler();
}
return true;
}
public static string GetKeyName(Keys givenKey)
{
StringBuilder keyName = new StringBuilder();
const uint numpad = 55;
Keys virtualKey = givenKey;
string keyString;
// Make VC's to real keys
switch (virtualKey)
{
case Keys.Alt:
virtualKey = Keys.LMenu;
break;
case Keys.Control:
virtualKey = Keys.ControlKey;
break;
case Keys.Shift:
virtualKey = Keys.LShiftKey;
break;
case Keys.Multiply:
GetKeyNameText(numpad << 16, keyName, 100);
keyString = keyName.ToString().Replace("*", "").Trim().ToLower();
if (keyString.IndexOf("(", StringComparison.Ordinal) >= 0)
{
return "* " + keyString;
}
keyString = keyString.Substring(0, 1).ToUpper() + keyString.Substring(1).ToLower();
return keyString + " *";
case Keys.Divide:
GetKeyNameText(numpad << 16, keyName, 100);
keyString = keyName.ToString().Replace("*", "").Trim().ToLower();
if (keyString.IndexOf("(", StringComparison.Ordinal) >= 0)
{
return "/ " + keyString;
}
keyString = keyString.Substring(0, 1).ToUpper() + keyString.Substring(1).ToLower();
return keyString + " /";
}
uint scanCode = MapVirtualKey((uint)virtualKey, (uint)MapType.MAPVK_VK_TO_VSC);
// because MapVirtualKey strips the extended bit for some keys
switch (virtualKey)
{
case Keys.Left:
case Keys.Up:
case Keys.Right:
case Keys.Down: // arrow keys
case Keys.Prior:
case Keys.Next: // page up and page down
case Keys.End:
case Keys.Home:
case Keys.Insert:
case Keys.Delete:
case Keys.NumLock:
//Log.Debug("Modifying Extended bit");
scanCode |= 0x100; // set extended bit
break;
case Keys.PrintScreen: // PrintScreen
scanCode = 311;
break;
case Keys.Pause: // PrintScreen
scanCode = 69;
break;
}
scanCode |= 0x200;
if (GetKeyNameText(scanCode << 16, keyName, 100) != 0)
{
string visibleName = keyName.ToString();
if (visibleName.Length > 1)
{
visibleName = visibleName.Substring(0, 1) + visibleName.Substring(1).ToLower();
}
return visibleName;
}
else
{
return givenKey.ToString();
}
}
}
public class EventDelay
{
private long lastCheck;
private readonly long waitTime;
public EventDelay(long ticks)
{
waitTime = ticks;
}
public bool Check()
{
lock (this)
{
long now = DateTime.Now.Ticks;
bool isPassed = now - lastCheck > waitTime;
lastCheck = now;
return isPassed;
}
}
}
}

View file

@ -141,11 +141,11 @@ namespace SystemTrayMenu.UserInterface
}
break;
case MenuType.Empty:
SetTitle(Language.Translate("Folder empty"));
SetTitle(Translator.GetText("Folder empty"));
labelTitle.BackColor = MenuDefines.ColorTitleWarning;
break;
case MenuType.NoAccess:
SetTitle(Language.Translate("Folder inaccessible"));
SetTitle(Translator.GetText("Folder inaccessible"));
labelTitle.BackColor = MenuDefines.ColorTitleWarning;
break;
case MenuType.MaxReached:

413
UserInterface/SettingsForm.Designer.cs generated Normal file
View file

@ -0,0 +1,413 @@
using SystemTrayMenu.UserInterface.Controls;
namespace SystemTrayMenu.UserInterface
{
partial class SettingsForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
this.tableLayoutPanelMain = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPageGeneral = new System.Windows.Forms.TabPage();
this.tableLayoutPanelGeneral = new System.Windows.Forms.TableLayoutPanel();
this.comboBoxLanguage = new System.Windows.Forms.ComboBox();
this.labelLanguage = new System.Windows.Forms.Label();
this.checkBoxAutostart = new System.Windows.Forms.CheckBox();
this.labelHotkey = new System.Windows.Forms.Label();
this.labelAutostart = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.buttonChange = new System.Windows.Forms.Button();
this.textBoxFolder = new System.Windows.Forms.TextBox();
this.labelFolder = new System.Windows.Forms.Label();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanelBottom = new System.Windows.Forms.TableLayoutPanel();
this.buttonOk = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.textBoxHotkey = new HotkeyControl();
this.tableLayoutPanelMain.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
this.tableLayoutPanelGeneral.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.tableLayoutPanelBottom.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanelMain
//
this.tableLayoutPanelMain.AutoSize = true;
this.tableLayoutPanelMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelMain.ColumnCount = 1;
this.tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelMain.Controls.Add(this.tabControl1, 0, 0);
this.tableLayoutPanelMain.Controls.Add(this.tableLayoutPanelBottom, 0, 1);
this.tableLayoutPanelMain.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanelMain.Name = "tableLayoutPanelMain";
this.tableLayoutPanelMain.RowCount = 2;
this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelMain.Size = new System.Drawing.Size(401, 246);
this.tableLayoutPanelMain.TabIndex = 0;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPageGeneral);
this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(395, 211);
this.tabControl1.TabIndex = 1;
//
// tabPageGeneral
//
this.tabPageGeneral.Controls.Add(this.tableLayoutPanelGeneral);
this.tabPageGeneral.Controls.Add(this.tableLayoutPanel5);
this.tabPageGeneral.Location = new System.Drawing.Point(4, 22);
this.tabPageGeneral.Name = "tabPageGeneral";
this.tabPageGeneral.Padding = new System.Windows.Forms.Padding(3);
this.tabPageGeneral.Size = new System.Drawing.Size(387, 185);
this.tabPageGeneral.TabIndex = 0;
this.tabPageGeneral.Text = "tabPageGeneral";
this.tabPageGeneral.UseVisualStyleBackColor = true;
//
// tableLayoutPanelGeneral
//
this.tableLayoutPanelGeneral.AutoSize = true;
this.tableLayoutPanelGeneral.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelGeneral.ColumnCount = 2;
this.tableLayoutPanelGeneral.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelGeneral.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelGeneral.Controls.Add(this.comboBoxLanguage, 1, 3);
this.tableLayoutPanelGeneral.Controls.Add(this.labelLanguage, 0, 3);
this.tableLayoutPanelGeneral.Controls.Add(this.textBoxHotkey, 1, 2);
this.tableLayoutPanelGeneral.Controls.Add(this.checkBoxAutostart, 1, 1);
this.tableLayoutPanelGeneral.Controls.Add(this.labelHotkey, 0, 2);
this.tableLayoutPanelGeneral.Controls.Add(this.labelAutostart, 0, 1);
this.tableLayoutPanelGeneral.Controls.Add(this.tableLayoutPanel1, 1, 0);
this.tableLayoutPanelGeneral.Controls.Add(this.labelFolder, 0, 0);
this.tableLayoutPanelGeneral.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanelGeneral.Name = "tableLayoutPanelGeneral";
this.tableLayoutPanelGeneral.RowCount = 4;
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.Size = new System.Drawing.Size(301, 102);
this.tableLayoutPanelGeneral.TabIndex = 1;
//
// comboBoxLanguage
//
this.comboBoxLanguage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxLanguage.FormattingEnabled = true;
this.comboBoxLanguage.Location = new System.Drawing.Point(92, 81);
this.comboBoxLanguage.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0);
this.comboBoxLanguage.Name = "comboBoxLanguage";
this.comboBoxLanguage.Size = new System.Drawing.Size(200, 21);
this.comboBoxLanguage.TabIndex = 1;
//
// labelLanguage
//
this.labelLanguage.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelLanguage.AutoSize = true;
this.labelLanguage.Location = new System.Drawing.Point(3, 81);
this.labelLanguage.Name = "labelLanguage";
this.labelLanguage.Size = new System.Drawing.Size(77, 13);
this.labelLanguage.TabIndex = 2;
this.labelLanguage.Text = "labelLanguage";
//
// checkBoxAutostart
//
this.checkBoxAutostart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.checkBoxAutostart.AutoSize = true;
this.checkBoxAutostart.Location = new System.Drawing.Point(92, 30);
this.checkBoxAutostart.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0);
this.checkBoxAutostart.Name = "checkBoxAutostart";
this.checkBoxAutostart.Size = new System.Drawing.Size(200, 17);
this.checkBoxAutostart.TabIndex = 0;
this.checkBoxAutostart.Text = "checkBoxAutostart";
this.checkBoxAutostart.UseVisualStyleBackColor = true;
//
// labelHotkey
//
this.labelHotkey.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelHotkey.AutoSize = true;
this.labelHotkey.Location = new System.Drawing.Point(3, 54);
this.labelHotkey.Name = "labelHotkey";
this.labelHotkey.Size = new System.Drawing.Size(63, 13);
this.labelHotkey.TabIndex = 1;
this.labelHotkey.Text = "labelHotkey";
//
// labelAutostart
//
this.labelAutostart.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelAutostart.AutoSize = true;
this.labelAutostart.Location = new System.Drawing.Point(3, 28);
this.labelAutostart.Name = "labelAutostart";
this.labelAutostart.Size = new System.Drawing.Size(71, 13);
this.labelAutostart.TabIndex = 2;
this.labelAutostart.Text = "labelAutostart";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.buttonChange, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.textBoxFolder, 1, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(83, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(212, 23);
this.tableLayoutPanel1.TabIndex = 7;
//
// buttonChange
//
this.buttonChange.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.buttonChange.Location = new System.Drawing.Point(176, 3);
this.buttonChange.Margin = new System.Windows.Forms.Padding(3, 3, 9, 0);
this.buttonChange.Name = "buttonChange";
this.buttonChange.Size = new System.Drawing.Size(27, 20);
this.buttonChange.TabIndex = 6;
this.buttonChange.Text = "...";
this.buttonChange.UseVisualStyleBackColor = true;
this.buttonChange.Click += new System.EventHandler(this.buttonChange_Click);
//
// textBoxFolder
//
this.textBoxFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBoxFolder.BackColor = System.Drawing.Color.White;
this.textBoxFolder.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxFolder.Location = new System.Drawing.Point(9, 6);
this.textBoxFolder.Margin = new System.Windows.Forms.Padding(9, 3, 9, 0);
this.textBoxFolder.Name = "textBoxFolder";
this.textBoxFolder.ReadOnly = true;
this.textBoxFolder.Size = new System.Drawing.Size(155, 13);
this.textBoxFolder.TabIndex = 5;
//
// labelFolder
//
this.labelFolder.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelFolder.AutoSize = true;
this.labelFolder.Location = new System.Drawing.Point(3, 5);
this.labelFolder.Name = "labelFolder";
this.labelFolder.Size = new System.Drawing.Size(58, 13);
this.labelFolder.TabIndex = 7;
this.labelFolder.Text = "labelFolder";
//
// tableLayoutPanel5
//
this.tableLayoutPanel5.AutoSize = true;
this.tableLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel5.ColumnCount = 1;
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.Controls.Add(this.tableLayoutPanel3, 0, 3);
this.tableLayoutPanel5.Controls.Add(this.tableLayoutPanel4, 0, 1);
this.tableLayoutPanel5.Controls.Add(this.tableLayoutPanel2, 0, 2);
this.tableLayoutPanel5.Location = new System.Drawing.Point(6, 6);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.RowCount = 4;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel5.Size = new System.Drawing.Size(100, 0);
this.tableLayoutPanel5.TabIndex = 8;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel3.AutoSize = true;
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.ColumnCount = 2;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(100, 0);
this.tableLayoutPanel3.TabIndex = 0;
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.tableLayoutPanel4.AutoSize = true;
this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel4.ColumnCount = 2;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(100, 0);
this.tableLayoutPanel4.TabIndex = 0;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel2.AutoSize = true;
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(100, 0);
this.tableLayoutPanel2.TabIndex = 0;
//
// tableLayoutPanelBottom
//
this.tableLayoutPanelBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanelBottom.AutoSize = true;
this.tableLayoutPanelBottom.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelBottom.ColumnCount = 3;
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelBottom.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelBottom.Controls.Add(this.buttonOk, 1, 0);
this.tableLayoutPanelBottom.Controls.Add(this.buttonCancel, 2, 0);
this.tableLayoutPanelBottom.Location = new System.Drawing.Point(3, 220);
this.tableLayoutPanelBottom.Name = "tableLayoutPanelBottom";
this.tableLayoutPanelBottom.RowCount = 1;
this.tableLayoutPanelBottom.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelBottom.Size = new System.Drawing.Size(395, 23);
this.tableLayoutPanelBottom.TabIndex = 1;
//
// buttonOk
//
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOk.Location = new System.Drawing.Point(236, 0);
this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(75, 23);
this.buttonOk.TabIndex = 2;
this.buttonOk.Text = "OK";
this.buttonOk.UseVisualStyleBackColor = true;
this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(317, 0);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// textBoxHotkey
//
this.textBoxHotkey.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBoxHotkey.Hotkey = System.Windows.Forms.Keys.None;
this.textBoxHotkey.HotkeyModifiers = System.Windows.Forms.Keys.None;
this.textBoxHotkey.Location = new System.Drawing.Point(92, 54);
this.textBoxHotkey.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0);
this.textBoxHotkey.Name = "textBoxHotkey";
this.textBoxHotkey.Size = new System.Drawing.Size(200, 20);
this.textBoxHotkey.TabIndex = 0;
this.textBoxHotkey.Text = "None";
this.textBoxHotkey.Enter += new System.EventHandler(this.textBoxHotkey_Enter);
this.textBoxHotkey.Leave += new System.EventHandler(this.textBoxHotkey_Leave);
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(795, 460);
this.Controls.Add(this.tableLayoutPanelMain);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SettingsForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SettingsForm";
this.Load += new System.EventHandler(this.SettingsForm_Load);
this.tableLayoutPanelMain.ResumeLayout(false);
this.tableLayoutPanelMain.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.tabPageGeneral.ResumeLayout(false);
this.tabPageGeneral.PerformLayout();
this.tableLayoutPanelGeneral.ResumeLayout(false);
this.tableLayoutPanelGeneral.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel5.ResumeLayout(false);
this.tableLayoutPanel5.PerformLayout();
this.tableLayoutPanelBottom.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelMain;
private System.Windows.Forms.Button buttonOk;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelBottom;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPageGeneral;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.ComboBox comboBoxLanguage;
//private System.Windows.Forms.TextBox textBoxHotkey;
private HotkeyControl textBoxHotkey;
private System.Windows.Forms.TextBox textBoxFolder;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.CheckBox checkBoxAutostart;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Button buttonChange;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
private System.Windows.Forms.Label labelFolder;
private System.Windows.Forms.Label labelLanguage;
private System.Windows.Forms.Label labelAutostart;
private System.Windows.Forms.Label labelHotkey;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelGeneral;
}
}

View file

@ -0,0 +1,372 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using SystemTrayMenu.UserInterface.Controls;
using SystemTrayMenu.Utilities;
using static SystemTrayMenu.UserInterface.Controls.HotkeyControl;
namespace SystemTrayMenu.UserInterface
{
public partial class SettingsForm : Form
{
public string NewHotKey => newHotKey;
private string newHotKey = string.Empty;
private bool _inHotkey = false;
public SettingsForm()
{
InitializeComponent();
Translate();
void Translate()
{
Text = Translator.GetText("Settings");
tabPageGeneral.Text = Translator.GetText("General");
labelFolder.Text = Translator.GetText("Folder");
labelAutostart.Text = Translator.GetText("Autostart");
checkBoxAutostart.Text = Translator.GetText("Launch on startup");
labelHotkey.Text = Translator.GetText("Hotkey");
labelLanguage.Text = Translator.GetText("Language");
buttonOk.Text = Translator.GetText("buttonOk");
buttonCancel.Text = Translator.GetText("buttonCancel");
}
InitializeFolder();
void InitializeFolder()
{
textBoxFolder.Text = Config.Path;
}
InitializeAutostart();
void InitializeAutostart()
{
checkBoxAutostart.Checked =
Properties.Settings.Default.IsAutostartActivated;
}
InitializeHotkey();
void InitializeHotkey()
{
textBoxHotkey.SetHotkey(Properties.Settings.Default.HotKey);
//textBoxHotkey.Text = Properties.Settings.Default.HotKey;
}
InitializeLanguage();
void InitializeLanguage()
{
var dataSource = new List<Language>();
dataSource.Add(new Language() { Name = "English", Value = "en" });
dataSource.Add(new Language() { Name = "Deutsch", Value = "de" });
comboBoxLanguage.DataSource = dataSource;
comboBoxLanguage.DisplayMember = "Name";
comboBoxLanguage.ValueMember = "Value";
comboBoxLanguage.SelectedValue =
Properties.Settings.Default.CurrentCultureInfoName;
if (comboBoxLanguage.SelectedValue == null)
{
comboBoxLanguage.SelectedValue = "en";
}
}
}
private void SettingsForm_Load(object sender, EventArgs e)
{
tabControl1.Size = new Size(
tableLayoutPanelGeneral.Size.Width + 10,
tableLayoutPanelGeneral.Size.Height + 40);
}
private void ButtonOk_Click(object sender, EventArgs e)
{
SetAutostart();
SetHotkey();
SetLanguage();
Properties.Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();
}
private void SetAutostart()
{
if (checkBoxAutostart.Checked)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
key.SetValue(Assembly.GetExecutingAssembly().GetName().Name,
Assembly.GetEntryAssembly().Location);
Properties.Settings.Default.IsAutostartActivated = true;
}
else
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
key.DeleteValue("SystemTrayMenu", false);
Properties.Settings.Default.IsAutostartActivated = false;
}
}
private void SetHotkey()
{
Properties.Settings.Default.HotKey =
new KeysConverter().ConvertToInvariantString(
textBoxHotkey.Hotkey | textBoxHotkey.HotkeyModifiers);
//Keys keys1 = HotkeyControl.Hotkey;
// Hotkey
// Keys keys = HotkeyControl.ModifierKeys;
//Keys keys2 = HotkeyControl.HotkeyToString(keys, keys);
}
private void SetLanguage()
{
Properties.Settings.Default.CurrentCultureInfoName =
comboBoxLanguage.SelectedValue.ToString();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reload();
DialogResult = DialogResult.Cancel;
Close();
}
private void buttonChange_Click(object sender, EventArgs e)
{
Config.SetFolderByUser(false);
textBoxFolder.Text = Config.Path;
}
private void textBoxHotkey_Enter(object sender, EventArgs e)
{
HotkeyControl.UnregisterHotkeys();
_inHotkey = true;
}
private void textBoxHotkey_Leave(object sender, EventArgs e)
{
Properties.Settings.Default.HotKey =
new KeysConverter().ConvertToInvariantString(
textBoxHotkey.Hotkey | textBoxHotkey.HotkeyModifiers);
RegisterHotkeys();
//MainForm.RegisterHotkeys();
_inHotkey = false;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Escape:
if (!_inHotkey)
{
DialogResult = DialogResult.Cancel;
}
else
{
return base.ProcessCmdKey(ref msg, keyData);
}
break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}
return true;
}
#region hotkeys
/// <summary>
/// Helper method to cleanly register a hotkey
/// </summary>
/// <param name="failedKeys"></param>
/// <param name="functionName"></param>
/// <param name="hotkeyString"></param>
/// <param name="handler"></param>
/// <returns></returns>
private static bool RegisterHotkey(StringBuilder failedKeys, string hotkeyString, HotKeyHandler handler)
{
Keys modifierKeyCode = HotkeyControl.HotkeyModifiersFromString(hotkeyString);
Keys virtualKeyCode = HotkeyControl.HotkeyFromString(hotkeyString);
if (!Keys.None.Equals(virtualKeyCode))
{
if (HotkeyControl.RegisterHotKey(modifierKeyCode, virtualKeyCode, handler) < 0)
{
#warning logging
//LOG.DebugFormat("Failed to register {0} to hotkey: {1}", functionName, hotkeyString);
if (failedKeys.Length > 0)
{
failedKeys.Append(", ");
}
failedKeys.Append(hotkeyString);
return false;
}
#warning logging
//LOG.DebugFormat("Registered {0} to hotkey: {1}", functionName, hotkeyString);
}
else
{
#warning logging
//LOG.InfoFormat("Skipping hotkey registration for {0}, no hotkey set!", functionName);
}
return true;
}
private static bool RegisterWrapper(StringBuilder failedKeys, HotKeyHandler handler, bool ignoreFailedRegistration)
{
#warning todo with Properties.Settings.Default.HotKey
//IniValue hotkeyValue = _conf.Values[configurationKey];
try
{
bool success = RegisterHotkey(failedKeys,
//hotkeyValue.Value.ToString(),
Properties.Settings.Default.HotKey,
handler);
if (!success && ignoreFailedRegistration)
{
#warning logging
//LOG.DebugFormat("Ignoring failed hotkey registration for {0}, with value '{1}', resetting to 'None'.", functionName, hotkeyValue);
#warning todo with Properties.Settings.Default.HotKey
//_conf.Values[configurationKey].Value = Keys.None.ToString();
//_conf.IsDirty = true;
}
return success;
}
catch (Exception ex)
{
#warning logging
//LOG.Warn(ex);
//LOG.WarnFormat("Restoring default hotkey for {0}, stored under {1} from '{2}' to '{3}'", functionName, configurationKey, hotkeyValue.Value, hotkeyValue.Attributes.DefaultValue);
// when getting an exception the key wasn't found: reset the hotkey value
//hotkeyValue.UseValueOrDefault(null);
//hotkeyValue.ContainingIniSection.IsDirty = true;
#warning todo set default Properties.Settings.Default.HotKey =
return RegisterHotkey(failedKeys,
//hotkeyValue.Value.ToString(),
Properties.Settings.Default.HotKey,
handler);
}
}
/// <summary>
/// Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
/// </summary>
/// <returns>Whether the hotkeys could be registered to the users content. This also applies if conflicts arise and the user decides to ignore these (i.e. not to register the conflicting hotkey).</returns>
public static bool RegisterHotkeys()
{
return RegisterHotkeys(false);
}
static void TEST()
{
MessageBox.Show("TEST");
}
/// <summary>
/// Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
/// </summary>
/// <param name="ignoreFailedRegistration">if true, a failed hotkey registration will not be reported to the user - the hotkey will simply not be registered</param>
/// <returns>Whether the hotkeys could be registered to the users content. This also applies if conflicts arise and the user decides to ignore these (i.e. not to register the conflicting hotkey).</returns>
private static bool RegisterHotkeys(bool ignoreFailedRegistration)
{
//if (_instance == null)
//{
// return false;
//}
bool success = true;
StringBuilder failedKeys = new StringBuilder();
if (!RegisterWrapper(failedKeys, TEST, ignoreFailedRegistration))
{
success = false;
}
if (!success)
{
if (!ignoreFailedRegistration)
{
success = HandleFailedHotkeyRegistration(failedKeys.ToString());
}
else
{
#warning todo with Properties.Settings.Default.HotKey
// if failures have been ignored, the config has probably been updated
//if (_conf.IsDirty)
//{
// IniConfig.Save();
//}
}
}
return success || ignoreFailedRegistration;
}
///// <summary>
///// Check if OneDrive is blocking hotkeys
///// </summary>
///// <returns>true if onedrive has hotkeys turned on</returns>
//private static bool IsOneDriveBlockingHotkey()
//{
// if (!Environment.OSVersion.IsWindows10())
// {
// return false;
// }
// var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
// var oneDriveSettingsPath = Path.Combine(localAppData, @"Microsoft\OneDrive\settings\Personal");
// if (!Directory.Exists(oneDriveSettingsPath))
// {
// return false;
// }
// var oneDriveSettingsFile = Directory.GetFiles(oneDriveSettingsPath, "*_screenshot.dat").FirstOrDefault();
// if (!File.Exists(oneDriveSettingsFile))
// {
// return false;
// }
// var screenshotSetting = File.ReadAllLines(oneDriveSettingsFile).Skip(1).Take(1).First();
// return "2".Equals(screenshotSetting);
//}
/// <summary>
/// Displays a dialog for the user to choose how to handle hotkey registration failures:
/// retry (allowing to shut down the conflicting application before),
/// ignore (not registering the conflicting hotkey and resetting the respective config to "None", i.e. not trying to register it again on next startup)
/// abort (do nothing about it)
/// </summary>
/// <param name="failedKeys">comma separated list of the hotkeys that could not be registered, for display in dialog text</param>
/// <returns></returns>
private static bool HandleFailedHotkeyRegistration(string failedKeys)
{
bool success = false;
#warning todo
//var warningTitle = Language.GetString(LangKey.warning);
var warningTitle = "Warning";
//var message = string.Format(Language.GetString(LangKey.warning_hotkeys), failedKeys, IsOneDriveBlockingHotkey() ? " (OneDrive)" : "");
var message = Translator.GetText("Could not register the hot key.");
//DialogResult dr = MessageBox.Show(Instance, message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
DialogResult dr = MessageBox.Show(message, warningTitle, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation);
if (dr == DialogResult.Retry)
{
//LOG.DebugFormat("Re-trying to register hotkeys");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(false);
}
else if (dr == DialogResult.Ignore)
{
//LOG.DebugFormat("Ignoring failed hotkey registration");
HotkeyControl.UnregisterHotkeys();
success = RegisterHotkeys(true);
}
return success;
}
#endregion
}
public class Language
{
public string Name { get; set; }
public string Value { get; set; }
}
}

File diff suppressed because it is too large Load diff

View file

@ -172,9 +172,16 @@ namespace SystemTrayMenu.Utilities
flags);
if (Success != IntPtr.Zero) // got valid handle?
{
Icon.FromHandle(shfi.hIcon);
icon = (Icon)Icon.FromHandle(shfi.hIcon).Clone();
DllImports.NativeMethods.User32DestroyIcon(shfi.hIcon);
try
{
Icon.FromHandle(shfi.hIcon);
icon = (Icon)Icon.FromHandle(shfi.hIcon).Clone();
DllImports.NativeMethods.User32DestroyIcon(shfi.hIcon);
}
catch
{
#warning todo
}
}
return icon;

View file

@ -6,7 +6,7 @@ using SystemTrayMenu.UserInterface;
namespace SystemTrayMenu.Utilities
{
internal static class Language
internal static class Translator
{
internal static CultureInfo Culture;
@ -16,19 +16,6 @@ namespace SystemTrayMenu.Utilities
Settings.Default.CurrentCultureInfoName))
{
Settings.Default.CurrentCultureInfoName = "en";
CultureInfo currentCulture =
Thread.CurrentThread.CurrentCulture;
foreach (string language in MenuDefines.Languages)
{
string twoLetter = currentCulture.Name.
Substring(0, 2);
if (language == currentCulture.Name ||
language == twoLetter)
{
Settings.Default.
CurrentCultureInfoName = language;
}
}
Settings.Default.Save();
}
@ -36,7 +23,7 @@ namespace SystemTrayMenu.Utilities
Settings.Default.CurrentCultureInfoName);
}
internal static string Translate(string id)
internal static string GetText(string id)
{
ResourceManager rm = new ResourceManager(
"SystemTrayMenu.Resources.lang",
@ -44,4 +31,10 @@ namespace SystemTrayMenu.Utilities
return rm.GetString(id, Culture);
}
}
public class Language
{
public string Name { get; set; }
public string Value { get; set; }
}
}

View file

@ -24,17 +24,7 @@
</setting>
</SystemTrayMenu.Properties.Settings>
</userSettings>
<!--
todo 1: 4k
https://docs.microsoft.com/de-de/dotnet/framework/winforms/high-dpi-support-in-windows-forms
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/winforms/
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
todo 2: antivirus dedects stm as risk
https://softwareengineering.stackexchange.com/questions/191003/how-to-prevent-my-executable-being-treated-from-av-like-bad-or-virus
https://stackoverflow.com/questions/16673086/how-to-correctly-sign-an-executable
https://blogs.msdn.microsoft.com/ieinternals/2011/03/22/everything-you-need-to-know-about-authenticode-code-signing/
-->
</configuration>