mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-16 09:05:34 -05:00
feat(desktop): open the Drawing Sets window as a maximized MDI child
File > Drawing Library, Drawing Sets, Releases and database-mode Import BOM now open the window inside the main form, maximized, instead of as a modal dialog. A second menu click activates the open window on the tab asked for. Close now closes the window, since a DialogResult button no longer does outside a modal dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a6056a6065
commit
3f5d402489
2 files changed
+31
-4
No files matched your search
@@ -43,6 +43,8 @@ namespace OpenNest.Forms
|
||||
libraryView.ShowReleases = drawing => _ = ShowReleasesAsync(drawing: drawing);
|
||||
releasesView.Initialize(sets);
|
||||
Text = $"Drawing Library — {serverUrl}";
|
||||
// Shown as an MDI child, where a DialogResult button no longer closes the window.
|
||||
closeButton.Click += (_, _) => Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,6 +86,13 @@ namespace OpenNest.Forms
|
||||
/// </summary>
|
||||
public bool ImportBomWhenShown { get; set; }
|
||||
|
||||
/// <summary>Switches to the Sets tab and opens Import BOM on it.</summary>
|
||||
public Task ImportBomAsync()
|
||||
{
|
||||
ShowSets();
|
||||
return browser.ImportBomAsync();
|
||||
}
|
||||
|
||||
private async void DrawingSetsForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
shown = true;
|
||||
@@ -91,8 +100,7 @@ namespace OpenNest.Forms
|
||||
if (ImportBomWhenShown && !IsDisposed)
|
||||
{
|
||||
ImportBomWhenShown = false;
|
||||
ShowSets();
|
||||
await browser.ImportBomAsync();
|
||||
await ImportBomAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,22 @@ namespace OpenNest.Forms
|
||||
if (!NestStorage.Settings.IsDatabaseMode)
|
||||
return;
|
||||
|
||||
// One Drawing Sets window at a time: a second menu click brings it forward on the tab asked for.
|
||||
var open = MdiChildren.OfType<DrawingSetsForm>().FirstOrDefault();
|
||||
if (open != null)
|
||||
{
|
||||
open.Activate();
|
||||
if (releases)
|
||||
_ = open.ShowReleasesAsync();
|
||||
else if (libraryTab)
|
||||
open.ShowLibrary();
|
||||
else if (importBom)
|
||||
_ = open.ImportBomAsync();
|
||||
else
|
||||
open.ShowSets();
|
||||
return;
|
||||
}
|
||||
|
||||
IDrawingLibraryStore library;
|
||||
IDrawingSetStore sets;
|
||||
INestRepository nests;
|
||||
@@ -158,14 +174,17 @@ namespace OpenNest.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
using var form = new DrawingSetsForm(sets, library, NestStorage.Settings.ServerUrl);
|
||||
// An MDI child beside the nest tabs, maximized when it opens; disposed when closed.
|
||||
var form = new DrawingSetsForm(sets, library, NestStorage.Settings.ServerUrl);
|
||||
form.EnableRelease(nests, OpenServerNest, IsServerNestOpen);
|
||||
if (releases)
|
||||
_ = form.ShowReleasesAsync();
|
||||
else if (libraryTab)
|
||||
form.ShowLibrary();
|
||||
form.ImportBomWhenShown = importBom;
|
||||
form.ShowDialog(this);
|
||||
form.MdiParent = this;
|
||||
form.WindowState = FormWindowState.Maximized;
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private async void Save_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in new issue
Block a user