Skip to content

Commit

Permalink
Fix using to use C# 7.3 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lostindark committed Sep 21, 2020
1 parent ea8878d commit 9ad4870
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions Rapr/DSEForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,39 +926,37 @@ private void ShowStatus(Status status, string text, string detail = null, bool u
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "<Pending>")]
private async void ExportAllDriversToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new CommonOpenFileDialog
using (var dialog = new CommonOpenFileDialog { IsFolderPicker = true })
{
IsFolderPicker = true
};

CommonFileDialogResult dialogResult = dialog.ShowDialog();
CommonFileDialogResult dialogResult = dialog.ShowDialog();

if (dialogResult == CommonFileDialogResult.Ok)
{
try
if (dialogResult == CommonFileDialogResult.Ok)
{
this.StartOperation();
this.ShowStatus(Status.Normal, Language.Status_Exporting_All_Drivers);
try
{
this.StartOperation();
this.ShowStatus(Status.Normal, Language.Status_Exporting_All_Drivers);

bool result = await Task.Run(() => this.driverStore.ExportAllDrivers(dialog.FileName)).ConfigureAwait(true);
bool result = await Task.Run(() => this.driverStore.ExportAllDrivers(dialog.FileName)).ConfigureAwait(true);

if (result)
if (result)
{
this.ShowStatus(Status.Success, Language.Message_Export_All_Drivers_Success);
}
else
{
this.ShowStatus(Status.Error, Language.Message_Export_All_Drivers_Fail, usePopup: true);
}
}
catch (Exception ex)
{
this.ShowStatus(Status.Success, Language.Message_Export_All_Drivers_Success);
this.ShowStatus(Status.Error, ex.Message, ex.ToString(), true);
}
else
finally
{
this.ShowStatus(Status.Error, Language.Message_Export_All_Drivers_Fail, usePopup: true);
this.EndOperation();
}
}
catch (Exception ex)
{
this.ShowStatus(Status.Error, ex.Message, ex.ToString(), true);
}
finally
{
this.EndOperation();
}
}
}
}
Expand Down

0 comments on commit 9ad4870

Please sign in to comment.