Changed: stupid design for hotkeys options

This commit is contained in:
Ray 2020-05-20 00:49:47 +01:00
parent 7fc399540f
commit 1d96222514
11 changed files with 542 additions and 264 deletions

View File

@ -138,6 +138,9 @@
<Compile Include="RyzStudio\Windows\ThemedForms\TUserControl.designer.cs"> <Compile Include="RyzStudio\Windows\ThemedForms\TUserControl.designer.cs">
<DependentUpon>TUserControl.cs</DependentUpon> <DependentUpon>TUserControl.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="RyzStudio\Windows\ThemedForms\TYesNoPickerBox.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\AddTileForm.cs"> <Compile Include="Windows\Forms\Tile\AddTileForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>

View File

@ -21,10 +21,10 @@ namespace AppLauncher
[DllImport("user32.dll")] [DllImport("user32.dll")]
protected static extern bool UnregisterHotKey(IntPtr hWnd, int id); protected static extern bool UnregisterHotKey(IntPtr hWnd, int id);
protected const int MOD_ALT = 0x1; //protected const int MOD_ALT = 0x1;
protected const int MOD_CONTROL = 0x2; //protected const int MOD_CONTROL = 0x2;
protected const int MOD_SHIFT = 0x4; //protected const int MOD_SHIFT = 0x4;
protected const int MOD_WIN = 0x8; //protected const int MOD_WIN = 0x8;
protected const int WM_HOTKEY = 0x312; protected const int WM_HOTKEY = 0x312;
protected int collapsedWidth = 40; protected int collapsedWidth = 40;
@ -32,47 +32,50 @@ namespace AppLauncher
protected OptionsForm optionsForm = null; protected OptionsForm optionsForm = null;
protected string sessionFilename = null; protected string sessionFilename = null;
protected Point hotKey = new Point(-1, -1);
public MainForm() : base() public MainForm() : base()
{ {
InitializeComponent(); InitializeComponent();
//this.Visible = false; this.StartPosition = FormStartPosition.WindowsDefaultBounds;
this.Visible = false;
} }
protected override void OnLoad(EventArgs e) protected async override void OnLoad(EventArgs e)
{
base.OnLoad(e);
//RegisterHotKey((IntPtr)Handle, 1, (MOD_CONTROL | MOD_ALT), (int)Keys.F10);
}
protected override void OnShown(EventArgs e)
{ {
this.Visible = false; this.Visible = false;
base.OnShown(e); base.OnLoad(e);
string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig"); string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
if (File.Exists(jsonfigFilename)) if (File.Exists(jsonfigFilename))
{ {
loadFile(jsonfigFilename); await loadFile(jsonfigFilename);
} }
this.Location = this.DefaultLocation;
this.Visible = true; this.Visible = true;
} }
protected override void OnShown(EventArgs e)
{
//this.Visible = false;
base.OnShown(e);
//string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
//if (File.Exists(jsonfigFilename))
//{
// loadFile(jsonfigFilename);
//}
//this.Location = this.DefaultLocation;
//this.Visible = true;
}
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
{ {
base.OnClosing(e); base.OnClosing(e);
if (hotKey.X > 0)
{
UnregisterHotKey((IntPtr)Handle, 1);
}
if (string.IsNullOrWhiteSpace(sessionFilename)) if (string.IsNullOrWhiteSpace(sessionFilename))
{ {
// do nothing // do nothing
@ -97,6 +100,15 @@ namespace AppLauncher
e.Cancel = true; e.Cancel = true;
} }
} }
if (this.CurrentSession.HotKey != null)
{
if (this.CurrentSession.HotKey.KeyCode != Keys.None)
{
UnregisterHotKey((IntPtr)Handle, 1);
}
}
} }
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
@ -114,28 +126,7 @@ namespace AppLauncher
} }
} }
public Point GlobalHotKey => hotKey; public LauncherSession CurrentSession { get; set; } = null;
public void SetHotKey(Point value)
{
if (this.GlobalHotKey.X > 0)
{
UnregisterHotKey((IntPtr)Handle, 1);
}
if (value.X < 0)
{
hotKey = new Point(-1, -1);
return;
}
hotKey = value;
if (hotKey.X > 0)
{
RegisterHotKey((IntPtr)Handle, 1, hotKey.X, hotKey.Y);
}
}
public async Task ToggleSize() public async Task ToggleSize()
{ {
@ -311,6 +302,8 @@ namespace AppLauncher
{ {
if (optionsForm == null) optionsForm = new OptionsForm(this); if (optionsForm == null) optionsForm = new OptionsForm(this);
optionsForm.ShowDialog(); optionsForm.ShowDialog();
invalidateHotKey();
} }
protected async Task collapseWindow(int width, int increment = 6) protected async Task collapseWindow(int width, int increment = 6)
@ -343,7 +336,42 @@ namespace AppLauncher
}); });
} }
protected void loadFile(string filename) protected void invalidateHotKey()
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() =>
{
UnregisterHotKey((IntPtr)Handle, 1);
}));
}
else
{
UnregisterHotKey((IntPtr)Handle, 1);
}
if (this.CurrentSession.HotKey != null)
{
if (this.CurrentSession.HotKey.KeyCode != Keys.None)
{
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() =>
{
RegisterHotKey((IntPtr)Handle, 1, this.CurrentSession.HotKey.ModifierCode, this.CurrentSession.HotKey.Key);
}));
}
else
{
RegisterHotKey((IntPtr)Handle, 1, this.CurrentSession.HotKey.ModifierCode, this.CurrentSession.HotKey.Key);
}
}
}
}
protected async Task loadFile(string filename)
{
await Task.Run(() =>
{ {
if (isBusy) if (isBusy)
{ {
@ -379,44 +407,39 @@ namespace AppLauncher
return; return;
} }
LauncherSession launcherSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode); LauncherSession loadedSession = JsonConvert.DeserializeObject<LauncherSession>(sourceCode);
if (launcherSession == null) if (loadedSession == null)
{ {
return; return;
} }
int maxWidth = 0; // load options
flowLayoutPanel1.Controls.Clear(); this.CurrentSession = loadedSession.ToSimple();
if (launcherSession.Groups != null) // load tiles
int maxWidth = 0;
ThreadControl.Clear(flowLayoutPanel1);
if (loadedSession.Groups != null)
{ {
foreach (TileGroupModel item in launcherSession.Groups) foreach (TileGroupModel item in loadedSession.Groups)
{ {
TTilePanelLayout panel = new TTilePanelLayout(item); TTilePanelLayout panel = new TTilePanelLayout(item);
maxWidth = Math.Max(maxWidth, panel.Width); maxWidth = Math.Max(maxWidth, panel.Width);
flowLayoutPanel1.Controls.Add(panel); ThreadControl.AddControl(flowLayoutPanel1, panel);
} }
} }
// ui // ui
this.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left; ThreadControl.SetSize(this, (maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left), this.CurrentSession.DefaultHeight);
this.Height = launcherSession.DefaultHeight;
// hotkey // hotkey
hotKey = new Point(launcherSession.HotKeyX, launcherSession.HotKeyY); invalidateHotKey();
if (hotKey.X > 0)
{
RegisterHotKey((IntPtr)Handle, 1, hotKey.X, hotKey.Y);
}
else
{
hotKey = new Point(-1, -1);
}
// //
this.TopMost = launcherSession.AlwaysOnTop; ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
});
} }
protected void newSession() protected void newSession()
@ -457,16 +480,13 @@ namespace AppLauncher
isBusy = true; isBusy = true;
LauncherSession launcherSession = new LauncherSession() // update session
{ this.CurrentSession.DefaultHeight = this.Height;
DefaultHeight = this.Height, this.CurrentSession.AlwaysOnTop = this.TopMost;
HotKeyX = this.GlobalHotKey.X,
HotKeyY = this.GlobalHotKey.Y,
Groups = new List<TileGroupModel>(),
AlwaysOnTop = this.TopMost
};
launcherSession.Groups = new List<TileGroupModel>(); // save
LauncherSession saveSession = this.CurrentSession.ToSimple();
saveSession.Groups = new List<TileGroupModel>();
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++) for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
{ {
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout)) if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
@ -475,12 +495,12 @@ namespace AppLauncher
} }
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout; TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout;
launcherSession.Groups.Add(container.Model); saveSession.Groups.Add(container.Model);
} }
try try
{ {
File.WriteAllText(filename, JsonConvert.SerializeObject(launcherSession)); File.WriteAllText(filename, JsonConvert.SerializeObject(saveSession));
if (showNotices) if (showNotices)
{ {

View File

@ -5,11 +5,34 @@ namespace AppLauncher.Models
{ {
public class LauncherSession public class LauncherSession
{ {
public int DefaultHeight { get; set; } = 280; public class HotKeyOptions
public int HotKeyX { get; set; } = -1; {
public int HotKeyY { get; set; } = -1; public bool IsCtrl { get; set; } = false;
public bool AlwaysOnTop { get; set; } = false; public bool IsAlt { get; set; } = false;
public bool IsShift { get; set; } = false;
public int Key { get; set; } = (int)System.Windows.Forms.Keys.None;
public int ModifierCode => ((this.IsAlt ? 1 : 0) + (this.IsCtrl ? 2 : 0) + (this.IsShift ? 4 : 0));
public System.Windows.Forms.Keys KeyCode => (System.Windows.Forms.Keys)this.Key;
}
public int DefaultHeight { get; set; } = 280;
public HotKeyOptions HotKey { get; set; } = null;
public bool AlwaysOnTop { get; set; } = false;
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>(); public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
public LauncherSession ToSimple()
{
return new LauncherSession()
{
DefaultHeight = this.DefaultHeight,
HotKey = this.HotKey,
AlwaysOnTop = this.AlwaysOnTop,
Groups = null
};
}
} }
} }

View File

@ -19,9 +19,10 @@ namespace AppLauncher
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm()); Application.Run(new MainForm());
}
mutex.ReleaseMutex(); mutex.ReleaseMutex();
}
mutex.Close(); mutex.Close();
mutex.Dispose(); mutex.Dispose();
mutex = null; mutex = null;

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -52,6 +53,20 @@ namespace RyzStudio.Windows.Forms
} }
} }
public static void Clear(FlowLayoutPanel control)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.Controls.Clear();
}));
}
else
{
control.Controls.Clear();
}
}
public static string GetText(Control control, bool doTrim = true) public static string GetText(Control control, bool doTrim = true)
{ {
string rv = string.Empty; string rv = string.Empty;
@ -148,5 +163,49 @@ namespace RyzStudio.Windows.Forms
} }
} }
public static void SetSize(Control control, int width, int height)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.Width = width;
control.Height = height;
}));
}
else
{
control.Width = width;
control.Height = height;
}
}
public static void SetSize(Control control, Size value)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.Size = value;
}));
}
else
{
control.Size = value;
}
}
public static void SetTopMost(Form control, bool value)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.TopMost = value;
}));
}
else
{
control.TopMost = value;
}
}
} }
} }

View File

@ -27,6 +27,7 @@
this.FormBorderStyle = FormBorderStyle.None; this.FormBorderStyle = FormBorderStyle.None;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.TopMost = true;
imgbxClose.Click += pictureBox3_Click; imgbxClose.Click += pictureBox3_Click;
} }

View File

@ -0,0 +1,17 @@
namespace RyzStudio.Windows.ThemedForms
{
public class TYesNoPickerBox : TPickerBox
{
public TYesNoPickerBox() : base()
{
this.ComboBox.Items.Clear();
this.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
if (this.ComboBox.Items.Count > 0) this.ComboBox.SelectedIndex = 0;
}
public bool Value { get => (this.ComboBox.SelectedIndex == 1); set =>this.ComboBox.SelectedIndex = (value ? 1 : 0); }
}
}

View File

@ -195,9 +195,9 @@ namespace AppLauncher.Windows.Forms
this.imageBox2 = new RyzStudio.Windows.Forms.TImageBox(); this.imageBox2 = new RyzStudio.Windows.Forms.TImageBox();
this.imageBox1 = new RyzStudio.Windows.Forms.TImageBox(); this.imageBox1 = new RyzStudio.Windows.Forms.TImageBox();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imageBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imageBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit();
@ -266,21 +266,8 @@ namespace AppLauncher.Windows.Forms
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Visible = true; this.notifyIcon1.Visible = true;
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); this.notifyIcon1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseClick);
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_Click); this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseClick);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS;
this.panel1.Location = new System.Drawing.Point(109, 114);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 2);
this.panel1.TabIndex = 149;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
// //
// contextMenuStrip1 // contextMenuStrip1
// //
@ -296,6 +283,19 @@ namespace AppLauncher.Windows.Forms
this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNS;
this.panel1.Location = new System.Drawing.Point(109, 114);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 2);
this.panel1.TabIndex = 149;
this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
//
// AForm // AForm
// //
this.ClientSize = new System.Drawing.Size(421, 321); this.ClientSize = new System.Drawing.Size(421, 321);
@ -345,12 +345,6 @@ namespace AppLauncher.Windows.Forms
} }
} }
private void notifyIcon1_Click(object sender, EventArgs e)
{
this.Visible = !this.Visible;
//notifyIcon1.Visible = !this.Visible;
}
private void panel1_MouseDown(object sender, MouseEventArgs e) private void panel1_MouseDown(object sender, MouseEventArgs e)
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
@ -375,5 +369,15 @@ namespace AppLauncher.Windows.Forms
private void exitToolStripMenuItem_Click(object sender, EventArgs e) => this.Close(); private void exitToolStripMenuItem_Click(object sender, EventArgs e) => this.Close();
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Visible = !this.Visible;
}
//notifyIcon1.Visible = !this.Visible;
}
} }
} }

View File

@ -11,10 +11,17 @@ namespace AppLauncher.Windows.Forms
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private TButton button1; private TButton button1;
private TTextBox textBox1; private TTextBox textBox1;
private TYesNoPickerBox pickerBox1;
private System.Windows.Forms.Label label2;
private TYesNoPickerBox pickerBox2;
private System.Windows.Forms.Label label3;
private TYesNoPickerBox pickerBox3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
public MainForm parentForm { get; set; } = null; public MainForm parentForm { get; set; } = null;
protected LauncherSession.HotKeyOptions hotKeyOptions = null;
protected Point hotKey = new Point(-1, -1);
public OptionsForm(MainForm parent) : base() public OptionsForm(MainForm parent) : base()
{ {
@ -34,6 +41,14 @@ namespace AppLauncher.Windows.Forms
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label2 = new System.Windows.Forms.Label();
this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label3 = new System.Windows.Forms.Label();
this.pickerBox3 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -57,7 +72,7 @@ namespace AppLauncher.Windows.Forms
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.BackColor = System.Drawing.Color.Transparent; this.textBox1.BackColor = System.Drawing.Color.Transparent;
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.textBox1.Location = new System.Drawing.Point(159, 50); this.textBox1.Location = new System.Drawing.Point(159, 206);
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
@ -70,12 +85,12 @@ namespace AppLauncher.Windows.Forms
// //
this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104))))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label1.Location = new System.Drawing.Point(18, 50); this.label1.Location = new System.Drawing.Point(18, 83);
this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(131, 32); this.label1.Size = new System.Drawing.Size(131, 32);
this.label1.TabIndex = 153; this.label1.TabIndex = 153;
this.label1.Text = "Hotkey"; this.label1.Text = "Use Control";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// button1 // button1
@ -94,9 +109,121 @@ namespace AppLauncher.Windows.Forms
this.button1.TabIndex = 173; this.button1.TabIndex = 173;
this.button1.Click += new System.EventHandler(this.button1_Click); this.button1.Click += new System.EventHandler(this.button1_Click);
// //
// pickerBox1
//
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox1.Location = new System.Drawing.Point(159, 83);
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox1.Name = "pickerBox1";
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox1.Size = new System.Drawing.Size(220, 32);
this.pickerBox1.SubmitButton = null;
this.pickerBox1.TabIndex = 174;
this.pickerBox1.Value = false;
//
// label2
//
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.Black;
this.label2.Location = new System.Drawing.Point(10, 50);
this.label2.Margin = new System.Windows.Forms.Padding(0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 24);
this.label2.TabIndex = 175;
this.label2.Text = "Hotkey";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox2
//
this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox2.BackColor = System.Drawing.Color.Transparent;
this.pickerBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox2.Location = new System.Drawing.Point(159, 124);
this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox2.Name = "pickerBox2";
this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox2.Size = new System.Drawing.Size(220, 32);
this.pickerBox2.SubmitButton = null;
this.pickerBox2.TabIndex = 177;
this.pickerBox2.Value = false;
//
// label3
//
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label3.Location = new System.Drawing.Point(18, 124);
this.label3.Margin = new System.Windows.Forms.Padding(0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(131, 32);
this.label3.TabIndex = 176;
this.label3.Text = "Use Alt";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pickerBox3
//
this.pickerBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox3.BackColor = System.Drawing.Color.Transparent;
this.pickerBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox3.Location = new System.Drawing.Point(159, 165);
this.pickerBox3.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox3.Name = "pickerBox3";
this.pickerBox3.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox3.Size = new System.Drawing.Size(220, 32);
this.pickerBox3.SubmitButton = null;
this.pickerBox3.TabIndex = 179;
this.pickerBox3.Value = false;
//
// label4
//
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label4.Location = new System.Drawing.Point(18, 165);
this.label4.Margin = new System.Windows.Forms.Padding(0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(131, 32);
this.label4.TabIndex = 178;
this.label4.Text = "Use Shift";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label5.Location = new System.Drawing.Point(18, 206);
this.label5.Margin = new System.Windows.Forms.Padding(0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(131, 32);
this.label5.TabIndex = 180;
this.label5.Text = "Key";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// horizontalSeparator2
//
this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.horizontalSeparator2.Location = new System.Drawing.Point(10, 247);
this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator2.Name = "horizontalSeparator2";
this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator2.TabIndex = 181;
//
// OptionsForm // OptionsForm
// //
this.ClientSize = new System.Drawing.Size(400, 480); this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.label5);
this.Controls.Add(this.pickerBox3);
this.Controls.Add(this.label4);
this.Controls.Add(this.pickerBox2);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.pickerBox1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
@ -108,6 +235,14 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.textBox1, 0); this.Controls.SetChildIndex(this.textBox1, 0);
this.Controls.SetChildIndex(this.label1, 0); this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.button1, 0); this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.pickerBox1, 0);
this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.label3, 0);
this.Controls.SetChildIndex(this.pickerBox2, 0);
this.Controls.SetChildIndex(this.label4, 0);
this.Controls.SetChildIndex(this.pickerBox3, 0);
this.Controls.SetChildIndex(this.label5, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -117,47 +252,40 @@ namespace AppLauncher.Windows.Forms
{ {
base.OnShown(e); base.OnShown(e);
if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions();
if (parentForm != null) if (parentForm != null)
{ {
bool control = false; if (parentForm.CurrentSession.HotKey != null)
bool alt = false;
bool shift = false;
int hotKeyCode = parentForm.GlobalHotKey.X;
if (hotKeyCode >= 4)
{ {
shift = true; hotKeyOptions.IsCtrl = parentForm.CurrentSession.HotKey.IsCtrl;
hotKeyCode -= 4; hotKeyOptions.IsAlt = parentForm.CurrentSession.HotKey.IsAlt;
hotKeyOptions.IsShift = parentForm.CurrentSession.HotKey.IsShift;
hotKeyOptions.Key = parentForm.CurrentSession.HotKey.Key;
pickerBox1.Value = hotKeyOptions.IsCtrl;
pickerBox2.Value = hotKeyOptions.IsAlt;
pickerBox3.Value = hotKeyOptions.IsShift;
textBox1.Text = hotKeyOptions.KeyCode.ToString();
} }
if (hotKeyCode >= 2)
{
control = true;
hotKeyCode -= 2;
}
if (hotKeyCode >= 1)
{
alt = true;
hotKeyCode -= 1;
}
StringBuilder sb = new StringBuilder();
if (control) sb = sb.Append("Ctrl + ");
if (alt) sb = sb.Append("Alt + ");
if (shift) sb = sb.Append("Shift + ");
sb = sb.Append(((System.Windows.Forms.Keys)parentForm.GlobalHotKey.Y).ToString());
textBox1.Text = sb.ToString();
} }
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions();
if (parentForm != null) if (parentForm != null)
{ {
parentForm.SetHotKey(hotKey); if (parentForm.CurrentSession == null) parentForm.CurrentSession = new LauncherSession();
if (parentForm.CurrentSession.HotKey == null) parentForm.CurrentSession.HotKey = new LauncherSession.HotKeyOptions();
parentForm.CurrentSession.HotKey.IsCtrl = pickerBox1.Value;
parentForm.CurrentSession.HotKey.IsAlt = pickerBox2.Value;
parentForm.CurrentSession.HotKey.IsShift = pickerBox3.Value;
parentForm.CurrentSession.HotKey.Key = hotKeyOptions.Key;
} }
this.Close(); this.Close();
@ -169,22 +297,20 @@ namespace AppLauncher.Windows.Forms
if (e.KeyCode == System.Windows.Forms.Keys.ShiftKey) return; if (e.KeyCode == System.Windows.Forms.Keys.ShiftKey) return;
if (e.KeyCode == System.Windows.Forms.Keys.Menu) return; if (e.KeyCode == System.Windows.Forms.Keys.Menu) return;
StringBuilder sb = new StringBuilder(); if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions();
//hotKeyOptions.IsCtrl = pickerBox1.Value;
//hotKeyOptions.IsAlt = pickerBox2.Value;
//hotKeyOptions.IsShift = pickerBox3.Value;
hotKeyOptions.Key = (int)e.KeyCode;
if (e.Control) sb = sb.Append("Ctrl + "); //StringBuilder sb = new StringBuilder();
if (e.Alt) sb = sb.Append("Alt + "); //if (hotKeyOptions.IsCtrl) sb = sb.Append("Ctrl + ");
if (e.Shift) sb = sb.Append("Shift + "); //if (hotKeyOptions.IsAlt) sb = sb.Append("Alt + ");
//if (hotKeyOptions.IsShift) sb = sb.Append("Shift + ");
//sb = sb.Append(e.KeyCode.ToString());
int keyModifier = 0; //textBox1.Text = sb.ToString();
if (e.Alt) keyModifier += 1; textBox1.Text = e.KeyCode.ToString();
if (e.Control) keyModifier += 2;
if (e.Shift) keyModifier += 4;
sb = sb.Append(e.KeyCode.ToString());
textBox1.Text = sb.ToString();
hotKey = new Point(keyModifier, (int)e.KeyCode);
} }
} }

View File

@ -24,6 +24,7 @@ namespace AppLauncher.Windows.Forms
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TTextBox textBox1; private TTextBox textBox1;
private TListBox listBox1; private TListBox listBox1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
public TTilePanelLayout TilePanelLayout { get; set; } = null; public TTilePanelLayout TilePanelLayout { get; set; } = null;
@ -37,15 +38,13 @@ namespace AppLauncher.Windows.Forms
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddListTileForm));
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle1 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle2 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
RyzStudio.Windows.ThemedForms.TButton.ButtonStyle buttonStyle3 = new RyzStudio.Windows.ThemedForms.TButton.ButtonStyle();
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox(); this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -96,6 +95,7 @@ namespace AppLauncher.Windows.Forms
this.button1.BackColor = System.Drawing.Color.Transparent; this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.DefaultImage = null; this.button1.DefaultImage = null;
this.button1.DownImage = null; this.button1.DownImage = null;
this.button1.IsSelected = false;
this.button1.LabelText = "&Save"; this.button1.LabelText = "&Save";
this.button1.Location = new System.Drawing.Point(251, 427); this.button1.Location = new System.Drawing.Point(251, 427);
this.button1.Name = "button1"; this.button1.Name = "button1";
@ -146,16 +146,27 @@ namespace AppLauncher.Windows.Forms
this.label2.Text = "List"; this.label2.Text = "List";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// EditListTileForm2 // tHorizontalSeparator1
//
this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tHorizontalSeparator1.Location = new System.Drawing.Point(10, 391);
this.tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
this.tHorizontalSeparator1.Name = "tHorizontalSeparator1";
this.tHorizontalSeparator1.Size = new System.Drawing.Size(380, 2);
this.tHorizontalSeparator1.TabIndex = 182;
//
// AddListTileForm
// //
this.ClientSize = new System.Drawing.Size(400, 480); this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.tHorizontalSeparator1);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.listBox1); this.Controls.Add(this.listBox1);
this.Controls.Add(this.horizontalSeparator2); this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Name = "EditListTileForm2"; this.Name = "AddListTileForm";
this.Title = "Add List Tile"; this.Title = "Add List Tile";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
@ -166,6 +177,7 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.horizontalSeparator2, 0); this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.listBox1, 0); this.Controls.SetChildIndex(this.listBox1, 0);
this.Controls.SetChildIndex(this.label2, 0); this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.tHorizontalSeparator1, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -17,6 +17,7 @@ namespace AppLauncher.Windows.Forms
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private TButton button1; private TButton button1;
private TPickerBox pickerBox1; private TPickerBox pickerBox1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TTextBox textBox1; private TTextBox textBox1;
public TTilePanelLayout TilePanelLayout { get; set; } = null; public TTilePanelLayout TilePanelLayout { get; set; } = null;
@ -38,6 +39,7 @@ namespace AppLauncher.Windows.Forms
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox(); this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -46,10 +48,6 @@ namespace AppLauncher.Windows.Forms
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image"))); this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5); this.imgbxClose.Location = new System.Drawing.Point(367, 5);
// //
// lblDescription
//
this.Text = "Edit Group";
//
// panel1 // panel1
// //
this.panel1.Location = new System.Drawing.Point(394, 474); this.panel1.Location = new System.Drawing.Point(394, 474);
@ -103,6 +101,7 @@ namespace AppLauncher.Windows.Forms
this.button1.BackColor = System.Drawing.Color.Transparent; this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.DefaultImage = null; this.button1.DefaultImage = null;
this.button1.DownImage = null; this.button1.DownImage = null;
this.button1.IsSelected = false;
this.button1.LabelText = "&Save"; this.button1.LabelText = "&Save";
this.button1.Location = new System.Drawing.Point(251, 427); this.button1.Location = new System.Drawing.Point(251, 427);
this.button1.Name = "button1"; this.button1.Name = "button1";
@ -126,16 +125,28 @@ namespace AppLauncher.Windows.Forms
this.pickerBox1.SubmitButton = null; this.pickerBox1.SubmitButton = null;
this.pickerBox1.TabIndex = 174; this.pickerBox1.TabIndex = 174;
// //
// horizontalSeparator2
//
this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.horizontalSeparator2.Location = new System.Drawing.Point(10, 133);
this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
this.horizontalSeparator2.Name = "horizontalSeparator2";
this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator2.TabIndex = 182;
//
// EditGroupForm // EditGroupForm
// //
this.ClientSize = new System.Drawing.Size(400, 480); this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.pickerBox1); this.Controls.Add(this.pickerBox1);
this.Controls.Add(this.button1); this.Controls.Add(this.button1);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Title = "Edit Group";
this.Name = "EditGroupForm"; this.Name = "EditGroupForm";
this.Text = "Edit Group";
this.Title = "Edit Group";
this.Controls.SetChildIndex(this.imgbxClose, 0); this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.panel1, 0); this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0); this.Controls.SetChildIndex(this.area1, 0);
@ -144,6 +155,7 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.label2, 0); this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.button1, 0); this.Controls.SetChildIndex(this.button1, 0);
this.Controls.SetChildIndex(this.pickerBox1, 0); this.Controls.SetChildIndex(this.pickerBox1, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);