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.toolStripMenuItem9});
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);
//
// toolStripMenuItem4
@ -95,63 +95,63 @@
this.toolStripMenuItem10,
this.exitToolStripMenuItem});
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";
//
// 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.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
//
// 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.Click += new System.EventHandler(this.toolStripMenuItem7_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
//
// 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.Click += new System.EventHandler(this.toolStripMenuItem8_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6);
//
// 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.Click += new System.EventHandler(this.toolStripMenuItem6_Click);
//
// 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.Click += new System.EventHandler(this.toolStripMenuItem2_Click);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(177, 6);
this.toolStripMenuItem10.Size = new System.Drawing.Size(120, 6);
//
// 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.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@ -160,7 +160,7 @@
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem1});
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";
//
// toolStripMenuItem1
@ -175,13 +175,13 @@
this.toolStripMenuItem9.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.optionToolStripMenuItem});
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";
//
// 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.Click += new System.EventHandler(this.optionToolStripMenuItem_Click);
//
@ -218,10 +218,12 @@
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(633, 400);
this.Controls.Add(this.flowLayoutPanel1);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(633, 280);
this.Name = "MainForm";
this.Text = "Launcher";
this.Visible = false;
this.TitleContextMenuStrip = this.contextMenuStrip1;
this.Controls.SetChildIndex(this.flowLayoutPanel1, 0);
this.Controls.SetChildIndex(this.imageBox3, 0);

View File

@ -27,9 +27,6 @@ namespace AppLauncher
//protected const int MOD_WIN = 0x8;
protected const int WM_HOTKEY = 0x312;
protected int collapsedWidth = 40;
protected int expandedWidth = 800;
protected OptionsForm optionsForm = null;
protected string sessionFilename = null;
@ -38,14 +35,18 @@ namespace AppLauncher
InitializeComponent();
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);
}
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
if (File.Exists(jsonfigFilename))
@ -53,23 +54,7 @@ namespace AppLauncher
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.Visible = true;
}
protected override void OnClosing(CancelEventArgs e)
@ -128,22 +113,6 @@ namespace AppLauncher
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>
/// New
/// </summary>
@ -439,6 +408,7 @@ namespace AppLauncher
//
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)
{
if (control.InvokeRequired)