Added conflicting application detection if hotkey registration fails

This commit is contained in:
Jaex 2015-11-11 11:14:39 +02:00
parent c8dcc27104
commit 73136fbee3
7 changed files with 21 additions and 11 deletions

View file

@ -109,7 +109,7 @@ public static bool CopyImage(Image img)
return CopyImageAlternative(img);
}
if (HelpersOptions.DefaultClipboardCopyImageFillBackground)
if (HelpersOptions.DefaultCopyImageFillBackground)
{
return CopyImageDefaultFillBackground(img, Color.White);
}

View file

@ -28,7 +28,7 @@ namespace ShareX.HelpersLib
public static class HelpersOptions
{
public static ProxyInfo CurrentProxy = new ProxyInfo();
public static bool DefaultClipboardCopyImageFillBackground = true;
public static bool DefaultCopyImageFillBackground = true;
public static bool UseAlternativeCopyImage = false;
public static string BrowserPath = null;
}

View file

@ -40,7 +40,7 @@ private enum SetupType
Steam // Create Steam folder
}
private static readonly SetupType Setup = SetupType.Steam;
private static readonly SetupType Setup = SetupType.Beta;
private static readonly string parentDir = @"..\..\..\";
private static readonly string binDir = Path.Combine(parentDir, "ShareX", "bin");

View file

@ -50,10 +50,9 @@ public HotkeySettingsForm()
private void HotkeySettingsForm_FormClosed(object sender, FormClosedEventArgs e)
{
Program.HotkeyManager.IgnoreHotkeys = false;
if (manager != null)
{
manager.IgnoreHotkeys = false;
manager.HotkeysToggledTrigger -= HandleHotkeysToggle;
}
}

View file

@ -606,7 +606,7 @@ private void RegisterMenuClosing()
private void AfterSettingsJobs()
{
HelpersOptions.CurrentProxy = Program.Settings.ProxySettings;
HelpersOptions.DefaultClipboardCopyImageFillBackground = Program.Settings.DefaultClipboardCopyImageFillBackground;
HelpersOptions.DefaultCopyImageFillBackground = Program.Settings.DefaultClipboardCopyImageFillBackground;
HelpersOptions.UseAlternativeCopyImage = Program.Settings.UseAlternativeClipboardCopyImage;
HelpersOptions.BrowserPath = Program.Settings.BrowserPath;
TaskManager.RecentManager.MaxCount = Program.Settings.RecentLinksMaxCount;

View file

@ -25,7 +25,9 @@ You should have received a copy of the GNU General Public License
using ShareX.HelpersLib;
using ShareX.Properties;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows.Forms;
@ -167,14 +169,23 @@ public void ToggleHotkeys(bool hotkeysDisabled)
public void ShowFailedHotkeys()
{
IEnumerable<HotkeySettings> failedHotkeysList = Hotkeys.Where(x => x.HotkeyInfo.Status == HotkeyStatus.Failed);
List<HotkeySettings> failedHotkeysList = Hotkeys.Where(x => x.HotkeyInfo.Status == HotkeyStatus.Failed).ToList();
if (failedHotkeysList.Count() > 0)
if (failedHotkeysList.Count > 0)
{
string failedHotkeys = string.Join("\r\n", failedHotkeysList.Select(x => x.TaskSettings.ToString() + ": " + x.HotkeyInfo.ToString()).ToArray());
string hotkeyText = failedHotkeysList.Count() > 1 ? Resources.HotkeyManager_ShowFailedHotkeys_hotkeys : Resources.HotkeyManager_ShowFailedHotkeys_hotkey;
string failedHotkeys = string.Join("\r\n", failedHotkeysList.Select(x => x.TaskSettings.ToString() + ": " + x.HotkeyInfo.ToString()));
string hotkeyText = failedHotkeysList.Count > 1 ? Resources.HotkeyManager_ShowFailedHotkeys_hotkeys : Resources.HotkeyManager_ShowFailedHotkeys_hotkey;
string text = string.Format(Resources.HotkeyManager_ShowFailedHotkeys_Unable_to_register_hotkey, hotkeyText, failedHotkeys);
string[] processNames = new string[] { "OneDrive", "Dropbox", "Greenshot", "ScreenshotCaptor" };
List<string> conflictProcessNames = Process.GetProcesses().Select(x => x.ProcessName).Where(x => !string.IsNullOrEmpty(x) &&
processNames.Any(x2 => x.Equals(x2, StringComparison.InvariantCultureIgnoreCase))).ToList();
if (conflictProcessNames != null && conflictProcessNames.Count > 0)
{
text += "\r\n\r\n" + string.Format("These applications could be conflicting:\r\n\r\n{0}", string.Join("\r\n", conflictProcessNames));
}
MessageBox.Show(text, "ShareX - " + Resources.HotkeyManager_ShowFailedHotkeys_Hotkey_registration_failed, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

View file

@ -54,7 +54,7 @@ public static ShareXBuild Build
}
}
public static bool IsBeta { get; } = false;
public static bool IsBeta { get; } = true;
public static string Title
{