Added: hide on click

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

No files matched your search

+37
View File
@@ -21,6 +21,8 @@ namespace AppLauncher.Windows.Forms
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
private TYesNoPickerBox pickerBox4;
private System.Windows.Forms.Label label6;
private TYesNoPickerBox pickerBox5;
private System.Windows.Forms.Label label7;
public MainForm parentForm { get; set; } = null;
protected LauncherSession.HotKeyOptions hotKeyOptions = null;
@@ -52,6 +54,8 @@ namespace AppLauncher.Windows.Forms
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
this.pickerBox4 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
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();
this.SuspendLayout();
//
@@ -243,9 +247,38 @@ namespace AppLauncher.Windows.Forms
this.label6.Text = "Hide On Close";
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
//
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.label6);
this.Controls.Add(this.horizontalSeparator2);
@@ -277,6 +310,8 @@ namespace AppLauncher.Windows.Forms
this.Controls.SetChildIndex(this.horizontalSeparator2, 0);
this.Controls.SetChildIndex(this.label6, 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();
this.ResumeLayout(false);
@@ -314,6 +349,7 @@ namespace AppLauncher.Windows.Forms
}
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.HideOnClose = pickerBox4.Value;
parentForm.CurrentSession.HideOnClick = pickerBox5.Value;
}
+34
View File
@@ -1,4 +1,5 @@
using AppLauncher.Models;
using RyzStudio.Windows.Forms;
using System;
using System.ComponentModel;
using System.Diagnostics;
@@ -218,6 +219,18 @@ namespace AppLauncher.Windows.Forms
if (!string.IsNullOrWhiteSpace(model.ProcessWorkingDirectory)) p.WorkingDirectory = model.ProcessWorkingDirectory;
if (model.ProcessAsAdmin) p.Verb = "runas";
MainForm parentForm = findMainForm();
if (parentForm != null)
{
if (parentForm.CurrentSession != null)
{
if (parentForm.CurrentSession.HideOnClick)
{
parentForm.Visible = false;
}
}
}
try
{
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)
{
if (sender.GetType() != typeof(ToolStripMenuItem))