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

+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))