Ran code maid against this code.
This commit is contained in:
parent
1445945d9c
commit
591528ee91
309 changed files with 139399 additions and 140129 deletions
|
|
@ -1,127 +1,117 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Agg.OpenGlGui;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
||||
{
|
||||
public class ConnectionWindow : SystemWindow
|
||||
{
|
||||
Printer activePrinter;
|
||||
bool editMode = false;
|
||||
public class ConnectionWindow : SystemWindow
|
||||
{
|
||||
private Printer activePrinter;
|
||||
private bool editMode = false;
|
||||
|
||||
public ConnectionWindow()
|
||||
: base(350* TextWidget.GlobalPointSizeScaleRatio, 500* TextWidget.GlobalPointSizeScaleRatio)
|
||||
{
|
||||
AlwaysOnTopOfMain = true;
|
||||
string connectToPrinterTitle = LocalizedString.Get("MatterControl");
|
||||
string connectToPrinterTitleEnd = LocalizedString.Get("Connect to Printer");
|
||||
Title = string.Format("{0} - {1}",connectToPrinterTitle,connectToPrinterTitleEnd);
|
||||
|
||||
if (GetPrinterRecordCount() > 0)
|
||||
{
|
||||
ChangeToChoosePrinter();
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeToAddPrinter();
|
||||
}
|
||||
public ConnectionWindow()
|
||||
: base(350 * TextWidget.GlobalPointSizeScaleRatio, 500 * TextWidget.GlobalPointSizeScaleRatio)
|
||||
{
|
||||
AlwaysOnTopOfMain = true;
|
||||
string connectToPrinterTitle = LocalizedString.Get("MatterControl");
|
||||
string connectToPrinterTitleEnd = LocalizedString.Get("Connect to Printer");
|
||||
Title = string.Format("{0} - {1}", connectToPrinterTitle, connectToPrinterTitleEnd);
|
||||
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
if (GetPrinterRecordCount() > 0)
|
||||
{
|
||||
ChangeToChoosePrinter();
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeToAddPrinter();
|
||||
}
|
||||
|
||||
this.ShowAsSystemWindow();
|
||||
MinimumSize = new Vector2(350* TextWidget.GlobalPointSizeScaleRatio, 400* TextWidget.GlobalPointSizeScaleRatio);
|
||||
}
|
||||
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
|
||||
|
||||
static ConnectionWindow connectionWindow = null;
|
||||
static bool connectionWindowIsOpen = false;
|
||||
public static void Show()
|
||||
{
|
||||
if (connectionWindowIsOpen == false)
|
||||
{
|
||||
connectionWindow = new ConnectionWindow();
|
||||
connectionWindowIsOpen = true;
|
||||
connectionWindow.Closed += (parentSender, e) =>
|
||||
{
|
||||
connectionWindowIsOpen = false;
|
||||
connectionWindow = null;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if (connectionWindow != null)
|
||||
{
|
||||
connectionWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ShowAsSystemWindow();
|
||||
MinimumSize = new Vector2(350 * TextWidget.GlobalPointSizeScaleRatio, 400 * TextWidget.GlobalPointSizeScaleRatio);
|
||||
}
|
||||
|
||||
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseUp(mouseEvent);
|
||||
}
|
||||
private static ConnectionWindow connectionWindow = null;
|
||||
private static bool connectionWindowIsOpen = false;
|
||||
|
||||
private void DoNotChangeWindow()
|
||||
{
|
||||
//Empty function used as default callback for changeToWindowCallback
|
||||
}
|
||||
public static void Show()
|
||||
{
|
||||
if (connectionWindowIsOpen == false)
|
||||
{
|
||||
connectionWindow = new ConnectionWindow();
|
||||
connectionWindowIsOpen = true;
|
||||
connectionWindow.Closed += (parentSender, e) =>
|
||||
{
|
||||
connectionWindowIsOpen = false;
|
||||
connectionWindow = null;
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if (connectionWindow != null)
|
||||
{
|
||||
connectionWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeToAddPrinter()
|
||||
{
|
||||
this.activePrinter = null;
|
||||
UiThread.RunOnIdle(DoChangeToAddPrinter);
|
||||
}
|
||||
public override void OnMouseUp(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnMouseUp(mouseEvent);
|
||||
}
|
||||
|
||||
private void DoNotChangeWindow()
|
||||
{
|
||||
//Empty function used as default callback for changeToWindowCallback
|
||||
}
|
||||
|
||||
public void ChangeToAddPrinter()
|
||||
{
|
||||
this.activePrinter = null;
|
||||
UiThread.RunOnIdle(DoChangeToAddPrinter);
|
||||
}
|
||||
|
||||
private void DoChangeToAddPrinter(object state)
|
||||
{
|
||||
GuiWidget addConnectionWidget = new SetupStepMakeModelName(this, this);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(addConnectionWidget);
|
||||
this.Invalidate();
|
||||
}
|
||||
{
|
||||
GuiWidget addConnectionWidget = new SetupStepMakeModelName(this, this);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(addConnectionWidget);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public void ChangedToEditPrinter(Printer activePrinter, object state = null)
|
||||
{
|
||||
this.activePrinter = activePrinter;
|
||||
UiThread.RunOnIdle(DoChangeToEditPrinter, state);
|
||||
}
|
||||
public void ChangedToEditPrinter(Printer activePrinter, object state = null)
|
||||
{
|
||||
this.activePrinter = activePrinter;
|
||||
UiThread.RunOnIdle(DoChangeToEditPrinter, state);
|
||||
}
|
||||
|
||||
private void DoChangeToEditPrinter(object state)
|
||||
{
|
||||
GuiWidget addConnectionWidget = new EditConnectionWidget(this, this, activePrinter, state);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(addConnectionWidget);
|
||||
this.Invalidate();
|
||||
private void DoChangeToEditPrinter(object state)
|
||||
{
|
||||
GuiWidget addConnectionWidget = new EditConnectionWidget(this, this, activePrinter, state);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(addConnectionWidget);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ChangeToChoosePrinter(bool editMode = false)
|
||||
{
|
||||
this.editMode = editMode;
|
||||
UiThread.RunOnIdle(DoChangeToChoosePrinter);
|
||||
}
|
||||
public void ChangeToChoosePrinter(bool editMode = false)
|
||||
{
|
||||
this.editMode = editMode;
|
||||
UiThread.RunOnIdle(DoChangeToChoosePrinter);
|
||||
}
|
||||
|
||||
public void DoChangeToChoosePrinter(object state)
|
||||
{
|
||||
GuiWidget chooseConnectionWidget = new ChooseConnectionWidget(this, this, this.editMode);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(chooseConnectionWidget);
|
||||
this.Invalidate();
|
||||
}
|
||||
{
|
||||
GuiWidget chooseConnectionWidget = new ChooseConnectionWidget(this, this, this.editMode);
|
||||
this.RemoveAllChildren();
|
||||
this.AddChild(chooseConnectionWidget);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
int GetPrinterRecordCount()
|
||||
{
|
||||
return Datastore.Instance.RecordCount("Printer");
|
||||
}
|
||||
}
|
||||
}
|
||||
private int GetPrinterRecordCount()
|
||||
{
|
||||
return Datastore.Instance.RecordCount("Printer");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue