diff --git a/AboutPage/AboutWindow.cs b/AboutPage/AboutWindow.cs index 0e02623ca..7d139e836 100644 --- a/AboutPage/AboutWindow.cs +++ b/AboutPage/AboutWindow.cs @@ -90,10 +90,7 @@ namespace MatterHackers.MatterControl private void CancelButton_Click() { - UiThread.RunOnIdle((state) => - { - aboutWindow.Close(); - }); + UiThread.RunOnIdle(aboutWindow.Close); } } } \ No newline at end of file diff --git a/AboutPage/ContactForm.cs b/AboutPage/ContactForm.cs index e64aa3bf4..b74bb4f4f 100644 --- a/AboutPage/ContactForm.cs +++ b/AboutPage/ContactForm.cs @@ -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); } diff --git a/AboutPage/UpdateControlData.cs b/AboutPage/UpdateControlData.cs index 1d45c625f..8ef4f40d4 100644 --- a/AboutPage/UpdateControlData.cs +++ b/AboutPage/UpdateControlData.cs @@ -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(); diff --git a/ActionBar/ActionBarBaseControls.cs b/ActionBar/ActionBarBaseControls.cs index 33b634d79..b5b6ef7d6 100644 --- a/ActionBar/ActionBarBaseControls.cs +++ b/ActionBar/ActionBarBaseControls.cs @@ -165,7 +165,7 @@ namespace MatterHackers.MatterControl.ActionBar private void onActivePrinterChanged(object sender, EventArgs e) { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { SetButtonText(); }); diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index 0126b78c6..6e239bb99 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -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) diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs index d9e96a271..2e13d0dd4 100644 --- a/ActionBar/PrintStatusRow.cs +++ b/ActionBar/PrintStatusRow.cs @@ -315,7 +315,7 @@ namespace MatterHackers.MatterControl.ActionBar activePrintPreviewImage.Invalidate(); } - private void OnIdle(object state) + private void OnIdle() { if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting) { diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index 5037d2a12..5065d4ace 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -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) { diff --git a/ApplicationView/CompactTabView.cs b/ApplicationView/CompactTabView.cs index c7c34ecf3..26a8f49ab 100644 --- a/ApplicationView/CompactTabView.cs +++ b/ApplicationView/CompactTabView.cs @@ -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(); diff --git a/ApplicationView/MainApplicationWidget.cs b/ApplicationView/MainApplicationWidget.cs index 1d5575aac..7ae9b453f 100644 --- a/ApplicationView/MainApplicationWidget.cs +++ b/ApplicationView/MainApplicationWidget.cs @@ -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); diff --git a/ApplicationView/MenuRow/ApplicationMenuRow.cs b/ApplicationView/MenuRow/ApplicationMenuRow.cs index dce2b5697..19418809b 100644 --- a/ApplicationView/MenuRow/ApplicationMenuRow.cs +++ b/ApplicationView/MenuRow/ApplicationMenuRow.cs @@ -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(); }); diff --git a/ApplicationView/MenuRow/MenuOptionFile.cs b/ApplicationView/MenuRow/MenuOptionFile.cs index 2f25a116d..6e05c0c37 100644 --- a/ApplicationView/MenuRow/MenuOptionFile.cs +++ b/ApplicationView/MenuRow/MenuOptionFile.cs @@ -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) diff --git a/ApplicationView/MenuRow/MenuOptionHelp.cs b/ApplicationView/MenuRow/MenuOptionHelp.cs index ec9004bd2..a627366aa 100644 --- a/ApplicationView/MenuRow/MenuOptionHelp.cs +++ b/ApplicationView/MenuRow/MenuOptionHelp.cs @@ -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"); }); diff --git a/ApplicationView/MenuRow/MenuOptionSettings.cs b/ApplicationView/MenuRow/MenuOptionSettings.cs index 4a6f46007..4d1b8253b 100644 --- a/ApplicationView/MenuRow/MenuOptionSettings.cs +++ b/ApplicationView/MenuRow/MenuOptionSettings.cs @@ -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; } } diff --git a/ApplicationView/ThirdPanelTabView.cs b/ApplicationView/ThirdPanelTabView.cs index 283278f5a..c6c5b5584 100644 --- a/ApplicationView/ThirdPanelTabView.cs +++ b/ApplicationView/ThirdPanelTabView.cs @@ -170,7 +170,7 @@ namespace MatterHackers.MatterControl get { return "Controls Tab"; } } - public void ReloadSliceSettings(object state) + public void ReloadSliceSettings() { WidescreenPanel.PreChangePanels.CallEvents(null, null); diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs index fb46236bb..37d017d27 100644 --- a/ApplicationView/WidescreenPanel.cs +++ b/ApplicationView/WidescreenPanel.cs @@ -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); } diff --git a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs index 71a15faf4..db988097c 100644 --- a/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs +++ b/ConfigurationPage/ApplicationSettings/ApplicationSettingsView.cs @@ -382,7 +382,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage private void RestartApplication() { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { // Iterate to the top SystemWindow GuiWidget parent = this; diff --git a/ConfigurationPage/CloudSettings/CloudSettingsView.cs b/ConfigurationPage/CloudSettings/CloudSettingsView.cs index 58c6aa4dd..014d663d8 100644 --- a/ConfigurationPage/CloudSettings/CloudSettingsView.cs +++ b/ConfigurationPage/CloudSettings/CloudSettingsView.cs @@ -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); }); diff --git a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs index 39d874190..e2da2ffc8 100644 --- a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs +++ b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs @@ -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); }); diff --git a/ConfigurationPage/PrinterConfigurationPage.cs b/ConfigurationPage/PrinterConfigurationPage.cs index c3f179df7..74b1c7587 100644 --- a/ConfigurationPage/PrinterConfigurationPage.cs +++ b/ConfigurationPage/PrinterConfigurationPage.cs @@ -123,7 +123,7 @@ namespace MatterHackers.MatterControl private void RestartApplication() { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { //horrible hack - to be replaced GuiWidget parent = this; diff --git a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs index 6d3515a7d..06d95aad1 100644 --- a/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs +++ b/ConfigurationPage/PrinterSettings/PrinterSettingsView.cs @@ -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) diff --git a/ControlElements/PopOutManager.cs b/ControlElements/PopOutManager.cs index 59e128a7a..ab9ba2f2e 100644 --- a/ControlElements/PopOutManager.cs +++ b/ControlElements/PopOutManager.cs @@ -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; diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs index c515d4d97..f523e3367 100644 --- a/CustomWidgets/ExportPrintItemWindow.cs +++ b/CustomWidgets/ExportPrintItemWindow.cs @@ -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"; diff --git a/CustomWidgets/PartThumbnailWidget.cs b/CustomWidgets/PartThumbnailWidget.cs index 14712917f..282aabe9f 100644 --- a/CustomWidgets/PartThumbnailWidget.cs +++ b/CustomWidgets/PartThumbnailWidget.cs @@ -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(); diff --git a/CustomWidgets/PluginChooserWindow.cs b/CustomWidgets/PluginChooserWindow.cs index 97096de6d..265995ccf 100644 --- a/CustomWidgets/PluginChooserWindow.cs +++ b/CustomWidgets/PluginChooserWindow.cs @@ -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); }); diff --git a/CustomWidgets/PrintProgressBarWidget.cs b/CustomWidgets/PrintProgressBarWidget.cs index 19692d223..4d7d1ba27 100644 --- a/CustomWidgets/PrintProgressBarWidget.cs +++ b/CustomWidgets/PrintProgressBarWidget.cs @@ -178,7 +178,7 @@ namespace MatterHackers.MatterControl UpdatePrintStatus(); } - private void OnIdle(object state) + private void OnIdle() { currentPercent = PrinterConnectionAndCommunication.Instance.PercentComplete; UpdatePrintStatus(); diff --git a/EeProm/EePromMarlinWindow.cs b/EeProm/EePromMarlinWindow.cs index a16fb37a9..a4e91d68c 100644 --- a/EeProm/EePromMarlinWindow.cs +++ b/EeProm/EePromMarlinWindow.cs @@ -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(); diff --git a/EeProm/EePromRepetierWindow.cs b/EeProm/EePromRepetierWindow.cs index 89cc17985..b1cbfcf16 100644 --- a/EeProm/EePromRepetierWindow.cs +++ b/EeProm/EePromRepetierWindow.cs @@ -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(); diff --git a/MatterControl.csproj b/MatterControl.csproj index 6e63aa207..8c33d9e95 100644 --- a/MatterControl.csproj +++ b/MatterControl.csproj @@ -205,6 +205,7 @@ + diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index d5e8649ec..2420e6725 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -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 { diff --git a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs index 0bf483056..d45de9ad5 100644 --- a/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs +++ b/PartPreviewWindow/BaseClasses/PartPreview3DWidget.cs @@ -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), diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs index 2b3876dbe..a8dbdd5b5 100644 --- a/PartPreviewWindow/View3D/View3DWidget.cs +++ b/PartPreviewWindow/View3D/View3DWidget.cs @@ -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 = ""; }); diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 4691efe3a..055327cb9 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -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); } } diff --git a/PrintHistory/PrintHistoryDataView.cs b/PrintHistory/PrintHistoryDataView.cs index 9b0b295af..aa5c363cc 100644 --- a/PrintHistory/PrintHistoryDataView.cs +++ b/PrintHistory/PrintHistoryDataView.cs @@ -144,7 +144,7 @@ namespace MatterHackers.MatterControl.PrintHistory private void ReloadData(object sender, EventArgs e) { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { LoadHistoryItems(Count); }); diff --git a/PrintHistory/PrintHistoryListItem.cs b/PrintHistory/PrintHistoryListItem.cs index 3c5568200..8aa90ccba 100644 --- a/PrintHistory/PrintHistoryListItem.cs +++ b/PrintHistory/PrintHistoryListItem.cs @@ -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; diff --git a/PrintLibrary/LibraryRowItem.cs b/PrintLibrary/LibraryRowItem.cs index 066b20f93..72b7c5445 100644 --- a/PrintLibrary/LibraryRowItem.cs +++ b/PrintLibrary/LibraryRowItem.cs @@ -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)) diff --git a/PrintLibrary/PrintLibraryWidget.cs b/PrintLibrary/PrintLibraryWidget.cs index 33e18a6cc..1870a12a4 100644 --- a/PrintLibrary/PrintLibraryWidget.cs +++ b/PrintLibrary/PrintLibraryWidget.cs @@ -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); diff --git a/PrintLibrary/Provider/LibraryProvider.cs b/PrintLibrary/Provider/LibraryProvider.cs index be79971e9..0be13a6a8 100644 --- a/PrintLibrary/Provider/LibraryProvider.cs +++ b/PrintLibrary/Provider/LibraryProvider.cs @@ -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); diff --git a/PrintLibrary/Provider/LibraryProviderFileSystem.cs b/PrintLibrary/Provider/LibraryProviderFileSystem.cs new file mode 100644 index 000000000..79d9d6cd4 --- /dev/null +++ b/PrintLibrary/Provider/LibraryProviderFileSystem.cs @@ -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 files, ReportProgressRatio reportProgress = null, RunWorkerCompletedEventHandler callback = null) + { + throw new NotImplementedException(); + } + + public override void RemoveItem(PrintItemWrapper printItemWrapper) + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/PrintLibrary/Provider/LibrarySQLiteData.cs b/PrintLibrary/Provider/LibrarySQLiteData.cs index 40ffc6358..ed0f6ba3c 100644 --- a/PrintLibrary/Provider/LibrarySQLiteData.cs +++ b/PrintLibrary/Provider/LibrarySQLiteData.cs @@ -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"); }); diff --git a/PrintQueue/OptionsMenu/QueueOptionsMenu.cs b/PrintQueue/OptionsMenu/QueueOptionsMenu.cs index d065510e4..760675de8 100644 --- a/PrintQueue/OptionsMenu/QueueOptionsMenu.cs +++ b/PrintQueue/OptionsMenu/QueueOptionsMenu.cs @@ -132,7 +132,7 @@ namespace MatterHackers.MatterControl.PrintQueue return true; } - private void PartSheetClickOnIdle(object state) + private void PartSheetClickOnIdle() { #if !__ANDROID__ List 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 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(); } diff --git a/PrintQueue/QueueData.cs b/PrintQueue/QueueData.cs index d43434783..514a0585f 100644 --- a/PrintQueue/QueueData.cs +++ b/PrintQueue/QueueData.cs @@ -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"); diff --git a/PrintQueue/QueueDataWidget.cs b/PrintQueue/QueueDataWidget.cs index baaccb2ad..16f700df8 100644 --- a/PrintQueue/QueueDataWidget.cs +++ b/PrintQueue/QueueDataWidget.cs @@ -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 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")); } } diff --git a/PrintQueue/QueueRowItem.cs b/PrintQueue/QueueRowItem.cs index 83c53735b..2714e5825 100644 --- a/PrintQueue/QueueRowItem.cs +++ b/PrintQueue/QueueRowItem.cs @@ -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); }); diff --git a/PrinterCommunication/PrinterConnectionAndCommunication.cs b/PrinterCommunication/PrinterConnectionAndCommunication.cs index a1b942a66..c015f83f5 100644 --- a/PrinterCommunication/PrinterConnectionAndCommunication.cs +++ b/PrinterCommunication/PrinterConnectionAndCommunication.cs @@ -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); }); diff --git a/PrinterControls/EditLevelingSettingsWindow.cs b/PrinterControls/EditLevelingSettingsWindow.cs index 63d0da9e1..2b81db530 100644 --- a/PrinterControls/EditLevelingSettingsWindow.cs +++ b/PrinterControls/EditLevelingSettingsWindow.cs @@ -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); diff --git a/PrinterControls/EditMacrosWindow.cs b/PrinterControls/EditMacrosWindow.cs index 19c39ce8e..495305b97 100644 --- a/PrinterControls/EditMacrosWindow.cs +++ b/PrinterControls/EditMacrosWindow.cs @@ -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(); diff --git a/PrinterControls/EditManualMovementSpeedsWindow.cs b/PrinterControls/EditManualMovementSpeedsWindow.cs index 91662772f..8fc23b2bf 100644 --- a/PrinterControls/EditManualMovementSpeedsWindow.cs +++ b/PrinterControls/EditManualMovementSpeedsWindow.cs @@ -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(); diff --git a/PrinterControls/EditTemperaturePresetsWindow.cs b/PrinterControls/EditTemperaturePresetsWindow.cs index 5b44b90e8..aee9528bb 100644 --- a/PrinterControls/EditTemperaturePresetsWindow.cs +++ b/PrinterControls/EditTemperaturePresetsWindow.cs @@ -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(); diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index e9a880e9b..ac3e7db4c 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -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(); } diff --git a/PrinterControls/PrinterConnections/ConnectionWindow.cs b/PrinterControls/PrinterConnections/ConnectionWindow.cs index 568ec892c..4344c51f7 100644 --- a/PrinterControls/PrinterConnections/ConnectionWindow.cs +++ b/PrinterControls/PrinterConnections/ConnectionWindow.cs @@ -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(); diff --git a/PrinterControls/PrinterConnections/EditConnectionWidget.cs b/PrinterControls/PrinterConnections/EditConnectionWidget.cs index 879fbde2f..004d7e146 100644 --- a/PrinterControls/PrinterConnections/EditConnectionWidget.cs +++ b/PrinterControls/PrinterConnections/EditConnectionWidget.cs @@ -404,7 +404,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections } else { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { this.containerWindowToClose.Close(); }); diff --git a/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs b/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs index bcfdea88b..4892bea4b 100644 --- a/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs +++ b/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs @@ -118,7 +118,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections } else { - UiThread.RunOnIdle((state) => + UiThread.RunOnIdle(() => { Parent.Close(); }); diff --git a/PrinterControls/PrinterConnections/SetupStepBaudRate.cs b/PrinterControls/PrinterConnections/SetupStepBaudRate.cs index c3ea1e230..8b2d9ebf2 100644 --- a/PrinterControls/PrinterConnections/SetupStepBaudRate.cs +++ b/PrinterControls/PrinterConnections/SetupStepBaudRate.cs @@ -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)); diff --git a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs index df2ab211b..a37a0b6ae 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs @@ -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); } } } \ No newline at end of file diff --git a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs index 8362d79b0..98b05402d 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs @@ -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); diff --git a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs index 9a3f855ce..cf259b011 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs @@ -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); } } } \ No newline at end of file diff --git a/PrinterControls/PrinterConnections/SetupStepConfigureConnection.cs b/PrinterControls/PrinterConnections/SetupStepConfigureConnection.cs index ccf7ed171..d5ffdc3df 100644 --- a/PrinterControls/PrinterConnections/SetupStepConfigureConnection.cs +++ b/PrinterControls/PrinterConnections/SetupStepConfigureConnection.cs @@ -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)); diff --git a/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs b/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs index 367292453..04952c870 100644 --- a/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs +++ b/PrinterControls/PrinterConnections/SetupStepInstallDriver.cs @@ -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)); diff --git a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs index 0c41d2b7e..a84752ad1 100644 --- a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs +++ b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs @@ -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 { diff --git a/PrinterControls/TemperatureIndicator.cs b/PrinterControls/TemperatureIndicator.cs index c9508ff77..c5ef8f140 100644 --- a/PrinterControls/TemperatureIndicator.cs +++ b/PrinterControls/TemperatureIndicator.cs @@ -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 diff --git a/PrinterControls/TerminalWindow/TerminalWidget.cs b/PrinterControls/TerminalWindow/TerminalWidget.cs index 189808920..7ebd1834a 100644 --- a/PrinterControls/TerminalWindow/TerminalWidget.cs +++ b/PrinterControls/TerminalWindow/TerminalWidget.cs @@ -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(); } diff --git a/SlicerConfiguration/ActiveSliceSettings.cs b/SlicerConfiguration/ActiveSliceSettings.cs index e290f5a99..36bed76cd 100644 --- a/SlicerConfiguration/ActiveSliceSettings.cs +++ b/SlicerConfiguration/ActiveSliceSettings.cs @@ -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"; diff --git a/SlicerConfiguration/SettingsControlSelectors.cs b/SlicerConfiguration/SettingsControlSelectors.cs index 979e07b1a..18fa71dc9 100644 --- a/SlicerConfiguration/SettingsControlSelectors.cs +++ b/SlicerConfiguration/SettingsControlSelectors.cs @@ -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(); diff --git a/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs b/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs index 0e1b39b15..bfa6373e8 100644 --- a/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs +++ b/SlicerConfiguration/SlicePresetsWindow/SlicePresetDetailWidget.cs @@ -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 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; diff --git a/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs b/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs index ae45ae0fe..0dc5840e9 100644 --- a/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs +++ b/SlicerConfiguration/SlicePresetsWindow/SlicePresetListWidget.cs @@ -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) diff --git a/SlicerConfiguration/SlicePresetsWindow/SlicePresetsWindow.cs b/SlicerConfiguration/SlicePresetsWindow/SlicePresetsWindow.cs index 7c67b1ba8..c1eba063a 100644 --- a/SlicerConfiguration/SlicePresetsWindow/SlicePresetsWindow.cs +++ b/SlicerConfiguration/SlicePresetsWindow/SlicePresetsWindow.cs @@ -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(); diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 7b4b870a0..7f26c6baa 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -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; diff --git a/SlicerConfiguration/SlicingQueue.cs b/SlicerConfiguration/SlicingQueue.cs index 061a4eb69..df3a444ed 100644 --- a/SlicerConfiguration/SlicingQueue.cs +++ b/SlicerConfiguration/SlicingQueue.cs @@ -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) { diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 2954046c7..ae8d756ea 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 2954046c7794474a729c85ea72ebba9bfd409184 +Subproject commit ae8d756ea8b204e9a18b9131be3cddc7edfb104e