Added: hide-on-close option

This commit is contained in:
Ray 2020-05-20 01:42:51 +01:00
parent e3404c34b3
commit 7cba0b6247
4 changed files with 88 additions and 17 deletions

View File

@ -275,6 +275,28 @@ namespace AppLauncher
invalidateHotKey();
}
protected override void imageBox3_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (this.CurrentSession == null)
{
this.Close();
}
else
{
if (this.CurrentSession.HideOnClose)
{
this.Visible = !this.Visible;
}
else
{
this.Close();
}
}
}
}
protected async Task collapseWindow(int width, int increment = 6)
{
await Task.Run(() =>

View File

@ -21,6 +21,7 @@ namespace AppLauncher.Models
public int DefaultHeight { get; set; } = 280;
public HotKeyOptions HotKey { get; set; } = null;
public bool AlwaysOnTop { get; set; } = false;
public bool HideOnClose { get; set; } = false;
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
public LauncherSession ToSimple()
@ -30,6 +31,7 @@ namespace AppLauncher.Models
DefaultHeight = this.DefaultHeight,
HotKey = this.HotKey,
AlwaysOnTop = this.AlwaysOnTop,
HideOnClose = this.HideOnClose,
Groups = null
};
}

View File

@ -337,7 +337,7 @@ namespace AppLauncher.Windows.Forms
}
}
private void imageBox3_MouseClick(object sender, MouseEventArgs e)
protected virtual void imageBox3_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{

View File

@ -19,6 +19,8 @@ namespace AppLauncher.Windows.Forms
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TYesNoPickerBox pickerBox4;
private System.Windows.Forms.Label label6;
public MainForm parentForm { get; set; } = null;
protected LauncherSession.HotKeyOptions hotKeyOptions = null;
@ -32,7 +34,6 @@ namespace AppLauncher.Windows.Forms
textBox1.InnerTextBox.ReadOnly = true;
textBox1.InnerTextBox.BackColor = Color.White;
textBox1.InnerTextBox.KeyUp += textBox1_KeyUp;
}
private void InitializeComponent()
@ -49,6 +50,8 @@ namespace AppLauncher.Windows.Forms
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label6 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout();
//
@ -129,7 +132,7 @@ namespace AppLauncher.Windows.Forms
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.Location = new System.Drawing.Point(8, 50);
this.label2.Margin = new System.Windows.Forms.Padding(0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(131, 24);
@ -213,9 +216,38 @@ namespace AppLauncher.Windows.Forms
this.horizontalSeparator2.Size = new System.Drawing.Size(380, 2);
this.horizontalSeparator2.TabIndex = 181;
//
// pickerBox4
//
this.pickerBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox4.BackColor = System.Drawing.Color.Transparent;
this.pickerBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox4.Location = new System.Drawing.Point(159, 259);
this.pickerBox4.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox4.Name = "pickerBox4";
this.pickerBox4.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox4.Size = new System.Drawing.Size(220, 32);
this.pickerBox4.SubmitButton = null;
this.pickerBox4.TabIndex = 183;
this.pickerBox4.Value = true;
//
// label6
//
this.label6.BackColor = System.Drawing.Color.Transparent;
this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label6.Location = new System.Drawing.Point(18, 259);
this.label6.Margin = new System.Windows.Forms.Padding(0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(131, 32);
this.label6.TabIndex = 182;
this.label6.Text = "Hide On Close";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// OptionsForm
//
this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.pickerBox4);
this.Controls.Add(this.label6);
this.Controls.Add(this.horizontalSeparator2);
this.Controls.Add(this.label5);
this.Controls.Add(this.pickerBox3);
@ -243,6 +275,8 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.pickerBox3, 0);
this.Controls.SetChildIndex(this.label5, 0);
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.label6, 0);
this.Controls.SetChildIndex(this.pickerBox4, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false);
@ -254,8 +288,17 @@ namespace AppLauncher.Windows.Forms
if (hotKeyOptions == null) hotKeyOptions = new LauncherSession.HotKeyOptions();
if (parentForm != null)
if (parentForm == null)
{
return;
}
if (parentForm.CurrentSession == null)
{
return;
}
// hotkey
if (parentForm.CurrentSession.HotKey != null)
{
hotKeyOptions.IsCtrl = parentForm.CurrentSession.HotKey.IsCtrl;
@ -269,7 +312,8 @@ namespace AppLauncher.Windows.Forms
textBox1.Text = hotKeyOptions.KeyCode.ToString();
}
}
pickerBox4.Value = parentForm.CurrentSession.HideOnClose;
}
@ -286,6 +330,9 @@ namespace AppLauncher.Windows.Forms
parentForm.CurrentSession.HotKey.IsAlt = pickerBox2.Value;
parentForm.CurrentSession.HotKey.IsShift = pickerBox3.Value;
parentForm.CurrentSession.HotKey.Key = hotKeyOptions.Key;
parentForm.CurrentSession.HideOnClose = pickerBox4.Value;
}
this.Close();