Provide support of HotKeys to manage thumbnails and corresponding EVE clients - implemented w/o GUI required to set hotkeys
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EveOPreview.Configuration
|
||||
@@ -35,6 +36,7 @@ namespace EveOPreview.Configuration
|
||||
this.PerClientLayout = new Dictionary<string, Dictionary<string, Point>>();
|
||||
this.FlatLayout = new Dictionary<string, Point>();
|
||||
this.ClientLayout = new Dictionary<string, ClientLayout>();
|
||||
this.ClientHotkey = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
public bool MinimizeToTray { get; set; }
|
||||
@@ -66,6 +68,8 @@ namespace EveOPreview.Configuration
|
||||
private Dictionary<string, Point> FlatLayout { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, ClientLayout> ClientLayout { get; set; }
|
||||
[JsonProperty]
|
||||
private Dictionary<string, string> ClientHotkey { get; set; }
|
||||
|
||||
public Point GetThumbnailLocation(string currentClient, string activeClient, Point defaultLocation)
|
||||
{
|
||||
@@ -129,5 +133,23 @@ namespace EveOPreview.Configuration
|
||||
{
|
||||
this.ClientLayout[currentClient] = layout;
|
||||
}
|
||||
|
||||
public Keys GetClientHotkey(string currentClient)
|
||||
{
|
||||
string hotkey;
|
||||
if (this.ClientHotkey.TryGetValue(currentClient, out hotkey))
|
||||
{
|
||||
// Protect from incorrect values
|
||||
object rawValue = (new KeysConverter()).ConvertFromInvariantString(hotkey);
|
||||
return rawValue != null ? (Keys)rawValue : Keys.None;
|
||||
}
|
||||
|
||||
return Keys.None;
|
||||
}
|
||||
|
||||
public void SetClientHotkey(string currentClient, Keys hotkey)
|
||||
{
|
||||
this.ClientHotkey[currentClient] = (new KeysConverter()).ConvertToInvariantString(hotkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user