mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
SonarQube async method return type set to Task
This commit is contained in:
@@ -25,7 +25,7 @@ namespace ModernKeePass.Actions
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageDialogHelper.ShowErrorDialog(ex);
|
MessageDialogHelper.ShowErrorDialog(ex).Wait();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,7 @@ namespace ModernKeePass
|
|||||||
|
|
||||||
#region Event Handlers
|
#region Event Handlers
|
||||||
|
|
||||||
private void OnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
|
private async void OnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
|
||||||
{
|
{
|
||||||
// Save the argument exception because it's cleared on first access
|
// Save the argument exception because it's cleared on first access
|
||||||
var exception = unhandledExceptionEventArgs.Exception;
|
var exception = unhandledExceptionEventArgs.Exception;
|
||||||
@@ -54,7 +54,7 @@ namespace ModernKeePass
|
|||||||
if (realException is SaveException)
|
if (realException is SaveException)
|
||||||
{
|
{
|
||||||
unhandledExceptionEventArgs.Handled = true;
|
unhandledExceptionEventArgs.Handled = true;
|
||||||
MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("MessageDialogSaveErrorTitle"),
|
await MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("MessageDialogSaveErrorTitle"),
|
||||||
realException.InnerException.Message,
|
realException.InnerException.Message,
|
||||||
resource.GetResourceValue("MessageDialogSaveErrorButtonSaveAs"),
|
resource.GetResourceValue("MessageDialogSaveErrorButtonSaveAs"),
|
||||||
resource.GetResourceValue("MessageDialogSaveErrorButtonDiscard"),
|
resource.GetResourceValue("MessageDialogSaveErrorButtonDiscard"),
|
||||||
@@ -90,7 +90,7 @@ namespace ModernKeePass
|
|||||||
OnLaunchOrActivated(args);
|
OnLaunchOrActivated(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLaunchOrActivated(IActivatedEventArgs e)
|
private async void OnLaunchOrActivated(IActivatedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@@ -116,7 +116,7 @@ namespace ModernKeePass
|
|||||||
{
|
{
|
||||||
//TODO: Load state from previously terminated application
|
//TODO: Load state from previously terminated application
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
MessageDialogHelper.ShowNotificationDialog("App terminated", "Windows or an error made the app terminate");
|
await MessageDialogHelper.ShowNotificationDialog("App terminated", "Windows or an error made the app terminate");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ namespace ModernKeePass
|
|||||||
Window.Current.Activate();
|
Window.Current.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnResuming(object sender, object e)
|
private async void OnResuming(object sender, object e)
|
||||||
{
|
{
|
||||||
var currentFrame = Window.Current.Content as Frame;
|
var currentFrame = Window.Current.Content as Frame;
|
||||||
var database = DatabaseService.Instance;
|
var database = DatabaseService.Instance;
|
||||||
@@ -151,7 +151,7 @@ namespace ModernKeePass
|
|||||||
{
|
{
|
||||||
currentFrame?.Navigate(typeof(MainPage));
|
currentFrame?.Navigate(typeof(MainPage));
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
MessageDialogHelper.ShowErrorDialog(ex);
|
await MessageDialogHelper.ShowErrorDialog(ex);
|
||||||
#endif
|
#endif
|
||||||
ToastNotificationHelper.ShowGenericToast("App suspended", "Database was closed (changes were saved)");
|
ToastNotificationHelper.ShowGenericToast("App suspended", "Database was closed (changes were saved)");
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Windows.UI.Popups;
|
using Windows.UI.Popups;
|
||||||
|
|
||||||
namespace ModernKeePass.Common
|
namespace ModernKeePass.Common
|
||||||
{
|
{
|
||||||
public static class MessageDialogHelper
|
public static class MessageDialogHelper
|
||||||
{
|
{
|
||||||
public static async void ShowActionDialog(string title, string contentText, string actionButtonText, string cancelButtonText, UICommandInvokedHandler actionCommand, UICommandInvokedHandler cancelCommand)
|
public static async Task ShowActionDialog(string title, string contentText, string actionButtonText, string cancelButtonText, UICommandInvokedHandler actionCommand, UICommandInvokedHandler cancelCommand)
|
||||||
{
|
{
|
||||||
// Create the message dialog and set its content
|
// Create the message dialog and set its content
|
||||||
var messageDialog = CreateBasicDialog(title, contentText, cancelButtonText, cancelCommand);
|
var messageDialog = CreateBasicDialog(title, contentText, cancelButtonText, cancelCommand);
|
||||||
@@ -17,7 +18,7 @@ namespace ModernKeePass.Common
|
|||||||
await messageDialog.ShowAsync();
|
await messageDialog.ShowAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async void ShowErrorDialog(Exception exception)
|
public static async Task ShowErrorDialog(Exception exception)
|
||||||
{
|
{
|
||||||
if (exception == null) return;
|
if (exception == null) return;
|
||||||
// Create the message dialog and set its content
|
// Create the message dialog and set its content
|
||||||
@@ -27,7 +28,7 @@ namespace ModernKeePass.Common
|
|||||||
await messageDialog.ShowAsync();
|
await messageDialog.ShowAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async void ShowNotificationDialog(string title, string message)
|
public static async Task ShowNotificationDialog(string title, string message)
|
||||||
{
|
{
|
||||||
var dialog = CreateBasicDialog(title, message, "OK");
|
var dialog = CreateBasicDialog(title, message, "OK");
|
||||||
|
|
||||||
|
@@ -215,7 +215,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageDialogHelper.ShowErrorDialog(e);
|
MessageDialogHelper.ShowErrorDialog(e).Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageDialogHelper.ShowErrorDialog(e);
|
MessageDialogHelper.ShowErrorDialog(e).Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using Windows.Storage;
|
using System.Threading.Tasks;
|
||||||
|
using Windows.Storage;
|
||||||
using ModernKeePass.Common;
|
using ModernKeePass.Common;
|
||||||
using ModernKeePass.Interfaces;
|
using ModernKeePass.Interfaces;
|
||||||
using ModernKeePass.Services;
|
using ModernKeePass.Services;
|
||||||
@@ -30,10 +31,10 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public void UpdateAccessTime()
|
public void UpdateAccessTime()
|
||||||
{
|
{
|
||||||
UpdateAccessTime(RecentService.Instance);
|
UpdateAccessTime(RecentService.Instance).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void UpdateAccessTime(IRecentService recent)
|
public async Task UpdateAccessTime(IRecentService recent)
|
||||||
{
|
{
|
||||||
await recent.GetFileAsync(Token);
|
await recent.GetFileAsync(Token);
|
||||||
}
|
}
|
||||||
|
@@ -55,14 +55,14 @@ namespace ModernKeePass.Views
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
private async void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var resource = new ResourcesService();
|
var resource = new ResourcesService();
|
||||||
var message = Model.IsRecycleOnDelete
|
var message = Model.IsRecycleOnDelete
|
||||||
? resource.GetResourceValue("EntryRecyclingConfirmation")
|
? resource.GetResourceValue("EntryRecyclingConfirmation")
|
||||||
: resource.GetResourceValue("EntryDeletingConfirmation");
|
: resource.GetResourceValue("EntryDeletingConfirmation");
|
||||||
var text = Model.IsRecycleOnDelete ? resource.GetResourceValue("EntryRecycled") : resource.GetResourceValue("EntryDeleted");
|
var text = Model.IsRecycleOnDelete ? resource.GetResourceValue("EntryRecycled") : resource.GetResourceValue("EntryDeleted");
|
||||||
MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
|
await MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
|
||||||
resource.GetResourceValue("EntityDeleteActionButton"),
|
resource.GetResourceValue("EntityDeleteActionButton"),
|
||||||
resource.GetResourceValue("EntityDeleteCancelButton"), a =>
|
resource.GetResourceValue("EntityDeleteCancelButton"), a =>
|
||||||
{
|
{
|
||||||
|
@@ -97,14 +97,14 @@ namespace ModernKeePass.Views
|
|||||||
Frame.Navigate(typeof(EntryDetailPage), entry);
|
Frame.Navigate(typeof(EntryDetailPage), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteButton_Click(object sender, RoutedEventArgs e)
|
private async void DeleteButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var resource = new ResourcesService();
|
var resource = new ResourcesService();
|
||||||
var message = Model.IsRecycleOnDelete
|
var message = Model.IsRecycleOnDelete
|
||||||
? resource.GetResourceValue("GroupRecyclingConfirmation")
|
? resource.GetResourceValue("GroupRecyclingConfirmation")
|
||||||
: resource.GetResourceValue("GroupDeletingConfirmation");
|
: resource.GetResourceValue("GroupDeletingConfirmation");
|
||||||
var text = Model.IsRecycleOnDelete ? resource.GetResourceValue("GroupRecycled") : resource.GetResourceValue("GroupDeleted");
|
var text = Model.IsRecycleOnDelete ? resource.GetResourceValue("GroupRecycled") : resource.GetResourceValue("GroupDeleted");
|
||||||
MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
|
await MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("EntityDeleteTitle"), message,
|
||||||
resource.GetResourceValue("EntityDeleteActionButton"),
|
resource.GetResourceValue("EntityDeleteActionButton"),
|
||||||
resource.GetResourceValue("EntityDeleteCancelButton"), a =>
|
resource.GetResourceValue("EntityDeleteCancelButton"), a =>
|
||||||
{
|
{
|
||||||
|
@@ -96,7 +96,7 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
var resource = new ResourcesService();
|
var resource = new ResourcesService();
|
||||||
if (database.IsOpen)
|
if (database.IsOpen)
|
||||||
{
|
{
|
||||||
MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("MessageDialogDBOpenTitle"),
|
await MessageDialogHelper.ShowActionDialog(resource.GetResourceValue("MessageDialogDBOpenTitle"),
|
||||||
string.Format(resource.GetResourceValue("MessageDialogDBOpenDesc"), database.Name),
|
string.Format(resource.GetResourceValue("MessageDialogDBOpenDesc"), database.Name),
|
||||||
resource.GetResourceValue("MessageDialogDBOpenButtonSave"),
|
resource.GetResourceValue("MessageDialogDBOpenButtonSave"),
|
||||||
resource.GetResourceValue("MessageDialogDBOpenButtonDiscard"),
|
resource.GetResourceValue("MessageDialogDBOpenButtonDiscard"),
|
||||||
|
Reference in New Issue
Block a user