Added: hide on click

This commit is contained in:
Ray 2020-05-20 02:03:12 +01:00
parent 7cba0b6247
commit 30149df2a4
4 changed files with 74 additions and 1 deletions

View File

@ -22,6 +22,7 @@ namespace AppLauncher.Models
public HotKeyOptions HotKey { get; set; } = null; public HotKeyOptions HotKey { get; set; } = null;
public bool AlwaysOnTop { get; set; } = false; public bool AlwaysOnTop { get; set; } = false;
public bool HideOnClose { get; set; } = false; public bool HideOnClose { get; set; } = false;
public bool HideOnClick { get; set; } = false;
public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>(); public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
public LauncherSession ToSimple() public LauncherSession ToSimple()
@ -32,6 +33,7 @@ namespace AppLauncher.Models
HotKey = this.HotKey, HotKey = this.HotKey,
AlwaysOnTop = this.AlwaysOnTop, AlwaysOnTop = this.AlwaysOnTop,
HideOnClose = this.HideOnClose, HideOnClose = this.HideOnClose,
HideOnClick = this.HideOnClick,
Groups = null Groups = null
}; };
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.035")] [assembly: AssemblyVersion("0.1.1.94")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -21,6 +21,8 @@ namespace AppLauncher.Windows.Forms
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TYesNoPickerBox pickerBox4; private TYesNoPickerBox pickerBox4;
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private TYesNoPickerBox pickerBox5;
private System.Windows.Forms.Label label7;
public MainForm parentForm { get; set; } = null; public MainForm parentForm { get; set; } = null;
protected LauncherSession.HotKeyOptions hotKeyOptions = null; protected LauncherSession.HotKeyOptions hotKeyOptions = null;
@ -52,6 +54,8 @@ namespace AppLauncher.Windows.Forms
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox(); this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.pickerBox5 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
this.label7 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -243,9 +247,38 @@ namespace AppLauncher.Windows.Forms
this.label6.Text = "Hide On Close"; this.label6.Text = "Hide On Close";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
// //
// pickerBox5
//
this.pickerBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pickerBox5.BackColor = System.Drawing.Color.Transparent;
this.pickerBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
this.pickerBox5.Location = new System.Drawing.Point(159, 300);
this.pickerBox5.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
this.pickerBox5.Name = "pickerBox5";
this.pickerBox5.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
this.pickerBox5.Size = new System.Drawing.Size(220, 32);
this.pickerBox5.SubmitButton = null;
this.pickerBox5.TabIndex = 185;
this.pickerBox5.Value = true;
//
// label7
//
this.label7.BackColor = System.Drawing.Color.Transparent;
this.label7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(95)))), ((int)(((byte)(99)))), ((int)(((byte)(104)))));
this.label7.Location = new System.Drawing.Point(18, 300);
this.label7.Margin = new System.Windows.Forms.Padding(0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(131, 32);
this.label7.TabIndex = 184;
this.label7.Text = "Hide On Click";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// OptionsForm // OptionsForm
// //
this.ClientSize = new System.Drawing.Size(400, 480); this.ClientSize = new System.Drawing.Size(400, 480);
this.Controls.Add(this.pickerBox5);
this.Controls.Add(this.label7);
this.Controls.Add(this.pickerBox4); this.Controls.Add(this.pickerBox4);
this.Controls.Add(this.label6); this.Controls.Add(this.label6);
this.Controls.Add(this.horizontalSeparator2); this.Controls.Add(this.horizontalSeparator2);
@ -277,6 +310,8 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.horizontalSeparator2, 0); this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.label6, 0); this.Controls.SetChildIndex(this.label6, 0);
this.Controls.SetChildIndex(this.pickerBox4, 0); this.Controls.SetChildIndex(this.pickerBox4, 0);
this.Controls.SetChildIndex(this.label7, 0);
this.Controls.SetChildIndex(this.pickerBox5, 0);
((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@ -314,6 +349,7 @@ namespace AppLauncher.Windows.Forms
} }
pickerBox4.Value = parentForm.CurrentSession.HideOnClose; pickerBox4.Value = parentForm.CurrentSession.HideOnClose;
pickerBox5.Value = parentForm.CurrentSession.HideOnClick;
} }
@ -332,6 +368,7 @@ namespace AppLauncher.Windows.Forms
parentForm.CurrentSession.HotKey.Key = hotKeyOptions.Key; parentForm.CurrentSession.HotKey.Key = hotKeyOptions.Key;
parentForm.CurrentSession.HideOnClose = pickerBox4.Value; parentForm.CurrentSession.HideOnClose = pickerBox4.Value;
parentForm.CurrentSession.HideOnClick = pickerBox5.Value;
} }

View File

@ -1,4 +1,5 @@
using AppLauncher.Models; using AppLauncher.Models;
using RyzStudio.Windows.Forms;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
@ -218,6 +219,18 @@ namespace AppLauncher.Windows.Forms
if (!string.IsNullOrWhiteSpace(model.ProcessWorkingDirectory)) p.WorkingDirectory = model.ProcessWorkingDirectory; if (!string.IsNullOrWhiteSpace(model.ProcessWorkingDirectory)) p.WorkingDirectory = model.ProcessWorkingDirectory;
if (model.ProcessAsAdmin) p.Verb = "runas"; if (model.ProcessAsAdmin) p.Verb = "runas";
MainForm parentForm = findMainForm();
if (parentForm != null)
{
if (parentForm.CurrentSession != null)
{
if (parentForm.CurrentSession.HideOnClick)
{
parentForm.Visible = false;
}
}
}
try try
{ {
Process.Start(p); Process.Start(p);
@ -267,6 +280,27 @@ namespace AppLauncher.Windows.Forms
} }
protected MainForm findMainForm()
{
Control item = this;
while (true)
{
item = item.Parent;
if (item == null)
{
return null;
}
if (item.GetType() == typeof(MainForm))
{
return (item as MainForm);
}
}
return null;
}
private void toolItem_Click(object sender, EventArgs e) private void toolItem_Click(object sender, EventArgs e)
{ {
if (sender.GetType() != typeof(ToolStripMenuItem)) if (sender.GetType() != typeof(ToolStripMenuItem))