Added: always-on-top options in config

This commit is contained in:
Ray 2020-05-19 00:17:22 +01:00
parent 0f03a26a4c
commit 7fc399540f
8 changed files with 459 additions and 52 deletions

View File

@ -7,7 +7,7 @@
<ProjectGuid>{66C1C75C-3612-4D23-B937-C3DE0D653292}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AppLauncher</RootNamespace>
<AssemblyName>LinearAppLauncher</AssemblyName>
<AssemblyName>fizzylauncher</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
@ -150,6 +150,9 @@
<Compile Include="Windows\Forms\Tile\EditListTileForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\OptionsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\Forms\Tile\EditTileForm.cs">
<SubType>Form</SubType>
</Compile>
@ -215,6 +218,9 @@
<EmbeddedResource Include="Windows\Forms\Tile\EditListTileForm.resx">
<DependentUpon>EditListTileForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\OptionsForm.resx">
<DependentUpon>OptionsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\Forms\Tile\EditTileForm.resx">
<DependentUpon>EditTileForm.cs</DependentUpon>
</EmbeddedResource>

71
MainForm.Designer.cs generated
View File

@ -39,10 +39,12 @@
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
@ -75,10 +77,9 @@
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem4,
this.toolStripMenuItem3,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.toolStripMenuItem9});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(100, 76);
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 92);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// toolStripMenuItem4
@ -90,62 +91,76 @@
this.toolStripMenuItem8,
this.toolStripSeparator3,
this.toolStripMenuItem6,
this.toolStripMenuItem2});
this.toolStripMenuItem2,
this.toolStripMenuItem10,
this.exitToolStripMenuItem});
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(99, 22);
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem4.Text = "&File";
//
// toolStripMenuItem5
//
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem5.Text = "&New";
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
//
// toolStripMenuItem7
//
this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem7.Text = "&Open";
this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
//
// toolStripMenuItem8
//
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem8.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem8.Text = "&Close";
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem6.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem6.Text = "&Save";
this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem2.Text = "Save &As...";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(99, 22);
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem3.Text = "&View";
//
// toolStripMenuItem1
@ -155,17 +170,20 @@
this.toolStripMenuItem1.Text = "Always On &Top";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
//
// toolStripSeparator1
// toolStripMenuItem9
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(96, 6);
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionToolStripMenuItem});
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem9.Text = "&Tools";
//
// exitToolStripMenuItem
// optionToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
this.optionToolStripMenuItem.Name = "optionToolStripMenuItem";
this.optionToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.optionToolStripMenuItem.Text = "&Options";
this.optionToolStripMenuItem.Click += new System.EventHandler(this.optionToolStripMenuItem_Click);
//
// flowLayoutPanel1
//
@ -189,7 +207,6 @@
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
this.openFileDialog1.Filter = "Session files|*.jsonfig";
this.openFileDialog1.Title = "Choose session file";
//
@ -221,8 +238,6 @@
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
@ -235,6 +250,10 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem8;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9;
private System.Windows.Forms.ToolStripMenuItem optionToolStripMenuItem;
}
}

View File

@ -30,7 +30,9 @@ namespace AppLauncher
protected int collapsedWidth = 40;
protected int expandedWidth = 800;
protected OptionsForm optionsForm = null;
protected string sessionFilename = null;
protected Point hotKey = new Point(-1, -1);
public MainForm() : base()
{
@ -43,7 +45,7 @@ namespace AppLauncher
{
base.OnLoad(e);
RegisterHotKey((IntPtr)Handle, 1, (MOD_CONTROL | MOD_ALT), (int)Keys.F10);
//RegisterHotKey((IntPtr)Handle, 1, (MOD_CONTROL | MOD_ALT), (int)Keys.F10);
}
protected override void OnShown(EventArgs e)
@ -66,7 +68,10 @@ namespace AppLauncher
{
base.OnClosing(e);
UnregisterHotKey((IntPtr)Handle, 1);
if (hotKey.X > 0)
{
UnregisterHotKey((IntPtr)Handle, 1);
}
if (string.IsNullOrWhiteSpace(sessionFilename))
{
@ -77,7 +82,7 @@ namespace AppLauncher
DialogResult dr = MessageBox.Show("Save existing session?", "Exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
bool rv = saveFile(sessionFilename);
bool rv = saveFile(sessionFilename, false);
if (!rv)
{
e.Cancel = true;
@ -109,6 +114,29 @@ namespace AppLauncher
}
}
public Point GlobalHotKey => hotKey;
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()
{
if (this.Width > collapsedWidth)
@ -279,6 +307,12 @@ namespace AppLauncher
/// <param name="e"></param>
private void exitToolStripMenuItem_Click(object sender, EventArgs e) => this.Close();
private void optionToolStripMenuItem_Click(object sender, EventArgs e)
{
if (optionsForm == null) optionsForm = new OptionsForm(this);
optionsForm.ShowDialog();
}
protected async Task collapseWindow(int width, int increment = 6)
{
await Task.Run(() =>
@ -365,8 +399,24 @@ namespace AppLauncher
}
}
// ui
this.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20 + flowLayoutPanel1.Left;
this.Height = launcherSession.DefaultHeight;
// hotkey
hotKey = new Point(launcherSession.HotKeyX, launcherSession.HotKeyY);
if (hotKey.X > 0)
{
RegisterHotKey((IntPtr)Handle, 1, hotKey.X, hotKey.Y);
}
else
{
hotKey = new Point(-1, -1);
}
//
this.TopMost = launcherSession.AlwaysOnTop;
}
protected void newSession()
@ -410,7 +460,10 @@ namespace AppLauncher
LauncherSession launcherSession = new LauncherSession()
{
DefaultHeight = this.Height,
Groups = new List<TileGroupModel>()
HotKeyX = this.GlobalHotKey.X,
HotKeyY = this.GlobalHotKey.Y,
Groups = new List<TileGroupModel>(),
AlwaysOnTop = this.TopMost
};
launcherSession.Groups = new List<TileGroupModel>();

View File

@ -1,10 +1,15 @@
using System.Collections.Generic;
using System.Drawing;
namespace AppLauncher.Models
{
public class LauncherSession
{
public int DefaultHeight { get; set; } = 280;
public int HotKeyX { get; set; } = -1;
public int HotKeyY { get; set; } = -1;
public bool AlwaysOnTop { get; set; } = false;
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
}
}

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Linear App Launcher")]
[assembly: AssemblyDescription("Application launcher (linear)")]
[assembly: AssemblyTitle("Fizzy App Launcher")]
[assembly: AssemblyDescription("Application and shortcut launcher")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hi, I'm Ray")]
[assembly: AssemblyProduct("LinearAppLauncher")]
[assembly: AssemblyProduct("Fizzy App Launcher")]
[assembly: AssemblyCopyright("Copyright © Ray Lam 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -32,5 +32,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.1.0.0")]
[assembly: AssemblyVersion("0.1.1.035")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -35,6 +35,8 @@ namespace AppLauncher.Windows.Forms
this.FormBorderStyle = FormBorderStyle.None;
this.StartPosition = FormStartPosition.Manual;
}
notifyIcon1.Text = "Fizzy App Launcher";
}
protected override void OnLoad(EventArgs e)
@ -147,7 +149,7 @@ namespace AppLauncher.Windows.Forms
g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17);
TextRenderer.DrawText(g, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171));
TextRenderer.DrawText(g, "Fizzy App Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171));
}
@ -201,9 +203,9 @@ namespace AppLauncher.Windows.Forms
((System.ComponentModel.ISupportInitialize)(this.imageBox1)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
//
//
// imageBox3
//
//
this.imageBox3.BackColor = System.Drawing.Color.Transparent;
this.imageBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox3.ErrorImage = null;
@ -220,9 +222,9 @@ namespace AppLauncher.Windows.Forms
this.imageBox3.TabIndex = 146;
this.imageBox3.TabStop = false;
this.imageBox3.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox3_MouseClick);
//
//
// imageBox2
//
//
this.imageBox2.BackColor = System.Drawing.Color.Transparent;
this.imageBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox2.ErrorImage = null;
@ -239,9 +241,9 @@ namespace AppLauncher.Windows.Forms
this.imageBox2.TabIndex = 147;
this.imageBox2.TabStop = false;
this.imageBox2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox2_MouseClick);
//
//
// imageBox1
//
//
this.imageBox1.BackColor = System.Drawing.Color.Transparent;
this.imageBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.imageBox1.ErrorImage = null;
@ -258,17 +260,17 @@ namespace AppLauncher.Windows.Forms
this.imageBox1.TabIndex = 148;
this.imageBox1.TabStop = false;
this.imageBox1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.imageBox1_MouseClick);
//
//
// notifyIcon1
//
//
this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Visible = true;
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);
this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_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);
@ -279,23 +281,23 @@ namespace AppLauncher.Windows.Forms
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
//
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(94, 26);
//
//
// exitToolStripMenuItem
//
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(93, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
//
// AForm
//
//
this.ClientSize = new System.Drawing.Size(421, 321);
this.Controls.Add(this.panel1);
this.Controls.Add(this.imageBox1);

View File

@ -0,0 +1,191 @@
using AppLauncher.Models;
using RyzStudio.Windows.ThemedForms;
using System;
using System.Drawing;
using System.Text;
namespace AppLauncher.Windows.Forms
{
public class OptionsForm : TDialogForm
{
private System.Windows.Forms.Label label1;
private TButton button1;
private TTextBox textBox1;
public MainForm parentForm { get; set; } = null;
protected Point hotKey = new Point(-1, -1);
public OptionsForm(MainForm parent) : base()
{
InitializeComponent();
parentForm = parent;
textBox1.InnerTextBox.ReadOnly = true;
textBox1.InnerTextBox.BackColor = Color.White;
textBox1.InnerTextBox.KeyUp += textBox1_KeyUp;
}
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout();
//
// imgbxClose
//
this.imgbxClose.Image = ((System.Drawing.Image)(resources.GetObject("imgbxClose.Image")));
this.imgbxClose.Location = new System.Drawing.Point(367, 5);
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(394, 474);
//
// area1
//
this.area1.Location = new System.Drawing.Point(1, 474);
this.area1.Size = new System.Drawing.Size(392, 5);
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.BackColor = System.Drawing.Color.Transparent;
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.textBox1.Location = new System.Drawing.Point(159, 50);
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
this.textBox1.Name = "textBox1";
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
this.textBox1.Size = new System.Drawing.Size(220, 32);
this.textBox1.SubmitButton = null;
this.textBox1.TabIndex = 152;
this.textBox1.UseSystemPasswordChar = false;
//
// label1
//
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.Location = new System.Drawing.Point(18, 50);
this.label1.Margin = new System.Windows.Forms.Padding(0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(131, 32);
this.label1.TabIndex = 153;
this.label1.Text = "Hotkey";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.DefaultImage = null;
this.button1.DownImage = null;
this.button1.IsSelected = false;
this.button1.LabelText = "&Save";
this.button1.Location = new System.Drawing.Point(251, 427);
this.button1.Name = "button1";
this.button1.OverImage = null;
this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
this.button1.Size = new System.Drawing.Size(128, 32);
this.button1.TabIndex = 173;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// OptionsForm
//
this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Name = "OptionsForm";
this.Title = "Options";
this.Controls.SetChildIndex(this.imgbxClose, 0);
this.Controls.SetChildIndex(this.panel1, 0);
this.Controls.SetChildIndex(this.area1, 0);
this.Controls.SetChildIndex(this.textBox1, 0);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.button1, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
if (parentForm != null)
{
bool control = false;
bool alt = false;
bool shift = false;
int hotKeyCode = parentForm.GlobalHotKey.X;
if (hotKeyCode >= 4)
{
shift = true;
hotKeyCode -= 4;
}
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)
{
if (parentForm != null)
{
parentForm.SetHotKey(hotKey);
}
this.Close();
}
private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == System.Windows.Forms.Keys.ControlKey) return;
if (e.KeyCode == System.Windows.Forms.Keys.ShiftKey) return;
if (e.KeyCode == System.Windows.Forms.Keys.Menu) return;
StringBuilder sb = new StringBuilder();
if (e.Control) sb = sb.Append("Ctrl + ");
if (e.Alt) sb = sb.Append("Alt + ");
if (e.Shift) sb = sb.Append("Shift + ");
int keyModifier = 0;
if (e.Alt) keyModifier += 1;
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

@ -0,0 +1,131 @@
<?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="imgbxClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAABh0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMS4xYyqcSwAAANlJREFUOE+lU1sO
gjAQrHgRY6KemQ+VT9NrgAfgfRA+SawzdTAk2lhkkgm7s7vTAq0py/LUNM0dHEEXSfYWfd8fDQIOD23b
nvFMY6jeAcxpMFIwC1HX9YWzNOCWUunR4AxnvxpUVbV3zm2UGsbUlHoEDfBhdsgf4BWDCcmYGmtqCxtw
NeQcoJ6JjGn43hXy8CvIxDeIGbREZY+pHjLgtqeVHf7SzVq7VdmDM6x9GGj1/19h9UckVv3GWMwNRh5L
6dGYH+UCHCTQ9SfV+7pMvJIIaLL0Oudd1x2eUQ8MyeAeq0cAAAAASUVORK5CYII=
</value>
</data>
</root>