Merge pull request #883 from jlewin/master

Rename WizardPanels to WizardPage
This commit is contained in:
johnlewin 2016-06-08 10:24:52 -07:00
commit 97123744b5
18 changed files with 83 additions and 69 deletions

View file

@ -35,7 +35,7 @@ using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl
{
public class InstructionsPage : WizardPage
public class InstructionsPage : WizardControlPage
{
double extraTextScaling = 1;
protected FlowLayoutWidget topToBottomControls;

View file

@ -7,13 +7,13 @@ using System.Collections.Generic;
namespace MatterHackers.MatterControl
{
public class WizardPage : GuiWidget
public class WizardControlPage : GuiWidget
{
private string stepDescription = "";
public string StepDescription { get { return stepDescription; } set { stepDescription = value; } }
public WizardPage(string stepDescription)
public WizardControlPage(string stepDescription)
{
StepDescription = stepDescription;
}
@ -33,7 +33,7 @@ namespace MatterHackers.MatterControl
protected TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
private FlowLayoutWidget bottomToTopLayout;
private List<WizardPage> pages = new List<WizardPage>();
private List<WizardControlPage> pages = new List<WizardControlPage>();
private int pageIndex = 0;
public Button backButton;
public Button nextButton;
@ -210,7 +210,7 @@ namespace MatterHackers.MatterControl
}
}
public void AddPage(WizardPage widgetForPage)
public void AddPage(WizardControlPage widgetForPage)
{
pages.Add(widgetForPage);
bottomToTopLayout.AddChild(widgetForPage);

View file

@ -246,9 +246,9 @@
<Compile Include="Library\Provider\LibraryProvider.cs" />
<Compile Include="Queue\OptionsMenu\ExportGcodePlugin.cs" />
<Compile Include="Queue\OptionsMenu\MergeQueueItems.cs" />
<Compile Include="SetupWizard\AndroidConnectDevicePanel.cs" />
<Compile Include="SetupWizard\WizardPanel.cs" />
<Compile Include="SetupWizard\SetupWizardHome.cs" />
<Compile Include="SetupWizard\AndroidConnectDevicePage.cs" />
<Compile Include="SetupWizard\WizardPage.cs" />
<Compile Include="SetupWizard\AndroidSetupOptionsPage.cs" />
<Compile Include="SetupWizard\SetupWizardTroubleshooting.cs" />
<Compile Include="SetupWizard\SetupWizardWifi.cs" />
<Compile Include="SetupWizard\WizardWindow.cs" />
@ -336,7 +336,7 @@
<Compile Include="PrinterControls\ManualPrinterControls.cs" />
<Compile Include="PrinterControls\PrinterConnections\BaseConnectionWidget.cs" />
<Compile Include="PrinterControls\PrinterConnections\PrinterChooser.cs" />
<Compile Include="PrinterControls\PrinterConnections\ConnectionWizardPanel.cs" />
<Compile Include="PrinterControls\PrinterConnections\ConnectionWizardPage.cs" />
<Compile Include="PrinterControls\TemperatureIndicator.cs" />
<Compile Include="PrinterControls\XYZJogControls.cs" />
<Compile Include="Library\LibraryDataView.cs" />

View file

@ -8,11 +8,11 @@ using System;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class ConnectionWizardPanel : WizardPanel
public class ConnectionWizardPage : WizardPage
{
private PrinterInfo activePrinter;
public ConnectionWizardPanel() : base("Cancel")
public ConnectionWizardPage() : base("Cancel")
{
cancelButton.Click += (s, e) => PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
}

View file

@ -7,7 +7,7 @@ using System.Collections.Generic;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class SetupStepBaudRate : ConnectionWizardPanel
public class SetupStepBaudRate : ConnectionWizardPage
{
private List<RadioButton> BaudRateButtonsList = new List<RadioButton>();
private FlowLayoutWidget printerBaudRateContainer;

View file

@ -13,7 +13,7 @@ using System.Text.RegularExpressions;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class SetupStepComPortManual : ConnectionWizardPanel
public class SetupStepComPortManual : ConnectionWizardPage
{
private static Regex linuxDefaultUIFilter = new Regex("/dev/ttyS*\\d+", RegexOptions.CultureInvariant | RegexOptions.Compiled);
@ -46,7 +46,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton.Click += ConnectButton_Click;
refreshButton = textImageButtonFactory.Generate("Refresh".Localize());
refreshButton.Click += (s, e) => WizardWindow.ChangeToPanel<SetupStepComPortManual>();
refreshButton.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);

View file

@ -7,7 +7,7 @@ using System;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class SetupStepComPortOne : ConnectionWizardPanel
public class SetupStepComPortOne : ConnectionWizardPage
{
private Button nextButton;
@ -17,7 +17,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
//Construct buttons
nextButton = textImageButtonFactory.Generate("Continue".Localize());
nextButton.Click += (s, e) => WizardWindow.ChangeToPanel<SetupStepComPortTwo>();
nextButton.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortTwo>();
//Add buttons to buttonContainer
footerRow.AddChild(nextButton);
@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
Button manualLink = linkButtonFactory.Generate(LocalizedString.Get("Manually Configure Connection"));
manualLink.Margin = new BorderDouble(0, 5);
manualLink.Click += (s, e) => WizardWindow.ChangeToPanel<SetupStepComPortManual>();
manualLink.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();
string printerMessageFourText = LocalizedString.Get("or");
TextWidget printerMessageFour = new TextWidget(printerMessageFourText, 0, 0, 10);

View file

@ -10,7 +10,7 @@ using System.Linq;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class SetupStepComPortTwo : ConnectionWizardPanel
public class SetupStepComPortTwo : ConnectionWizardPage
{
private string[] startingPortNames;
private string[] currentPortNames;
@ -97,7 +97,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
Button manualLink = linkButtonFactory.Generate("Manual Configuration".Localize());
manualLink.Margin = new BorderDouble(0, 5);
manualLink.Click += (s, e) => WizardWindow.ChangeToPanel<SetupStepComPortManual>();
manualLink.Click += (s, e) => WizardWindow.ChangeToPage<SetupStepComPortManual>();
printerErrorMessage = new TextWidget("", 0, 0, 10);
printerErrorMessage.AutoExpandBoundsToText = true;

View file

@ -11,7 +11,7 @@ using System.IO;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class SetupStepInstallDriver : ConnectionWizardPanel
public class SetupStepInstallDriver : ConnectionWizardPage
{
private FlowLayoutWidget printerDriverContainer;
private TextWidget printerDriverMessage;

View file

@ -14,7 +14,7 @@ using System.IO;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
//Normally step one of the setup process
public class SetupStepMakeModelName : ConnectionWizardPanel
public class SetupStepMakeModelName : ConnectionWizardPage
{
private FlowLayoutWidget printerModelContainer;
private FlowLayoutWidget printerMakeContainer;
@ -84,9 +84,9 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
if (canContinue)
{
#if __ANDROID__
WizardWindow.ChangeToPanel<AndroidConnectDevicePanel>();
WizardWindow.ChangeToPage<AndroidConnectDevicePage>();
#else
WizardWindow.ChangeToPanel<SetupStepInstallDriver>();
WizardWindow.ChangeToPage<SetupStepInstallDriver>();
#endif
}
};

View file

@ -32,7 +32,7 @@ using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
public class ShowAuthPanel : ConnectionWizardPanel
public class ShowAuthPanel : ConnectionWizardPage
{
public ShowAuthPanel()
{
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
nextButton.Name = "Connection Wizard Skip Sign In Button";
nextButton.Click += (sender, e) =>
{
WizardWindow.ChangeToPanel<SetupStepMakeModelName>();
WizardWindow.ChangeToPage<SetupStepMakeModelName>();
};
var signInButton = textImageButtonFactory.Generate("Sign In");

View file

@ -37,7 +37,7 @@ using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
public class AndroidConnectDevicePanel : WizardPanel
public class AndroidConnectDevicePage : WizardPage
{
private event EventHandler unregisterEvents;
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl
private FlowLayoutWidget retryButtonContainer;
private FlowLayoutWidget connectButtonContainer;
public AndroidConnectDevicePanel()
public AndroidConnectDevicePage()
{
TextWidget printerNameLabel = new TextWidget("Connect Your Device".Localize() + ":", 0, 0, labelFontSize)
{
@ -109,7 +109,7 @@ namespace MatterHackers.MatterControl
//Construct buttons
troubleshootButton = whiteImageButtonFactory.Generate("Troubleshoot".Localize(), centerText:true);
troubleshootButton.Click += (s, e) => WizardWindow.ChangeToPanel<SetupWizardTroubleshooting>();
troubleshootButton.Click += (s, e) => WizardWindow.ChangeToPage<SetupWizardTroubleshooting>();
retryButtonContainer = new FlowLayoutWidget()
{

View file

@ -1,43 +1,57 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.ComponentModel;
/*
Copyright (c) 2016, Kevin Pope, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using MatterHackers.Agg;
using MatterHackers.Agg.PlatformAbstract;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl
{
//Normally step one of the setup process
public class SetupWizardHome : WizardPanel
{
public class AndroidSetupOptionsPage : WizardPage
{
public SetupWizardHome()
: base(unlocalizedTextForCancelButton: "Done")
public AndroidSetupOptionsPage()
: base("Done")
{
headerLabel.Text = "Setup Options".Localize();
textImageButtonFactory.borderWidth = 1;
textImageButtonFactory.normalBorderColor = RGBA_Bytes.White;
contentRow.AddChild(new SetupPrinterView(this.textImageButtonFactory) { WizardPanel = this });
contentRow.AddChild(new SetupPrinterView(this.textImageButtonFactory) { WizardPage = this });
contentRow.AddChild(new SetupAccountView(this.textImageButtonFactory));
contentRow.AddChild(new EnterCodesView(this.textImageButtonFactory));
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
//Add buttons to buttonContainer
footerRow.AddChild(hSpacer);
footerRow.AddChild(new HorizontalSpacer());
footerRow.AddChild(cancelButton);
cancelButton.Text = "Back".Localize();
@ -89,7 +103,7 @@ namespace MatterHackers.MatterControl
public class SetupPrinterView : SetupViewBase
{
internal WizardPanel WizardPanel { get; set; }
internal WizardPage WizardPage { get; set; }
private Button disconnectButton;
private TextWidget connectionStatus;
@ -114,7 +128,7 @@ namespace MatterHackers.MatterControl
buttonContainer.AddChild(printerSelectorAndEditButton);
var printerSelector = new PrinterSelector();
printerSelector.AddPrinter += (s, e) => WizardPanel.WizardWindow.ChangeToSetupPrinterForm();
printerSelector.AddPrinter += (s, e) => WizardPage.WizardWindow.ChangeToSetupPrinterForm();
printerSelectorAndEditButton.AddChild(printerSelector);
var editButton = TextImageButtonFactory.GetThemedEditButton();
@ -128,7 +142,7 @@ namespace MatterHackers.MatterControl
disconnectButton.Click += (sender, e) =>
{
PrinterConnectionAndCommunication.Instance.Disable();
WizardPanel.WizardWindow.ChangeToPanel<SetupWizardHome>();
WizardPage.WizardWindow.ChangeToPage<AndroidSetupOptionsPage>();
};
buttonContainer.AddChild(disconnectButton);

View file

@ -20,7 +20,7 @@ using Android.Content;
namespace MatterHackers.MatterControl
{
public class SetupWizardTroubleshooting : WizardPanel
public class SetupWizardTroubleshooting : WizardPage
{
private Button nextButton;
@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl
//Construct buttons
cancelButton = whiteImageButtonFactory.Generate("Cancel".Localize(), centerText:true);
cancelButton.Click += (s, e) => this.WizardWindow.ChangeToPanel<AndroidConnectDevicePanel>();
cancelButton.Click += (s, e) => this.WizardWindow.ChangeToPage<AndroidConnectDevicePage>();
//Construct buttons
nextButton = textImageButtonFactory.Generate("Continue".Localize());

View file

@ -35,7 +35,7 @@ using MatterHackers.MatterControl.CustomWidgets;
namespace MatterHackers.MatterControl
{
//Normally step one of the setup process
public class SetupWizardWifi : WizardPanel
public class SetupWizardWifi : WizardPage
{
public SetupWizardWifi()
{

View file

@ -5,7 +5,7 @@ using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
public class WizardPanel : GuiWidget
public class WizardPage : GuiWidget
{
protected FlowLayoutWidget headerRow;
protected FlowLayoutWidget contentRow;
@ -25,7 +25,7 @@ namespace MatterHackers.MatterControl
protected GuiWidget mainContainer;
public WizardPanel(string unlocalizedTextForCancelButton = "Cancel", TextImageButtonFactory textButtonFactory = null)
public WizardPage(string unlocalizedTextForCancelButton = "Cancel", TextImageButtonFactory textButtonFactory = null)
{
whiteImageButtonFactory = new TextImageButtonFactory()
{

View file

@ -24,7 +24,7 @@ namespace MatterHackers.MatterControl
if (openToHome)
{
ChangeToPanel<SetupWizardHome>();
ChangeToPage<AndroidSetupOptionsPage>();
}
else
{
@ -32,7 +32,7 @@ namespace MatterHackers.MatterControl
bool WifiDetected = MatterControlApplication.Instance.IsNetworkConnected();
if (!WifiDetected)
{
ChangeToPanel<SetupWizardWifi>();
ChangeToPage<SetupWizardWifi>();
}
else
{
@ -64,11 +64,11 @@ namespace MatterHackers.MatterControl
bool showAuthPanel = ShouldShowAuthPanel?.Invoke() ?? false;
if (showAuthPanel)
{
ChangeToPanel<ShowAuthPanel>();
ChangeToPage<ShowAuthPanel>();
}
else
{
ChangeToPanel<SetupStepMakeModelName>();
ChangeToPage<SetupStepMakeModelName>();
}
}
@ -76,11 +76,11 @@ namespace MatterHackers.MatterControl
{
if (ActiveSliceSettings.Instance.PrinterDrivers().Count > 0)
{
ChangeToPanel<SetupStepInstallDriver>();
ChangeToPage<SetupStepInstallDriver>();
}
else
{
ChangeToPanel<SetupStepComPortOne>();
ChangeToPage<SetupStepComPortOne>();
}
}
@ -88,15 +88,15 @@ namespace MatterHackers.MatterControl
{
if (string.IsNullOrEmpty(PrinterConnectionAndCommunication.Instance?.ActivePrinter?.BaudRate()))
{
ChangeToPanel<SetupStepBaudRate>();
ChangeToPage<SetupStepBaudRate>();
}
else
{
ChangeToPanel<SetupStepComPortOne>();
ChangeToPage<SetupStepComPortOne>();
}
}
internal void ChangeToPanel<PanelType>() where PanelType : WizardPanel, new()
internal void ChangeToPage<PanelType>() where PanelType : WizardPage, new()
{
UiThread.RunOnIdle(() =>
{

View file

@ -323,7 +323,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return extruder1StlFileToSlice;
}
public static bool runInProcess = false;
public static bool runInProcess = true;
private static Process slicerProcess = null;
private static void CreateSlicedPartsThread()