Add support for explicit WindowSize on SetupWizards
This commit is contained in:
parent
a977c181f2
commit
3f2455c9fa
3 changed files with 17 additions and 5 deletions
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -39,6 +40,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
WizardPage GetNextPage();
|
||||
|
||||
Vector2 WindowSize { get; }
|
||||
|
||||
WizardPage CurrentPage { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -47,6 +48,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public WizardPage CurrentPage => pages.Current;
|
||||
|
||||
public Vector2 WindowSize { get; protected set; }
|
||||
|
||||
public WizardPage GetNextPage()
|
||||
{
|
||||
// Shutdown active page
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ namespace MatterHackers.MatterControl
|
|||
DialogWindow wizardWindow = GetWindow(setupWizard.GetType());
|
||||
wizardWindow.Title = setupWizard.WindowTitle;
|
||||
|
||||
if (setupWizard.WindowSize != Vector2.Zero)
|
||||
{
|
||||
wizardWindow.Size = setupWizard.WindowSize;
|
||||
}
|
||||
|
||||
SetSizeAndShow(wizardWindow, setupWizard.CurrentPage);
|
||||
|
||||
wizardWindow.ChangeToPage(setupWizard.CurrentPage);
|
||||
|
|
@ -133,16 +138,17 @@ namespace MatterHackers.MatterControl
|
|||
set => base.MinimumSize = value;
|
||||
}
|
||||
|
||||
public static void SetSizeAndShow(DialogWindow wizardWindow, DialogPage wizardPage)
|
||||
public static void SetSizeAndShow(DialogWindow dialogWindow, DialogPage wizardPage)
|
||||
{
|
||||
if (wizardPage.WindowSize != Vector2.Zero)
|
||||
if (dialogWindow.Size == Vector2.Zero
|
||||
&& wizardPage.WindowSize != Vector2.Zero)
|
||||
{
|
||||
wizardWindow.Size = wizardPage.WindowSize;
|
||||
dialogWindow.Size = wizardPage.WindowSize;
|
||||
}
|
||||
|
||||
wizardWindow.AlwaysOnTopOfMain = wizardPage.AlwaysOnTopOfMain;
|
||||
dialogWindow.AlwaysOnTopOfMain = wizardPage.AlwaysOnTopOfMain;
|
||||
|
||||
wizardWindow.ShowAsSystemWindow();
|
||||
dialogWindow.ShowAsSystemWindow();
|
||||
}
|
||||
|
||||
public static bool IsOpen(Type type) => allWindows.ContainsKey(type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue