Changed: start-up in hidden state

This commit is contained in:
Ray 2020-05-20 01:24:07 +01:00
parent 1d96222514
commit e3404c34b3
3 changed files with 74 additions and 52 deletions

30
MainForm.Designer.cs generated
View File

@ -79,7 +79,7 @@
this.toolStripMenuItem3, this.toolStripMenuItem3,
this.toolStripMenuItem9}); this.toolStripMenuItem9});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 92); this.contextMenuStrip1.Size = new System.Drawing.Size(102, 70);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
// //
// toolStripMenuItem4 // toolStripMenuItem4
@ -95,63 +95,63 @@
this.toolStripMenuItem10, this.toolStripMenuItem10,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.toolStripMenuItem4.Name = "toolStripMenuItem4"; this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem4.Size = new System.Drawing.Size(101, 22);
this.toolStripMenuItem4.Text = "&File"; this.toolStripMenuItem4.Text = "&File";
// //
// toolStripMenuItem5 // toolStripMenuItem5
// //
this.toolStripMenuItem5.Name = "toolStripMenuItem5"; this.toolStripMenuItem5.Name = "toolStripMenuItem5";
this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem5.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem5.Text = "&New"; this.toolStripMenuItem5.Text = "&New";
this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click); this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
// //
// toolStripMenuItem7 // toolStripMenuItem7
// //
this.toolStripMenuItem7.Name = "toolStripMenuItem7"; this.toolStripMenuItem7.Name = "toolStripMenuItem7";
this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem7.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem7.Text = "&Open"; this.toolStripMenuItem7.Text = "&Open";
this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click); this.toolStripMenuItem7.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
// //
// toolStripMenuItem8 // toolStripMenuItem8
// //
this.toolStripMenuItem8.Name = "toolStripMenuItem8"; this.toolStripMenuItem8.Name = "toolStripMenuItem8";
this.toolStripMenuItem8.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem8.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem8.Text = "&Close"; this.toolStripMenuItem8.Text = "&Close";
this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click); this.toolStripMenuItem8.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6);
// //
// toolStripMenuItem6 // toolStripMenuItem6
// //
this.toolStripMenuItem6.Name = "toolStripMenuItem6"; this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem6.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem6.Text = "&Save"; this.toolStripMenuItem6.Text = "&Save";
this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click); this.toolStripMenuItem6.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
// //
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem2.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem2.Text = "Save &As..."; this.toolStripMenuItem2.Text = "Save &As...";
this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click); this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
// //
// toolStripMenuItem10 // toolStripMenuItem10
// //
this.toolStripMenuItem10.Name = "toolStripMenuItem10"; this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6); this.toolStripMenuItem10.Size = new System.Drawing.Size(120, 6);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
@ -160,7 +160,7 @@
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1}); this.toolStripMenuItem1});
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem3.Size = new System.Drawing.Size(101, 22);
this.toolStripMenuItem3.Text = "&View"; this.toolStripMenuItem3.Text = "&View";
// //
// toolStripMenuItem1 // toolStripMenuItem1
@ -175,13 +175,13 @@
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionToolStripMenuItem}); this.optionToolStripMenuItem});
this.toolStripMenuItem9.Name = "toolStripMenuItem9"; this.toolStripMenuItem9.Name = "toolStripMenuItem9";
this.toolStripMenuItem9.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem9.Size = new System.Drawing.Size(101, 22);
this.toolStripMenuItem9.Text = "&Tools"; this.toolStripMenuItem9.Text = "&Tools";
// //
// optionToolStripMenuItem // optionToolStripMenuItem
// //
this.optionToolStripMenuItem.Name = "optionToolStripMenuItem"; this.optionToolStripMenuItem.Name = "optionToolStripMenuItem";
this.optionToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.optionToolStripMenuItem.Size = new System.Drawing.Size(116, 22);
this.optionToolStripMenuItem.Text = "&Options"; this.optionToolStripMenuItem.Text = "&Options";
this.optionToolStripMenuItem.Click += new System.EventHandler(this.optionToolStripMenuItem_Click); this.optionToolStripMenuItem.Click += new System.EventHandler(this.optionToolStripMenuItem_Click);
// //
@ -218,10 +218,12 @@
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(633, 400); this.ClientSize = new System.Drawing.Size(633, 400);
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(633, 280); this.MinimumSize = new System.Drawing.Size(633, 280);
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "Launcher"; this.Text = "Launcher";
this.Visible = false;
this.TitleContextMenuStrip = this.contextMenuStrip1; this.TitleContextMenuStrip = this.contextMenuStrip1;
this.Controls.SetChildIndex(this.flowLayoutPanel1, 0); this.Controls.SetChildIndex(this.flowLayoutPanel1, 0);
this.Controls.SetChildIndex(this.imageBox3, 0); this.Controls.SetChildIndex(this.imageBox3, 0);

View File

@ -27,9 +27,6 @@ namespace AppLauncher
//protected const int MOD_WIN = 0x8; //protected const int MOD_WIN = 0x8;
protected const int WM_HOTKEY = 0x312; protected const int WM_HOTKEY = 0x312;
protected int collapsedWidth = 40;
protected int expandedWidth = 800;
protected OptionsForm optionsForm = null; protected OptionsForm optionsForm = null;
protected string sessionFilename = null; protected string sessionFilename = null;
@ -38,14 +35,18 @@ namespace AppLauncher
InitializeComponent(); InitializeComponent();
this.StartPosition = FormStartPosition.WindowsDefaultBounds; this.StartPosition = FormStartPosition.WindowsDefaultBounds;
this.Visible = false;
} }
protected async override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
this.Visible = false; ThreadControl.SetVisible(this, false);
base.OnLoad(e); base.OnLoad(e);
}
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig"); string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
if (File.Exists(jsonfigFilename)) if (File.Exists(jsonfigFilename))
@ -53,23 +54,7 @@ namespace AppLauncher
await loadFile(jsonfigFilename); await loadFile(jsonfigFilename);
} }
this.Visible = true;
}
protected override void OnShown(EventArgs e)
{
//this.Visible = false;
base.OnShown(e);
//string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
//if (File.Exists(jsonfigFilename))
//{
// loadFile(jsonfigFilename);
//}
//this.Location = this.DefaultLocation; //this.Location = this.DefaultLocation;
//this.Visible = true;
} }
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
@ -128,22 +113,6 @@ namespace AppLauncher
public LauncherSession CurrentSession { get; set; } = null; public LauncherSession CurrentSession { get; set; } = null;
public async Task ToggleSize()
{
if (this.Width > collapsedWidth)
{
flowLayoutPanel1.Visible = false;
await collapseWindow(collapsedWidth, 6);
}
else
{
await expandWindow(expandedWidth, 8);
flowLayoutPanel1.Visible = true;
}
}
/// <summary> /// <summary>
/// New /// New
/// </summary> /// </summary>
@ -439,6 +408,7 @@ namespace AppLauncher
// //
ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop); ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
ThreadControl.SetVisible(this, true);
}); });
} }

View File

@ -149,6 +149,56 @@ namespace RyzStudio.Windows.Forms
} }
} }
public static void SetVisible(Control control, bool value)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
control.Visible = value;
}));
}
else
{
control.Visible = value;
}
}
public static void SetVisible(Form control, bool value)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(() => {
if (value)
{
control.ShowInTaskbar = value;
control.Opacity = 100;
control.Visible = value;
}
else
{
control.Visible = value;
control.ShowInTaskbar = value;
control.Opacity = 0;
}
}));
}
else
{
if (value)
{
control.ShowInTaskbar = value;
control.Opacity = 100;
control.Visible = value;
}
else
{
control.Visible = value;
control.ShowInTaskbar = value;
control.Opacity = 0;
}
}
}
public static void SetWidth(Control control, int value) public static void SetWidth(Control control, int value)
{ {
if (control.InvokeRequired) if (control.InvokeRequired)