Made edit printer available and work on Android
This commit is contained in:
parent
275b320425
commit
6d14dcbbfc
3 changed files with 80 additions and 66 deletions
|
|
@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
private string disconnectAndCancelTitle = "WARNING: Disconnecting will cancel the print.".Localize();
|
||||
private Button disconnectPrinterButton;
|
||||
private Button resetConnectionButton;
|
||||
private PrinterSelector selectActivePrinterButton;
|
||||
private PrinterSelector printerSelector;
|
||||
|
||||
private event EventHandler unregisterEvents;
|
||||
static EventHandler staticUnregisterEvents;
|
||||
|
|
@ -110,19 +110,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
disconnectPrinterButton.VAnchor = VAnchor.ParentTop;
|
||||
disconnectPrinterButton.Cursor = Cursors.Hand;
|
||||
|
||||
selectActivePrinterButton = new PrinterSelector();
|
||||
selectActivePrinterButton.HAnchor = HAnchor.ParentLeftRight;
|
||||
selectActivePrinterButton.Cursor = Cursors.Hand;
|
||||
selectActivePrinterButton.AddPrinter += (s, e) => WizardWindow.Show();
|
||||
if (ApplicationController.Instance.WidescreenMode)
|
||||
{
|
||||
selectActivePrinterButton.Margin = new BorderDouble(0, 6, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
selectActivePrinterButton.Margin = new BorderDouble(0, 6, 6, 3);
|
||||
}
|
||||
|
||||
string resetConnectionText = "Reset\nConnection".Localize().ToUpper();
|
||||
resetConnectionButton = actionBarButtonFactory.Generate(resetConnectionText, "e_stop4.png");
|
||||
if (ApplicationController.Instance.WidescreenMode)
|
||||
|
|
@ -146,10 +133,22 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
};
|
||||
printerSelectorAndEditButton.AddChild(selectActivePrinterButton);
|
||||
printerSelector = new PrinterSelector();
|
||||
printerSelector.HAnchor = HAnchor.ParentLeftRight;
|
||||
printerSelector.Cursor = Cursors.Hand;
|
||||
printerSelector.AddPrinter += (s, e) => WizardWindow.Show();
|
||||
if (ApplicationController.Instance.WidescreenMode)
|
||||
{
|
||||
printerSelector.Margin = new BorderDouble(0, 6, 0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
printerSelector.Margin = new BorderDouble(0, 6, 6, 3);
|
||||
}
|
||||
printerSelectorAndEditButton.AddChild(printerSelector);
|
||||
Button editButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editButton.VAnchor = VAnchor.ParentCenter;
|
||||
editButton.Click += EditButton_Click;
|
||||
editButton.Click += UiNavigation.GoToEditPrinter_Click;
|
||||
printerSelectorAndEditButton.AddChild(editButton);
|
||||
this.AddChild(printerSelectorAndEditButton);
|
||||
|
||||
|
|
@ -157,21 +156,6 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
//this.AddChild(CreateOptionsMenu());
|
||||
}
|
||||
|
||||
private void EditButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button editButton = sender as Button;
|
||||
editButton.ToolTipText = "Edit Current Printer Settings".Localize();
|
||||
if (editButton != null)
|
||||
{
|
||||
editButton.Closed += (s, e2) =>
|
||||
{
|
||||
editButton.Click -= EditButton_Click;
|
||||
};
|
||||
|
||||
UiNavigation.GoToPrinterSettings("MatterControl.BaudRate Edit Field,MatterControl.AutoConnect Edit Field,MatterControl.ComPort Edit Field");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AddHandlers()
|
||||
{
|
||||
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
|
||||
|
|
@ -224,7 +208,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
PrinterConnectionAndCommunication.Instance.Stop();
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
selectActivePrinterButton.Invalidate();
|
||||
printerSelector.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +242,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
selectActivePrinterButton.Invalidate();
|
||||
printerSelector.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -40,41 +43,65 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
static bool runingNavigation;
|
||||
|
||||
public static void GoToEditPrinter_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button editButton = sender as Button;
|
||||
editButton.ToolTipText = "Edit Current Printer Settings".Localize();
|
||||
if (editButton != null)
|
||||
{
|
||||
editButton.Closed += (s, e2) =>
|
||||
{
|
||||
editButton.Click -= GoToEditPrinter_Click;
|
||||
};
|
||||
|
||||
UiNavigation.GoToPrinterSettings("MatterControl.BaudRate Edit Field,MatterControl.AutoConnect Edit Field,MatterControl.ComPort Edit Field");
|
||||
}
|
||||
}
|
||||
|
||||
public static void GoToPrinterSettings(string widgetNameToHighlight)
|
||||
{
|
||||
if (!runingNavigation)
|
||||
if (PrinterConnectionAndCommunication.Instance?.ActivePrinter?.ID != null)
|
||||
{
|
||||
runingNavigation = true;
|
||||
Task.Run(() =>
|
||||
if (!runingNavigation)
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);
|
||||
testRunner.TimeToMoveMouse = 0;
|
||||
testRunner.UpDelaySeconds = 0;
|
||||
|
||||
if (testRunner.NameExists("SettingsAndControls"))
|
||||
runingNavigation = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.Wait(.2);
|
||||
}
|
||||
testRunner.ClickByName("Slice Settings Tab", .1);
|
||||
testRunner.ClickByName("Printer Tab", .2);
|
||||
testRunner.ClickByName("Connection Tab", .1);
|
||||
AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);
|
||||
testRunner.TimeToMoveMouse = 0;
|
||||
testRunner.UpDelaySeconds = 0;
|
||||
|
||||
if (widgetNameToHighlight.Contains(","))
|
||||
{
|
||||
foreach (string item in widgetNameToHighlight.Split(','))
|
||||
if (testRunner.NameExists("Done"))
|
||||
{
|
||||
HighlightWidget(testRunner, item);
|
||||
testRunner.ClickByName("Done");
|
||||
testRunner.Wait(.2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HighlightWidget(testRunner, widgetNameToHighlight);
|
||||
}
|
||||
|
||||
testRunner.Dispose();
|
||||
runingNavigation = false;
|
||||
});
|
||||
if (testRunner.NameExists("SettingsAndControls"))
|
||||
{
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.Wait(.2);
|
||||
}
|
||||
testRunner.ClickByName("Slice Settings Tab", .1);
|
||||
testRunner.ClickByName("Printer Tab", .2);
|
||||
testRunner.ClickByName("Connection Tab", .1);
|
||||
|
||||
if (widgetNameToHighlight.Contains(","))
|
||||
{
|
||||
foreach (string item in widgetNameToHighlight.Split(','))
|
||||
{
|
||||
HighlightWidget(testRunner, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HighlightWidget(testRunner, widgetNameToHighlight);
|
||||
}
|
||||
|
||||
testRunner.Dispose();
|
||||
runingNavigation = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
TextImageButtonFactory setupButtonFactory = new TextImageButtonFactory();
|
||||
|
||||
Button addProfileButton;
|
||||
Button editProfilesButton;
|
||||
Button setupWifiButton;
|
||||
Button troubleshootButton;
|
||||
Button accountButton;
|
||||
|
||||
public SetupWizardHome(WizardWindow windowController)
|
||||
: base(windowController, unlocalizedTextForCancelButton: "Done")
|
||||
{
|
||||
|
|
@ -133,7 +127,16 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
var printerSelector = new PrinterSelector();
|
||||
printerSelector.AddPrinter += (s, e) => this.windowController.ChangeToSetupPrinterForm();
|
||||
buttonContainer.AddChild(printerSelector);
|
||||
FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
};
|
||||
printerSelectorAndEditButton.AddChild(printerSelector);
|
||||
Button editButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
editButton.VAnchor = VAnchor.ParentCenter;
|
||||
editButton.Click += UiNavigation.GoToEditPrinter_Click;
|
||||
printerSelectorAndEditButton.AddChild(editButton);
|
||||
buttonContainer.AddChild(printerSelectorAndEditButton);
|
||||
|
||||
disconnectButton = textImageButtonFactory.Generate("Disconnect");
|
||||
disconnectButton.Margin = new BorderDouble(left: 12);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue