UI thread is more explicit about what functions it accepts and now accepts no parameter functions.

This commit is contained in:
Lars Brubaker 2015-06-11 12:06:40 -07:00
parent 42568cc0f1
commit 5cc1b651b4
69 changed files with 270 additions and 269 deletions

View file

@ -90,10 +90,7 @@ namespace MatterHackers.MatterControl
private void CancelButton_Click()
{
UiThread.RunOnIdle((state) =>
{
aboutWindow.Close();
});
UiThread.RunOnIdle(aboutWindow.Close);
}
}
}

View file

@ -228,17 +228,11 @@ namespace MatterHackers.MatterControl.ContactForm
{
cancelButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
Close();
});
UiThread.RunOnIdle(Close);
};
doneButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
Close();
});
UiThread.RunOnIdle(Close);
};
submitButton.Click += new EventHandler(SubmitContactForm);
}

View file

@ -200,7 +200,7 @@ namespace MatterHackers.MatterControl
SetUpdateStatus(UpdateStatusStates.UpdateAvailable);
if (updateRequestType == UpdateRequestType.FirstTimeEver)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
StyledMessageBox.ShowMessageBox(ProcessDialogResponse, updateAvailableMessage, updateAvailableTitle, StyledMessageBox.MessageType.YES_NO, downloadNow, remindMeLater);
// show a dialog to tell the user there is an update
@ -317,10 +317,7 @@ namespace MatterHackers.MatterControl
{
this.downloadPercent = (int)(e.BytesReceived * 100 / downloadSize);
}
UiThread.RunOnIdle((state) =>
{
UpdateStatusChanged.CallEvents(this, e);
});
UiThread.RunOnIdle(() => UpdateStatusChanged.CallEvents(this, e) );
}
private void DownloadCompleted(object sender, AsyncCompletedEventArgs e)
@ -340,18 +337,12 @@ namespace MatterHackers.MatterControl
}
else
{
UiThread.RunOnIdle((state) =>
{
SetUpdateStatus(UpdateStatusStates.UnableToConnectToServer);
});
UiThread.RunOnIdle(() => SetUpdateStatus(UpdateStatusStates.UnableToConnectToServer));
}
}
else
{
UiThread.RunOnIdle((state) =>
{
SetUpdateStatus(UpdateStatusStates.ReadyToInstall);
});
UiThread.RunOnIdle(() => SetUpdateStatus(UpdateStatusStates.ReadyToInstall));
}
webClient.Dispose();

View file

@ -165,7 +165,7 @@ namespace MatterHackers.MatterControl.ActionBar
private void onActivePrinterChanged(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SetButtonText();
});

View file

@ -167,10 +167,10 @@ namespace MatterHackers.MatterControl.ActionBar
resumeButton.Click += new EventHandler(onResumeButton_Click);
pauseButton.Click += new EventHandler(onPauseButton_Click);
connectButton.Click += new EventHandler(onConnectButton_Click);
resetConnectionButton.Click += (sender, e) => { UiThread.RunOnIdle(ResetConnectionButton_Click); };
resetConnectionButton.Click += (sender, e) => { UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard); };
cancelButton.Click += (sender, e) => { UiThread.RunOnIdle(CancelButton_Click); };
cancelConnectButton.Click += (sender, e) => { UiThread.RunOnIdle(CancelConnectionButton_Click); };
cancelConnectButton.Click += (sender, e) => { UiThread.RunOnIdle(CancelPrinting); };
reprintButton.Click += new EventHandler(onReprintButton_Click);
doneWithCurrentPartButton.Click += new EventHandler(onDoneWithCurrentPartButton_Click);
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
@ -326,7 +326,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
private void AddButtonOnIdle(object state)
private void AddButtonOnIdle()
{
FileDialog.OpenFileDialog(
new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams, multiSelect: true),
@ -342,7 +342,7 @@ namespace MatterHackers.MatterControl.ActionBar
});
}
private void CancelButton_Click(object state)
private void CancelButton_Click()
{
if (timeSincePrintStarted.IsRunning && timeSincePrintStarted.ElapsedMilliseconds > (2 * 60 * 1000))
{
@ -351,15 +351,10 @@ namespace MatterHackers.MatterControl.ActionBar
else
{
CancelPrinting();
UiThread.RunOnIdle((state2) => { SetButtonStates(); });
UiThread.RunOnIdle(SetButtonStates);
}
}
private void CancelConnectionButton_Click(object state)
{
CancelPrinting();
}
private void CancelPrinting()
{
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint)
@ -368,7 +363,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
PrinterConnectionAndCommunication.Instance.Stop();
timeSincePrintStarted.Reset();
UiThread.RunOnIdle((state2) => { SetButtonStates(); });
UiThread.RunOnIdle(SetButtonStates);
}
private void onAddButton_Click(object sender, EventArgs mouseEvent)
@ -376,11 +371,6 @@ namespace MatterHackers.MatterControl.ActionBar
UiThread.RunOnIdle(AddButtonOnIdle);
}
private void ResetConnectionButton_Click(object state)
{
PrinterConnectionAndCommunication.Instance.RebootBoard();
}
private void onConnectButton_Click(object sender, EventArgs mouseEvent)
{
if (ActivePrinterProfile.Instance.ActivePrinter == null)
@ -417,10 +407,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
if (messageBoxResponse)
{
UiThread.RunOnIdle((state) =>
{
CancelPrinting();
});
UiThread.RunOnIdle(CancelPrinting);
}
}
@ -444,10 +431,7 @@ namespace MatterHackers.MatterControl.ActionBar
private void onReprintButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
{
PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
});
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible);
}
private void onResumeButton_Click(object sender, EventArgs mouseEvent)
@ -468,10 +452,7 @@ namespace MatterHackers.MatterControl.ActionBar
private void onStartButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
{
PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
});
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible);
}
private void onStateChanged(object sender, EventArgs e)

View file

@ -315,7 +315,7 @@ namespace MatterHackers.MatterControl.ActionBar
activePrintPreviewImage.Invalidate();
}
private void OnIdle(object state)
private void OnIdle()
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{

View file

@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
// Bind connect button states to active printer state
this.SetConnectionButtonVisibleState(null);
this.SetConnectionButtonVisibleState();
actionBarButtonFactory.invertImageLocation = true;
@ -210,7 +210,7 @@ namespace MatterHackers.MatterControl.ActionBar
UiThread.RunOnIdle(OnIdleDisconnect);
}
private void OnIdleDisconnect(object state)
private void OnIdleDisconnect()
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
PrinterConnectionAndCommunication.Instance.RebootBoard();
}
private void SetConnectionButtonVisibleState(object state)
private void SetConnectionButtonVisibleState()
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
{

View file

@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl
// Specifically, it has the wronge position on the app restarting.
if(false)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
int scrollPosition = UserSettings.Instance.Fields.GetInt(CompactTabView_Options_ScrollPosition, -100000);
if (scrollPosition != -100000)
@ -233,7 +233,7 @@ namespace MatterHackers.MatterControl
}
}
public void ReloadAdvancedControlsPanel(object state)
public void ReloadAdvancedControlsPanel()
{
UiThread.RunOnIdle(LoadAdvancedControls);
}
@ -273,7 +273,7 @@ namespace MatterHackers.MatterControl
}
}
private void LoadAdvancedControls(object state = null)
private void LoadAdvancedControls()
{
RreloadControlsWidget();
ReloadConfigurationWidget();

View file

@ -287,7 +287,7 @@ namespace MatterHackers.MatterControl
public void ReloadAll(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
// give the widget a chance to hear about the close before they are actually colsed.
WidescreenPanel.PreChangePanels.CallEvents(this, null);

View file

@ -80,7 +80,7 @@ namespace MatterHackers.MatterControl
popUpAboutPage.AddChild(updateStatusMessage);
updateStatusMessage.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
AboutWindow.Show();
});
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl
Button updateStatusMessage = linkButtonFactory.Generate("Check For Update".Localize());
updateStatusMessage.Click += (sender2, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
AboutWindow.Show();
});
@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl
Button updateStatusMessage = linkButtonFactory.Generate("Update Available".Localize());
updateStatusMessage.Click += (sender2, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
AboutWindow.Show();
});

View file

@ -30,7 +30,7 @@ namespace MatterHackers.MatterControl
private bool addPrinter_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ConnectionWindow.Show();
});
@ -39,7 +39,7 @@ namespace MatterHackers.MatterControl
private bool importFile_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
FileDialog.OpenFileDialog(
new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams)
@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl
private bool exit_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
GuiWidget parent = this;
while (parent as MatterControlApplication == null)

View file

@ -31,7 +31,7 @@ namespace MatterHackers.MatterControl
private bool bug_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ContactFormWindow.Open();
});
@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl
private bool help_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles");
});
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl
private bool checkForUpdate_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ApplicationMenuRow.AlwaysShowUpdateStatus = true;
UpdateControlData.Instance.CheckForUpdateUserRequested();
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl
private bool about_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
AboutWindow.Show();
});
@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl
private bool notes_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com/Release_Notes");
});
@ -82,7 +82,7 @@ namespace MatterHackers.MatterControl
private bool gettingStarted_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles/mattercontrol-getting-started");
});

View file

@ -33,7 +33,7 @@ namespace MatterHackers.MatterControl
private bool openPrintingPannel_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (sliceSettingsPopOut != null)
{
@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl
private bool openControlsPannel_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (controlsPopOut != null)
{
@ -57,10 +57,7 @@ namespace MatterHackers.MatterControl
private bool openTermanialPannel_Click()
{
UiThread.RunOnIdle((state) =>
{
TerminalWindow.Show();
});
UiThread.RunOnIdle(TerminalWindow.Show);
return true;
}
}

View file

@ -170,7 +170,7 @@ namespace MatterHackers.MatterControl
get { return "Controls Tab"; }
}
public void ReloadSliceSettings(object state)
public void ReloadSliceSettings()
{
WidescreenPanel.PreChangePanels.CallEvents(null, null);

View file

@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl
ColumnOne.AnchorAll();
}
private void LoadColumnTwo(object state = null)
private void LoadColumnTwo()
{
ColumnTwo.CloseAndRemoveAllChildren();
@ -251,7 +251,7 @@ namespace MatterHackers.MatterControl
AddChild(ColumnTwo);
}
public void ReloadAdvancedControlsPanel(object state)
public void ReloadAdvancedControlsPanel()
{
PreChangePanels.CallEvents(this, null);
}

View file

@ -382,7 +382,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void RestartApplication()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
// Iterate to the top SystemWindow
GuiWidget parent = this;

View file

@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
{
if (enableCloudMonitorFunction != null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
enableCloudMonitorFunction(null);
});
@ -87,7 +87,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
ApplicationController.Instance.ReloadAdvancedControlsPanel();
if (disableCloudMonitorFunction != null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
disableCloudMonitorFunction(null);
});
@ -102,7 +102,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
{
if (openDashboardPageFunction != null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
openDashboardPageFunction(null);
});
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
{
if (openDashboardPageFunction != null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
openInstructionsPageFunction(null);
});
@ -283,7 +283,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
{
if (openPrintNotificationFunction != null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
openPrintNotificationFunction(null);
});

View file

@ -268,7 +268,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
if (!allowLessThan0
&& PrinterConnectionAndCommunication.Instance.LastReportedPosition.z - moveAmount < 0)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
StyledMessageBox.ShowMessageBox(null, zIsTooLowMessage, zTooLowTitle, StyledMessageBox.MessageType.OK);
});

View file

@ -123,7 +123,7 @@ namespace MatterHackers.MatterControl
private void RestartApplication()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
//horrible hack - to be replaced
GuiWidget parent = this;

View file

@ -78,7 +78,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
editButton.VAnchor = Agg.UI.VAnchor.ParentCenter;
editButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (editLevelingSettingsWindow == null)
{
@ -100,7 +100,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
runPrintLevelingButton.VAnchor = VAnchor.ParentCenter;
runPrintLevelingButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
LevelWizardBase.ShowPrintLevelWizard(LevelWizardBase.RuningState.UserRequestedCalibration);
});
@ -286,7 +286,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void configureEePromButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(()=>
{
#if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware.
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
@ -333,10 +333,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void openGcodeTerminalButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
{
TerminalWindow.Show();
});
UiThread.RunOnIdle(TerminalWindow.Show);
}
private void onPrinterStatusChanged(object sender, EventArgs e)

View file

@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl
this.dataBaseKeyPrefix = dataBaseKeyPrefix;
this.widgetWhosContentsPopOut = widgetWhosContentsPopOut;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ApplicationController.Instance.MainView.DrawAfter += ShowOnFirstSystemWindowDraw;
});
@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl
{
if (widgetWhosContentsPopOut.Children.Count > 0)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
bool wasLeftOpen = UserSettings.Instance.Fields.GetBool(WindowLeftOpenKey, false);
if (wasLeftOpen)
@ -200,7 +200,7 @@ namespace MatterHackers.MatterControl
bringBackToTabButton.Cursor = Cursors.Hand;
bringBackToTabButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SaveWindowShouldStartClosed();
SystemWindow temp = PopedOutSystemWindow;

View file

@ -203,7 +203,7 @@ namespace MatterHackers.MatterControl
return longName.Substring(0, Math.Min(longName.Length, 8));
}
private void ExportGCode_Click(object state)
private void ExportGCode_Click()
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Export GCode|*.gcode", title: "Export GCode");
saveParams.Title = "MatterControl: Export File";
@ -252,7 +252,7 @@ namespace MatterHackers.MatterControl
}
}
private void ExportX3G_Click(object state)
private void ExportX3G_Click()
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Export X3G|*.x3g", title: "Export X3G");
saveParams.Title = "MatterControl: Export File";
@ -368,7 +368,7 @@ namespace MatterHackers.MatterControl
private void exportAMF_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as AMF|*.amf", initialDirectory: documentsPath);
saveParams.Title = "MatterControl: Export File";
@ -418,7 +418,7 @@ namespace MatterHackers.MatterControl
private void exportSTL_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as STL|*.stl");
saveParams.Title = "MatterControl: Export File";

View file

@ -497,7 +497,7 @@ namespace MatterHackers.MatterControl
createThumbnailWorker = null;
}
private void DoOnMouseClick(object state)
private void DoOnMouseClick()
{
if (printItem != null)
{
@ -521,7 +521,7 @@ namespace MatterHackers.MatterControl
}
}
private void EnsureImageUpdated(object state)
private void EnsureImageUpdated()
{
thumbnailImage.MarkImageChanged();
Invalidate();

View file

@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl.CreatorPlugins
UiThread.RunOnIdle(Reload);
}
public void Reload(object state)
public void Reload()
{
this.RemoveAllChildren();
this.AddElements();
@ -263,7 +263,7 @@ namespace MatterHackers.MatterControl.CreatorPlugins
CreatorInformation callCorrectFunctionHold = state as CreatorInformation;
if (callCorrectFunctionHold != null)
{
UiThread.RunOnIdle((state2) =>
UiThread.RunOnIdle(() =>
{
callCorrectFunctionHold.functionToLaunchCreator(null, null);
});

View file

@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl
UpdatePrintStatus();
}
private void OnIdle(object state)
private void OnIdle()
{
currentPercent = PrinterConnectionAndCommunication.Instance.PercentComplete;
UpdatePrintStatus();

View file

@ -325,12 +325,7 @@ namespace MatterHackers.MatterControl.EeProm
private void buttonAbort_Click(object sender, EventArgs e)
{
UiThread.RunOnIdle(DoButtonAbort_Click);
}
private void DoButtonAbort_Click(object state)
{
Close();
UiThread.RunOnIdle(Close);
}
public override void OnClosed(EventArgs e)
@ -377,7 +372,7 @@ namespace MatterHackers.MatterControl.EeProm
UiThread.RunOnIdle(DoButtonSave_Click);
}
private void DoButtonSave_Click(object state)
private void DoButtonSave_Click()
{
SaveSettingsToActive();
currentEePromSettings.SaveToEeProm();

View file

@ -235,7 +235,7 @@ namespace MatterHackers.MatterControl.EeProm
UiThread.RunOnIdle(DoButtonSave_Click);
}
private void DoButtonSave_Click(object state)
private void DoButtonSave_Click()
{
currentEePromSettings.Save();
currentEePromSettings.Clear();
@ -248,7 +248,7 @@ namespace MatterHackers.MatterControl.EeProm
UiThread.RunOnIdle(DoButtonAbort_Click);
}
private void DoButtonAbort_Click(object state)
private void DoButtonAbort_Click()
{
currentEePromSettings.Clear();
data.Clear();

View file

@ -205,6 +205,7 @@
<Compile Include="PrinterControls\TerminalWindow\TextScrollWidget.cs" />
<Compile Include="PrinterControls\TerminalWindow\TerminalWidget.cs" />
<Compile Include="PrintHistory\PrintHistoryData.cs" />
<Compile Include="PrintLibrary\Provider\LibraryProviderFileSystem.cs" />
<Compile Include="PrintLibrary\Provider\LibrarySQLiteData.cs" />
<Compile Include="PrintLibrary\Provider\LibraryProviderSQLite.cs" />
<Compile Include="PrintLibrary\Provider\LibraryProvider.cs" />

View file

@ -444,14 +444,14 @@ namespace MatterHackers.MatterControl
}
}
public void DoAutoConnectIfRequired(object state)
public void DoAutoConnectIfRequired()
{
ActivePrinterProfile.CheckForAndDoAutoConnect();
}
public void LaunchBrowser(string targetUri)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
System.Diagnostics.Process.Start(targetUri);
});
@ -602,7 +602,7 @@ namespace MatterHackers.MatterControl
file.WriteLine("G1 X" + center.x.ToString() + " Y" + center.y.ToString());
}
private void CheckOnPrinter(object state)
private void CheckOnPrinter()
{
try
{

View file

@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
meshViewerWidget.CreatePrintBed(
new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight),

View file

@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
enterEditButtonsContainer.AddChild(addButton);
addButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
DoAddFileAfterCreatingEditData = true;
EnterEditAndCreateSelectionData();
@ -193,7 +193,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
exportButton.Margin = new BorderDouble(right: 10);
exportButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
OpenExportWindow();
});
@ -213,7 +213,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
doEdittingButtonsContainer.AddChild(addButton);
addButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
FileDialog.OpenFileDialog(
new OpenFileDialogParams(ApplicationSettings.OpenDesignFileParams, multiSelect: true),
@ -287,7 +287,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Button leaveEditModeButton = textImageButtonFactory.Generate("Cancel".Localize(), centerText: true);
leaveEditModeButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (saveButtons.Visible)
{
@ -1070,7 +1070,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
private void AutoSpin(object state)
private void AutoSpin()
{
if (!WidgetHasBeenClosed && autoRotating)
{
@ -1099,7 +1099,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (!timeSinceReported.IsRunning || timeSinceReported.ElapsedMilliseconds > 100
|| processingState != processingProgressControl.ProgressMessage)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
processingProgressControl.PercentComplete = (int)(progress0To1 * 100 + .5);
processingProgressControl.ProgressMessage = processingState;
@ -1876,7 +1876,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
catch (System.UnauthorizedAccessException)
{
saveSucceded = false;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
//Do something special when unauthorized?
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
@ -1885,7 +1885,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
catch
{
saveSucceded = false;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
});
@ -1998,10 +1998,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (openMode == OpenMode.Editing)
{
UiThread.RunOnIdle((state) =>
{
EnterEditAndCreateSelectionData();
});
UiThread.RunOnIdle(EnterEditAndCreateSelectionData);
}
}
@ -2022,7 +2019,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
private void OpenSaveAsWindow(object state)
private void OpenSaveAsWindow()
{
if (saveAsWindow == null)
{
@ -2067,7 +2064,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void PushMeshGroupDataToAsynchLists(TraceInfoOpperation traceInfoOpperation, ReportProgressRatio reportProgress = null)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
processingProgressControl.ProgressMessage = "Async Copy";
});
@ -2100,7 +2097,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
asynchPlatingDatas.Add(meshData);
}
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
processingProgressControl.ProgressMessage = "";
});

View file

@ -105,7 +105,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
sliderWidth = 10;
}
CreateAndAddChildren(null);
CreateAndAddChildren();
SliceSettingsWidget.RegisterForSettingsChange("bed_size", RecreateBedAndPartPosition, ref unregisterEvents);
SliceSettingsWidget.RegisterForSettingsChange("print_center", RecreateBedAndPartPosition, ref unregisterEvents);
@ -136,7 +136,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
meshViewerWidget.CreatePrintBed(
viewerVolume,
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
});
}
private void CreateAndAddChildren(object state)
private void CreateAndAddChildren()
{
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor;
@ -651,10 +651,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// However if the print finished or is canceled we are going to want to get updates again. So, hook the status event
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
UiThread.RunOnIdle((state) =>
{
SetSyncToPrintVisibility();
});
UiThread.RunOnIdle(SetSyncToPrintVisibility);
}
}

View file

@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl.PrintHistory
private void ReloadData(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
LoadHistoryItems(Count);
});

View file

@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.PrintHistory
printButton.Width = actionButtonSize;
printButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive)
{
@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl.PrintHistory
public void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
{
itemToRemove = printItemWrapper;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
string maxLengthName = printItemWrapper.FileLocation;
int maxLength = 43;

View file

@ -318,7 +318,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
{
}
private void RemoveThisFromPrintLibrary(object state)
private void RemoveThisFromPrintLibrary()
{
LibraryProvider.CurrentProvider.RemoveItem(this.printItemWrapper);
}
@ -330,18 +330,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
private void onOpenPartViewClick(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
{
openPartView(state);
});
UiThread.RunOnIdle(() => openPartView());
}
private void onViewPartClick(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
this.rightButtonOverlay.SlideOut();
openPartView(state, View3DWidget.OpenMode.Viewing);
openPartView(View3DWidget.OpenMode.Viewing);
});
}
@ -367,7 +364,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
viewWindowIsOpen = false;
}
private void openPartView(object state, View3DWidget.OpenMode openMode = View3DWidget.OpenMode.Viewing)
private void openPartView(View3DWidget.OpenMode openMode = View3DWidget.OpenMode.Viewing)
{
string pathAndFile = this.printItemWrapper.FileLocation;
if (File.Exists(pathAndFile))

View file

@ -384,7 +384,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
UiThread.RunOnIdle(importToLibraryloadFile_ClickOnIdle);
}
private void importToLibraryloadFile_ClickOnIdle(object state)
private void importToLibraryloadFile_ClickOnIdle()
{
OpenFileDialogParams openParams = new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams, multiSelect: true);
FileDialog.OpenFileDialog(openParams, onLibraryLoadFileSelected);

View file

@ -32,6 +32,7 @@ using MatterHackers.MatterControl.PrintQueue;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
namespace MatterHackers.MatterControl.PrintLibrary.Provider
{
@ -51,11 +52,14 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
{
// hack for the moment
currentProvider = new LibraryProviderSQLite();
//currentProvider = new LibraryProviderFileSystem(Path.Combine("C:", "Users", "LarsBrubaker", "Downloads"));
}
return currentProvider;
}
}
#region AbstractMethods
public abstract int Count { get; }
public abstract string KeywordFilter { get; set; }
@ -66,6 +70,8 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider
public abstract void RemoveItem(PrintItemWrapper printItemWrapper);
#endregion AbstractMethods
public static void OnDataReloaded(EventArgs eventArgs)
{
DataReloaded.CallEvents(CurrentProvider, eventArgs);

View file

@ -0,0 +1,83 @@
/*
Copyright (c) 2015, Lars Brubaker
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 MatterHackers.Agg;
using MatterHackers.MatterControl.PrintQueue;
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace MatterHackers.MatterControl.PrintLibrary.Provider
{
public class LibraryProviderFileSystem : LibraryProvider
{
private string rootPath;
public LibraryProviderFileSystem(string rootPath)
{
this.rootPath = rootPath;
}
public override int Count
{
get
{
throw new NotImplementedException();
}
}
public override string KeywordFilter
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public override PrintItemWrapper GetPrintItemWrapper(int itemIndex)
{
throw new NotImplementedException();
}
public override void LoadFilesIntoLibrary(IList<string> files, ReportProgressRatio reportProgress = null, RunWorkerCompletedEventHandler callback = null)
{
throw new NotImplementedException();
}
public override void RemoveItem(PrintItemWrapper printItemWrapper)
{
throw new NotImplementedException();
}
}
}

View file

@ -344,7 +344,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
}
catch (System.UnauthorizedAccessException)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
//Do something special when unauthorized?
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes, unauthorized access", "Unable to save");
@ -352,7 +352,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
}
catch
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
});

View file

@ -132,7 +132,7 @@ namespace MatterHackers.MatterControl.PrintQueue
return true;
}
private void PartSheetClickOnIdle(object state)
private void PartSheetClickOnIdle()
{
#if !__ANDROID__
List<PrintItem> parts = QueueData.Instance.CreateReadOnlyPartList();
@ -166,7 +166,7 @@ namespace MatterHackers.MatterControl.PrintQueue
private string pleaseSelectPrinterMessage = "Before you can export printable files, you must select a printer.";
private string pleaseSelectPrinterTitle = "Please select a printer";
private void MustSelectPrinterMessage(object state)
private void MustSelectPrinterMessage()
{
StyledMessageBox.ShowMessageBox(null, pleaseSelectPrinterMessage, pleaseSelectPrinterTitle);
}
@ -203,7 +203,7 @@ namespace MatterHackers.MatterControl.PrintQueue
this.exportingWindow = null;
}
private void SelectLocationToExportGCode(object state)
private void SelectLocationToExportGCode()
{
SelectFolderDialogParams selectParams = new SelectFolderDialogParams("Select Location To Save Files");
selectParams.ActionButtonLabel = "Export".Localize();
@ -246,7 +246,7 @@ namespace MatterHackers.MatterControl.PrintQueue
return true;
}
private void ExportQueueToZipOnIdle(object state)
private void ExportQueueToZipOnIdle()
{
List<PrintItem> partList = QueueData.Instance.CreateReadOnlyPartList();
ProjectFileHandler project = new ProjectFileHandler(partList);
@ -273,7 +273,7 @@ namespace MatterHackers.MatterControl.PrintQueue
return true;
}
private void removeAllPrintsFromQueue(object state)
private void removeAllPrintsFromQueue()
{
QueueData.Instance.RemoveAll();
}

View file

@ -333,7 +333,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
partUnderConsideration = item;
// Show a dialog and only load the part to the queue if the user clicks yes.
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
string memoryWarningMessage = "Are you sure you want to add this part ({0}) to the Queue?\nThe 3D part you are trying to load may be too complicated and cause performance or stability problems.\n\nConsider reducing the geometry before proceeding.".Localize().FormatWith(item.Name);
StyledMessageBox.ShowMessageBox(UserSaidToAllowAddToQueue, memoryWarningMessage, "File May Cause Problems".Localize(), StyledMessageBox.MessageType.YES_NO, "Add To Queue", "Do Not Add");

View file

@ -414,7 +414,7 @@ namespace MatterHackers.MatterControl.PrintQueue
}
}
private void AddItemsToQueue(object state)
private void AddItemsToQueue()
{
FileDialog.OpenFileDialog(
new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams)
@ -622,7 +622,7 @@ namespace MatterHackers.MatterControl.PrintQueue
// Once sorted, remove each selected item
foreach (var item in sortedByIndexPos)
{
item.DeletePartFromQueue(null);
item.DeletePartFromQueue();
}
this.queueDataView.SelectedItems.Clear();
@ -640,17 +640,11 @@ namespace MatterHackers.MatterControl.PrintQueue
List<PrintItemWrapper> itemList = this.queueDataView.SelectedItems.Select(item => item.PrintItemWrapper).ToList();
if (sendButtonFunction != null)
{
UiThread.RunOnIdle((state) =>
{
sendButtonFunction(null, itemList);
});
UiThread.RunOnIdle(() => sendButtonFunction(null, itemList));
}
else
{
UiThread.RunOnIdle((state) =>
{
StyledMessageBox.ShowMessageBox(null, "Oops! Send is currently disabled.", "Send Print");
});
UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(null, "Oops! Send is currently disabled.", "Send Print"));
}
}

View file

@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.PrintQueue
public static void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
{
itemToRemove = printItemWrapper;
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
string maxLengthName = printItemWrapper.FileLocation;
int maxLength = 43;
@ -335,7 +335,7 @@ namespace MatterHackers.MatterControl.PrintQueue
}
}
internal void DeletePartFromQueue(object state)
internal void DeletePartFromQueue()
{
if (PrintItemWrapper.PrintItem.FileLocation == QueueData.SdCardFileName)
{
@ -439,16 +439,13 @@ namespace MatterHackers.MatterControl.PrintQueue
private void onRemovePartClick(object sender, EventArgs e)
{
this.actionButtonContainer.SlideOut();
UiThread.RunOnIdle((state) =>
{
DeletePartFromQueue(state);
});
UiThread.RunOnIdle(DeletePartFromQueue);
}
private void onViewPartClick(object sender, EventArgs e)
{
this.actionButtonContainer.SlideOut();
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
OpenPartViewWindow(View3DWidget.OpenMode.Viewing);
});

View file

@ -2312,7 +2312,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
private void DonePrintingSdFile(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ReadLineStartCallBacks.RemoveCallBackFromKey("Done printing file", DonePrintingSdFile);
});
@ -2346,7 +2346,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
private void FileDeleteConfirmed(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ReadLineStartCallBacks.RemoveCallBackFromKey("File deleted:", FileDeleteConfirmed);
});

View file

@ -153,10 +153,7 @@ namespace MatterHackers.MatterControl
Button cancelPresetsButton = textImageButtonFactory.Generate("Cancel".Localize());
cancelPresetsButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
Close();
});
UiThread.RunOnIdle(Close);
};
FlowLayoutWidget buttonRow = new FlowLayoutWidget();
@ -180,7 +177,7 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(DoSave_Click);
}
private void DoSave_Click(object state)
private void DoSave_Click()
{
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);

View file

@ -99,7 +99,7 @@ namespace MatterHackers.MatterControl
Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
cancelPresetsButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
windowController.ChangeToMacroList();
});
@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl
private void saveMacro_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (ValidateMacroForm())
{
@ -328,7 +328,7 @@ namespace MatterHackers.MatterControl
Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Close"));
cancelPresetsButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
this.windowController.Close();
});
@ -393,7 +393,7 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(DoChangeToMacroList);
}
private void DoChangeToMacroList(object state)
private void DoChangeToMacroList()
{
GuiWidget macroListWidget = new MacroListWidget(this);
this.RemoveAllChildren();
@ -407,7 +407,7 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(DoChangeToMacroDetail);
}
private void DoChangeToMacroDetail(object state)
private void DoChangeToMacroDetail()
{
GuiWidget macroDetailWidget = new MacroDetailWidget(this);
this.RemoveAllChildren();

View file

@ -172,10 +172,7 @@ namespace MatterHackers.MatterControl
Button cancelPresetsButton = textImageButtonFactory.Generate(LocalizedString.Get("Cancel"));
cancelPresetsButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
Close();
});
UiThread.RunOnIdle(Close);
};
FlowLayoutWidget buttonRow = new FlowLayoutWidget();
@ -199,7 +196,7 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(DoSave_Click);
}
private void DoSave_Click(object state)
private void DoSave_Click()
{
bool first = true;
StringBuilder settingString = new StringBuilder();

View file

@ -222,7 +222,7 @@ namespace MatterHackers.MatterControl
UiThread.RunOnIdle(save_OnIdle);
}
private void save_OnIdle(object state)
private void save_OnIdle()
{
bool first = true;
StringBuilder settingString = new StringBuilder();

View file

@ -102,7 +102,7 @@ namespace MatterHackers.MatterControl
}
private event EventHandler unregisterEvents;
public void AddPlugins(object state)
public void AddPlugins()
{
AddPluginControls.CallEvents(this, null);
pluginsQueuedToAdd = false;
@ -161,7 +161,7 @@ namespace MatterHackers.MatterControl
temperatureControlsContainer = new TemperatureControls();
controlsTopToBottomLayout.AddChild(temperatureControlsContainer);
}
private void invalidateWidget(object state)
private void invalidateWidget()
{
this.Invalidate();
}

View file

@ -73,7 +73,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(DoChangeToAddPrinter);
}
private void DoChangeToAddPrinter(object state)
private void DoChangeToAddPrinter()
{
GuiWidget addConnectionWidget = new SetupStepMakeModelName(this, this);
this.RemoveAllChildren();
@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(DoChangeToChoosePrinter);
}
public void DoChangeToChoosePrinter(object state)
public void DoChangeToChoosePrinter()
{
GuiWidget chooseConnectionWidget = new ChooseConnectionWidget(this, this, this.editMode);
this.RemoveAllChildren();

View file

@ -404,7 +404,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
else
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
this.containerWindowToClose.Close();
});

View file

@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
else
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
Parent.Close();
});

View file

@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
private void RecreateCurrentWidget(object state)
private void RecreateCurrentWidget()
{
// you can call this like this
// AfterUiEvents.AddAction(new AfterUIAction(RecreateCurrentWidget));
@ -176,7 +176,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(RecreateCurrentWidget);
}
private void MoveToNextWidget(object state)
private void MoveToNextWidget()
{
// you can call this like this
// AfterUiEvents.AddAction(new AfterUIAction(MoveToNextWidget));

View file

@ -163,7 +163,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
private void RecreateCurrentWidget(object state)
private void RecreateCurrentWidget()
{
Parent.AddChild(new SetupStepComPortManual((ConnectionWindow)Parent, Parent, this.currentPrinterSetupStatus));
Parent.RemoveChild(this);
@ -204,10 +204,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void NextButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
{
Parent.Close();
});
UiThread.RunOnIdle(Parent.Close);
}
}
}

View file

@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(MoveToManualConfiguration);
}
private void MoveToManualConfiguration(object state)
private void MoveToManualConfiguration()
{
Parent.AddChild(new SetupStepComPortManual((ConnectionWindow)Parent, Parent, this.currentPrinterSetupStatus));
Parent.RemoveChild(this);
@ -112,7 +112,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(MoveToNextWidget);
}
private void MoveToNextWidget(object state)
private void MoveToNextWidget()
{
Parent.AddChild(new SetupStepComPortTwo((ConnectionWindow)Parent, Parent, this.currentPrinterSetupStatus));
Parent.RemoveChild(this);

View file

@ -131,7 +131,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
UiThread.RunOnIdle(MoveToManualConfiguration);
}
private void MoveToManualConfiguration(object state)
private void MoveToManualConfiguration()
{
Parent.AddChild(new SetupStepComPortManual((ConnectionWindow)Parent, Parent, this.currentPrinterSetupStatus));
Parent.RemoveChild(this);
@ -193,12 +193,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void NextButton_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle(DoNextButton_Click);
}
private void DoNextButton_Click(object state)
{
Parent.Close();
UiThread.RunOnIdle(Parent.Close);
}
}
}

View file

@ -101,7 +101,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
SaveAndExit();
}
private void MoveToNextWidget(object state)
private void MoveToNextWidget()
{
// you can call this like this
// AfterUiEvents.AddAction(new AfterUIAction(MoveToNextWidget));

View file

@ -51,7 +51,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
}
}
private void installButton_Click(object state)
private void installButton_Click()
{
bool canContinue = this.OnSave();
if (canContinue)
@ -88,7 +88,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
return container;
}
private void MoveToNextWidget(object state)
private void MoveToNextWidget()
{
// you can call this like this
// AfterUiEvents.AddAction(new AfterUIAction(MoveToNextWidget));

View file

@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void ModelDropList_SelectionChanged(object sender, EventArgs e)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ActivePrinter.Model = ((DropDownList)sender).SelectedLabel;
currentPrinterSetupStatus.LoadSetupSettings(ActivePrinter.Make, ActivePrinter.Model);
@ -233,7 +233,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
this.usingDefaultName = false;
}
private void MoveToNextWidget(object state)
private void MoveToNextWidget()
{
if (Parent != null) // if it hasn't been closed
{

View file

@ -253,7 +253,7 @@ namespace MatterHackers.MatterControl
double temp = keyValue.Key;
tempButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SetTargetTemperature(temp);
tempSliderContainer.Visible = false;
@ -271,7 +271,7 @@ namespace MatterHackers.MatterControl
double temp = GetPreheatTemperature();
tempButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
SetTargetTemperature(temp);
@ -527,7 +527,7 @@ namespace MatterHackers.MatterControl
protected override void SetTargetTemperature(double targetTemp)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
double goalTemp = (int)(targetTemp + .5);
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting

View file

@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl
this.AnchorAll();
}
private void DoExportExportLog_Click(object state)
private void DoExportExportLog_Click()
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Save as Text|*.txt");
saveParams.Title = "MatterControl: Terminal Log";
@ -239,7 +239,7 @@ namespace MatterHackers.MatterControl
}
}
private void CloseWindow(object state)
private void CloseWindow()
{
this.Parent.Close();
}

View file

@ -627,7 +627,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.activeSettingsLayers.Add(defaultSettingsLayer);
}
public void LoadSettingsFromIni(object state)
public void LoadSettingsFromIni()
{
OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Configuration|*.slice;*.ini");
openParams.ActionButtonLabel = "Load Configuration";

View file

@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
ActivePrinterProfile.Instance.ActiveQualitySettingsID = Int32.Parse(item.Value);
}
}
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ActiveSliceSettings.Instance.LoadAllSettings();
ApplicationController.Instance.ReloadAdvancedControlsPanel();
@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// after getting the new name select it and relead the slice setting widget editing the new setting
throw new NotImplementedException();
#else
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ActiveSliceSettings.Instance.LoadAllSettings();
ApplicationController.Instance.ReloadAdvancedControlsPanel();

View file

@ -208,10 +208,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Button cancelButton = buttonFactory.Generate(LocalizedString.Get("Cancel"));
cancelButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
{
windowController.ChangeToSlicePresetList();
});
UiThread.RunOnIdle(windowController.ChangeToSlicePresetList);
};
container.AddChild(savePresetButton);
@ -370,16 +367,13 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
MenuItem item = (MenuItem)sender;
string[] valueArray = item.Value.Split(':');
UiThread.RunOnIdle((state) =>
{
PopulateAddSettingRow(Int32.Parse(valueArray[0]), Int32.Parse(valueArray[1]), valueArray[2]);
});
UiThread.RunOnIdle(() => PopulateAddSettingRow(Int32.Parse(valueArray[0]), Int32.Parse(valueArray[1]), valueArray[2]));
}
private void LoadSettingsRows()
{
settingsRowContainer.RemoveScrollChildren();
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
foreach (KeyValuePair<String, DataStorage.SliceSetting> item in this.windowController.ActivePresetLayer.settingsDictionary)
{
@ -413,7 +407,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private void AddSettingToPreset()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (addRowSettingData != null)
{
@ -456,7 +450,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private void RemoveSetting(string configName)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (this.windowController.ActivePresetLayer.settingsDictionary.ContainsKey(configName))
{
@ -904,7 +898,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private void savePresets_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (ValidatePresetsForm())
{
@ -920,7 +914,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private void duplicatePresets_Click(object sender, EventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
DataStorage.SliceSettingsCollection duplicateCollection = new SliceSettingsCollection();
duplicateCollection.Name = string.Format("{0} (copy)".FormatWith(windowController.ActivePresetLayer.settingsCollectionData.Name));
@ -998,7 +992,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
UiThread.RunOnIdle(SaveAs);
}
private void SaveAs(object state)
private void SaveAs()
{
SaveFileDialogParams saveParams = new SaveFileDialogParams("Save Slice Preset|*." + configFileExtension);
saveParams.FileName = presetNameInput.Text;

View file

@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Button addPresetButton = buttonFactory.Generate(LocalizedString.Get("Add"), "icon_circle_plus.png");
addPresetButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
windowController.ChangeToSlicePresetDetail();
});
@ -136,7 +136,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
Button closeButton = buttonFactory.Generate(LocalizedString.Get("Close"));
closeButton.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
windowController.Close();
});
@ -155,7 +155,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
UiThread.RunOnIdle(importPresetDo);
}
private void importPresetDo(object state)
private void importPresetDo()
{
OpenFileDialogParams openParams = new OpenFileDialogParams("Load Slice Preset|*.slice;*.ini");
openParams.ActionButtonLabel = "Load Slice Preset";
@ -248,7 +248,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
materialEditLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
materialEditLink.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
windowController.ChangeToSlicePresetDetail(preset);
});
@ -259,7 +259,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
materialRemoveLink.VAnchor = Agg.UI.VAnchor.ParentCenter;
materialRemoveLink.Click += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
//Unwind this setting if it is currently active
if (ActivePrinterProfile.Instance.ActivePrinter != null)

View file

@ -80,7 +80,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
UiThread.RunOnIdle(DoChangeToSlicePresetList);
}
private void DoChangeToSlicePresetList(object state)
private void DoChangeToSlicePresetList()
{
GuiWidget slicePresetWidget = new SlicePresetListWidget(this);
this.RemoveAllChildren();
@ -129,7 +129,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
return result;
}
private void DoChangeToSlicePresetDetail(object state)
private void DoChangeToSlicePresetDetail()
{
GuiWidget macroDetailWidget = new SlicePresetDetailWidget(this);
this.RemoveAllChildren();

View file

@ -210,19 +210,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
private bool ImportQueueMenu_Click()
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
ActiveSliceSettings.Instance.LoadSettingsFromIni(state);
ActiveSliceSettings.Instance.LoadSettingsFromIni();
});
return true;
}
private bool ExportQueueMenu_Click()
{
UiThread.RunOnIdle((state) =>
{
ActiveSliceSettings.Instance.SaveAs();
});
UiThread.RunOnIdle(ActiveSliceSettings.Instance.SaveAs);
return true;
}
@ -594,7 +591,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
string settingsScrollPosition = "SliceSettingsWidget_{0}_{1}_ScrollPosition".FormatWith(category.Name, group.Name);
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(()=>
{
int scrollPosition = UserSettings.Instance.Fields.GetInt(settingsScrollPosition, -100000);
if (scrollPosition != -100000)
@ -1324,7 +1321,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
container.MouseEnterBounds += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
overlay.Visible = false;
clickToEdit.Visible = true;
@ -1333,7 +1330,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
container.MouseLeaveBounds += (sender, e) =>
{
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
overlay.Visible = true;
clickToEdit.Visible = false;

View file

@ -365,7 +365,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
message = "Saving intermediate file";
}
message += "...";
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
itemToSlice.OnSlicingOutputMessage(new StringEventArgs(message));
});
@ -430,7 +430,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
}
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
itemToSlice.CurrentlySlicing = false;
itemToSlice.DoneSlicing = true;
@ -459,7 +459,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
message = "Saving intermediate file";
}
message += "...";
UiThread.RunOnIdle((state) =>
UiThread.RunOnIdle(() =>
{
if (itemCurrentlySlicing != null)
{

@ -1 +1 @@
Subproject commit 2954046c7794474a729c85ea72ebba9bfd409184
Subproject commit ae8d756ea8b204e9a18b9131be3cddc7edfb104e