From b110118e413b59165ee576dfd899bfc0cc7e9128 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 8 Dec 2015 16:56:51 -0800 Subject: [PATCH] Remove async modifiers from non-async methods - Use Task.FromResult where needed --- Library/LibraryRowItemPart.cs | 4 ++-- Library/PrintLibraryWidget.cs | 2 +- Library/Provider/LibraryProviderFileSystem.cs | 4 ++-- Library/Provider/LibraryProviderHistory.cs | 2 +- Library/Provider/LibraryProviderQueue.cs | 4 ++-- Library/Provider/LibraryProviderSelector.cs | 2 +- Library/Provider/LibraryProviderSqlite.cs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Library/LibraryRowItemPart.cs b/Library/LibraryRowItemPart.cs index 7ff066387..5c73d97c0 100644 --- a/Library/LibraryRowItemPart.cs +++ b/Library/LibraryRowItemPart.cs @@ -245,7 +245,7 @@ namespace MatterHackers.MatterControl.PrintLibrary } } - public async override void RemoveFromCollection() + public override void RemoveFromCollection() { libraryDataView.CurrentLibraryProvider.RemoveItem(ItemIndex); } @@ -309,7 +309,7 @@ namespace MatterHackers.MatterControl.PrintLibrary this.Invalidate(); } - protected async override void RemoveThisFromPrintLibrary() + protected override void RemoveThisFromPrintLibrary() { // TODO: The LibraryProvider does not need a printitemwrapper to remove an item! Why not an interger like the others? libraryDataView.CurrentLibraryProvider.RemoveItem(ItemIndex); diff --git a/Library/PrintLibraryWidget.cs b/Library/PrintLibraryWidget.cs index 6278a8659..d020f98a1 100644 --- a/Library/PrintLibraryWidget.cs +++ b/Library/PrintLibraryWidget.cs @@ -508,7 +508,7 @@ namespace MatterHackers.MatterControl.PrintLibrary SetEditButtonsStates(); } - private async void SetEditButtonsStates() + private void SetEditButtonsStates() { int selectedCount = libraryDataView.SelectedItems.Count; diff --git a/Library/Provider/LibraryProviderFileSystem.cs b/Library/Provider/LibraryProviderFileSystem.cs index 5c2f5143e..1e2d87c41 100644 --- a/Library/Provider/LibraryProviderFileSystem.cs +++ b/Library/Provider/LibraryProviderFileSystem.cs @@ -208,11 +208,11 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider return Path.GetFileNameWithoutExtension(currentDirectoryFiles[itemIndex]); } - public async override Task GetPrintItemWrapperAsync(int itemIndex) + public override Task GetPrintItemWrapperAsync(int itemIndex) { string fileName = currentDirectoryFiles[itemIndex]; - return new PrintItemWrapper(new DataStorage.PrintItem(GetPrintItemName(itemIndex), fileName), this.GetProviderLocator()); + return Task.FromResult(new PrintItemWrapper(new DataStorage.PrintItem(GetPrintItemName(itemIndex), fileName), this.GetProviderLocator())); } public override LibraryProvider GetProviderForCollection(PrintItemCollection collection) diff --git a/Library/Provider/LibraryProviderHistory.cs b/Library/Provider/LibraryProviderHistory.cs index c161c197d..f360868f8 100644 --- a/Library/Provider/LibraryProviderHistory.cs +++ b/Library/Provider/LibraryProviderHistory.cs @@ -165,7 +165,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider throw new NotImplementedException(); } - public async override Task GetPrintItemWrapperAsync(int index) + public override Task GetPrintItemWrapperAsync(int index) { throw new NotImplementedException(); //return PrintHistoryData.Instance.GetPrintItemWrapper(index); diff --git a/Library/Provider/LibraryProviderQueue.cs b/Library/Provider/LibraryProviderQueue.cs index 98ea3500b..ab67cb526 100644 --- a/Library/Provider/LibraryProviderQueue.cs +++ b/Library/Provider/LibraryProviderQueue.cs @@ -167,9 +167,9 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider QueueData.Instance.AddItem(item, indexToInsert); } - public async override Task GetPrintItemWrapperAsync(int index) + public override Task GetPrintItemWrapperAsync(int index) { - return QueueData.Instance.GetPrintItemWrapper(index); + return Task.FromResult(QueueData.Instance.GetPrintItemWrapper(index)); } public override LibraryProvider GetProviderForCollection(PrintItemCollection collection) diff --git a/Library/Provider/LibraryProviderSelector.cs b/Library/Provider/LibraryProviderSelector.cs index c97f89a6a..aa436a354 100644 --- a/Library/Provider/LibraryProviderSelector.cs +++ b/Library/Provider/LibraryProviderSelector.cs @@ -298,7 +298,7 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider return new PrintItemCollection(provider.Name, provider.ProviderKey); } - public async override Task GetPrintItemWrapperAsync(int itemIndex) + public override Task GetPrintItemWrapperAsync(int itemIndex) { throw new NotImplementedException("Print items are not allowed at the root level"); } diff --git a/Library/Provider/LibraryProviderSqlite.cs b/Library/Provider/LibraryProviderSqlite.cs index abb773755..a1b06efb0 100644 --- a/Library/Provider/LibraryProviderSqlite.cs +++ b/Library/Provider/LibraryProviderSqlite.cs @@ -302,11 +302,11 @@ namespace MatterHackers.MatterControl.PrintLibrary.Provider return printItems[itemIndex].Name; } - public async override Task GetPrintItemWrapperAsync(int index) + public override Task GetPrintItemWrapperAsync(int index) { if (index >= 0 && index < printItems.Count) { - return new PrintItemWrapper(printItems[index], this.GetProviderLocator()); + return Task.FromResult(new PrintItemWrapper(printItems[index], this.GetProviderLocator())); } return null;