Merge pull request #2563 from jlewin/design_tools
Hide WizardPage Cancel implementation
This commit is contained in:
commit
2c87343d08
14 changed files with 121 additions and 95 deletions
|
|
@ -137,8 +137,6 @@ namespace MatterHackers.MatterControl.AboutPage
|
|||
|
||||
additionalInfoContainer.Visible = false;
|
||||
|
||||
cancelButton.Visible = true;
|
||||
|
||||
this.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,11 +57,6 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
this.WindowTitle = "Running Macro".Localize();
|
||||
this.HeaderText = macroData.title;
|
||||
|
||||
cancelButton.Click += (s, e) =>
|
||||
{
|
||||
printer.Connection.MacroCancel();
|
||||
};
|
||||
|
||||
if (macroData.showMaterialSelector)
|
||||
{
|
||||
int extruderIndex = 0;
|
||||
|
|
@ -122,6 +117,12 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
}
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
printer.Connection.MacroCancel();
|
||||
abortCancel = false;
|
||||
}
|
||||
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public class MacroCommandData
|
||||
|
|
|
|||
|
|
@ -61,8 +61,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
FlowLayoutWidget printerComPortContainer = createComPortContainer();
|
||||
contentRow.AddChild(printerComPortContainer);
|
||||
|
||||
cancelButton.Click += (s, e) => printer.Connection.HaltConnectionThread();
|
||||
|
||||
//Construct buttons
|
||||
nextButton = textImageButtonFactory.Generate("Done".Localize());
|
||||
nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
|
||||
|
|
@ -106,6 +104,12 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printer.Connection.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
printer.Connection.HaltConnectionThread();
|
||||
abortCancel = false;
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
{
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
public class SetupStepComPortTwo : WizardPage
|
||||
{
|
||||
private string[] startingPortNames;
|
||||
private string[] currentPortNames;
|
||||
|
||||
private Button nextButton;
|
||||
private Button connectButton;
|
||||
private TextWidget printerErrorMessage;
|
||||
|
|
@ -55,40 +55,43 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
|
||||
startingPortNames = FrostedSerialPort.GetPortNames();
|
||||
contentRow.AddChild(createPrinterConnectionMessageContainer());
|
||||
|
||||
//Construct buttons
|
||||
nextButton = textImageButtonFactory.Generate("Done".Localize());
|
||||
nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
|
||||
nextButton.Visible = false;
|
||||
|
||||
connectButton = textImageButtonFactory.Generate("Connect".Localize());
|
||||
connectButton.Click += (s, e) =>
|
||||
{
|
||||
cancelButton.Click += (s, e) => printer.Connection.HaltConnectionThread();
|
||||
|
||||
//Construct buttons
|
||||
nextButton = textImageButtonFactory.Generate("Done".Localize());
|
||||
nextButton.Click += (s, e) => UiThread.RunOnIdle(Parent.Close);
|
||||
nextButton.Visible = false;
|
||||
|
||||
connectButton = textImageButtonFactory.Generate("Connect".Localize());
|
||||
connectButton.Click += (s, e) =>
|
||||
// Select the first port that's in GetPortNames() but not in startingPortNames
|
||||
string candidatePort = FrostedSerialPort.GetPortNames().Except(startingPortNames).FirstOrDefault();
|
||||
if (candidatePort == null)
|
||||
{
|
||||
// Select the first port that's in GetPortNames() but not in startingPortNames
|
||||
string candidatePort = FrostedSerialPort.GetPortNames().Except(startingPortNames).FirstOrDefault();
|
||||
if (candidatePort == null)
|
||||
{
|
||||
printerErrorMessage.TextColor = RGBA_Bytes.Red;
|
||||
printerErrorMessage.Text = "Oops! Printer could not be detected ".Localize();
|
||||
}
|
||||
else
|
||||
{
|
||||
printerErrorMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerErrorMessage.Text = "Attempting to connect".Localize() + "...";
|
||||
printerErrorMessage.TextColor = RGBA_Bytes.Red;
|
||||
printerErrorMessage.Text = "Oops! Printer could not be detected ".Localize();
|
||||
}
|
||||
else
|
||||
{
|
||||
printerErrorMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerErrorMessage.Text = "Attempting to connect".Localize() + "...";
|
||||
|
||||
ActiveSliceSettings.Instance.Helpers.SetComPort(candidatePort);
|
||||
printer.Connection.Connect();
|
||||
connectButton.Visible = false;
|
||||
}
|
||||
};
|
||||
ActiveSliceSettings.Instance.Helpers.SetComPort(candidatePort);
|
||||
printer.Connection.Connect();
|
||||
connectButton.Visible = false;
|
||||
}
|
||||
};
|
||||
|
||||
printer.Connection.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
printer.Connection.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
this.AddPageAction(nextButton);
|
||||
this.AddPageAction(connectButton);
|
||||
}
|
||||
this.AddPageAction(nextButton);
|
||||
this.AddPageAction(connectButton);
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
printer.Connection.HaltConnectionThread();
|
||||
abortCancel = false;
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ of the authors and should not be interpreted as representing official policies,
|
|||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
@ -65,19 +66,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
ApplicationSettings.Instance.set(ApplicationSettingsKey.SuppressAuthPanel, rememberChoice.Checked.ToString());
|
||||
};
|
||||
|
||||
this.cancelButton.Name = "Connection Wizard Skip Sign In Button";
|
||||
this.cancelButton.Click += (s, e) =>
|
||||
{
|
||||
if (!ProfileManager.Instance.ActiveProfiles.Any())
|
||||
{
|
||||
abortCancel = true;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
WizardWindow.ChangeToPage<SetupStepMakeModelName>();
|
||||
});
|
||||
}
|
||||
};
|
||||
this.SetCancelButtonName("Connection Wizard Skip Sign In Button");
|
||||
|
||||
var createAccountButton = textImageButtonFactory.Generate("Create Account".Localize());
|
||||
createAccountButton.Name = "Create Account From Connection Wizard Button";
|
||||
|
|
@ -106,6 +95,21 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
this.AddPageAction(signInButton);
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
if (!ProfileManager.Instance.ActiveProfiles.Any())
|
||||
{
|
||||
abortCancel = true;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
WizardWindow.ChangeToPage<SetupStepMakeModelName>();
|
||||
});
|
||||
}
|
||||
|
||||
abortCancel = false;
|
||||
}
|
||||
|
||||
private void AddBulletPointAndDescription(FlowLayoutWidget contentRow, string v1, string v2)
|
||||
{
|
||||
contentRow.AddChild(new TextWidget("• " + v1)
|
||||
|
|
@ -121,4 +125,5 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -59,8 +59,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
//Add buttons to buttonContainer
|
||||
AddPageAction(configureButton);
|
||||
|
||||
cancelButton.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,23 +27,22 @@ 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.Platform;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl;
|
||||
using MatterHackers.Agg;
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System.IO;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
public class CopyGuestProfilesToUser : WizardPage
|
||||
{
|
||||
string importMessage = "It's time to copy your existing printer settings to your MatterHackers account. Once copied, these printers will be available whenever you sign in to MatterControl. Printers that are not copied will only be available when not signed in.".Localize();
|
||||
private string importMessage = "It's time to copy your existing printer settings to your MatterHackers account. Once copied, these printers will be available whenever you sign in to MatterControl. Printers that are not copied will only be available when not signed in.".Localize();
|
||||
|
||||
List<CheckBox> checkBoxes = new List<CheckBox>();
|
||||
private CheckBox rememberChoice;
|
||||
|
||||
private List<CheckBox> checkBoxes = new List<CheckBox>();
|
||||
|
||||
public CopyGuestProfilesToUser()
|
||||
: base("Close")
|
||||
|
|
@ -132,24 +131,24 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
};
|
||||
|
||||
CheckBox rememberChoice = new CheckBox("Don't remind me again".Localize(), ActiveTheme.Instance.PrimaryTextColor);
|
||||
rememberChoice = new CheckBox("Don't remind me again".Localize(), ActiveTheme.Instance.PrimaryTextColor);
|
||||
contentRow.AddChild(rememberChoice);
|
||||
|
||||
syncButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
// Close the window and update the PrintersImported flag
|
||||
cancelButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
WizardWindow.Close();
|
||||
if (rememberChoice.Checked)
|
||||
{
|
||||
ProfileManager.Instance.PrintersImported = true;
|
||||
ProfileManager.Instance.Save();
|
||||
}
|
||||
});
|
||||
|
||||
this.AddPageAction(syncButton);
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
// If "Don't remind me" checked, update the PrintersImported flag on close
|
||||
if (rememberChoice.Checked)
|
||||
{
|
||||
ProfileManager.Instance.PrintersImported = true;
|
||||
ProfileManager.Instance.Save();
|
||||
}
|
||||
|
||||
abortCancel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +102,6 @@ namespace MatterHackers.MatterControl
|
|||
exportButton.Click += (s, e) => UiThread.RunOnIdle(exportButton_Click);
|
||||
|
||||
exportButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
this.AddPageAction(exportButton);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -364,7 +364,6 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
|
||||
importButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
this.AddPageAction(importButton);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,11 +63,15 @@ public class LicenseAgreementPage : WizardPage
|
|||
};
|
||||
|
||||
acceptButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
// Exit if EULA is not accepted
|
||||
cancelButton.Click += (s, e) => UiThread.RunOnIdle(MatterControlApplication.Instance.Close);
|
||||
|
||||
this.AddPageAction(acceptButton);
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
// Exit if EULA is not accepted
|
||||
UiThread.RunOnIdle(MatterControlApplication.Instance.Close);
|
||||
|
||||
abortCancel = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ namespace MatterHackers.MatterControl
|
|||
contentRow.AddChild(CreateRequiredCheckBox("", new HtmlWidget(html, textColor)));
|
||||
|
||||
publishButton.Visible = true;
|
||||
cancelButton.Visible = true;
|
||||
|
||||
this.AddPageAction(publishButton);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,12 +44,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
RefreshStatus();
|
||||
|
||||
cancelButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
abortCancel = true;
|
||||
this.WizardWindow.ChangeToPage<AndroidConnectDevicePage>();
|
||||
});
|
||||
|
||||
nextButton = textImageButtonFactory.Generate("Continue".Localize());
|
||||
nextButton.Click += (sender, e) => UiThread.RunOnIdle(this.WizardWindow.Close);
|
||||
nextButton.Visible = false;
|
||||
|
|
@ -69,6 +63,16 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
protected override void OnCancel(out bool abortCancel)
|
||||
{
|
||||
abortCancel = true;
|
||||
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
this.WizardWindow.ChangeToPage<AndroidConnectDevicePage>();
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
{
|
||||
if(checkForPermissionTimer != null)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace MatterHackers.MatterControl
|
|||
private FlowLayoutWidget footerRow;
|
||||
|
||||
private WrappedTextWidget headerLabel;
|
||||
protected Button cancelButton { get; }
|
||||
private Button cancelButton;
|
||||
|
||||
public Vector2 WindowSize { get; set; }
|
||||
|
||||
|
|
@ -58,8 +58,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private GuiWidget mainContainer;
|
||||
|
||||
protected bool abortCancel = false;
|
||||
|
||||
public WizardPage(string unlocalizedTextForCancelButton = "Cancel")
|
||||
{
|
||||
if (!UserSettings.Instance.IsTouchScreen)
|
||||
|
|
@ -143,11 +141,23 @@ namespace MatterHackers.MatterControl
|
|||
footerRow.AddChild(button);
|
||||
}
|
||||
|
||||
protected void SetCancelButtonName(string newName)
|
||||
{
|
||||
cancelButton.Name = newName;
|
||||
}
|
||||
|
||||
protected void HideCancelButton()
|
||||
{
|
||||
cancelButton.Visible = false;
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
{
|
||||
// Add 'Close' event listener after derived types have had a chance to register event listeners
|
||||
cancelButton.Click += (s, e) =>
|
||||
{
|
||||
this.OnCancel(out bool abortCancel);
|
||||
|
||||
if (!abortCancel)
|
||||
{
|
||||
UiThread.RunOnIdle(() => WizardWindow?.Close());
|
||||
|
|
@ -160,6 +170,11 @@ namespace MatterHackers.MatterControl
|
|||
base.OnLoad(args);
|
||||
}
|
||||
|
||||
protected virtual void OnCancel(out bool abortCancel)
|
||||
{
|
||||
abortCancel = false;
|
||||
}
|
||||
|
||||
public virtual void PageIsBecomingActive()
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,11 +152,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
SystemWindow systemWindow;
|
||||
|
||||
testRunner.ClickByName("Queue... Menu");
|
||||
|
||||
var exportButton = testRunner.GetWidgetByName(" Export to Zip Menu Item", out systemWindow, 5);
|
||||
var exportButton = testRunner.GetWidgetByName(" Export to Zip Menu Item", out _, 5);
|
||||
Assert.IsNotNull(exportButton, "Export button should exist");
|
||||
Assert.IsTrue(exportButton.Enabled, "Export button should be enabled");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue