Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Log export exception, re-design about page #2958

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3852,4 +3852,28 @@ Right-click for more options.</value>
<data name="OpenDocumentation" xml:space="preserve">
<value>Open documentation</value>
</data>
<data name="StarForkTheProjectOnGitHub" xml:space="preserve">
<value />
</data>
<data name="ToolTip_GitHubProjectUrl" xml:space="preserve">
<value />
</data>
<data name="ToolTip_TransifexProjectUrl" xml:space="preserve">
<value />
</data>
<data name="ToolTip_TwitterContactUrl" xml:space="preserve">
<value />
</data>
<data name="ReportAnIssueOrCreateAFeatureRequest" xml:space="preserve">
<value />
</data>
<data name="ToolTip_GithubNewIssueUrl" xml:space="preserve">
<value />
</data>
<data name="ToolTip_GithubDocumentationUrl" xml:space="preserve">
<value />
</data>
<data name="Donate" xml:space="preserve">
<value>Donate</value>
</data>
</root>
6 changes: 5 additions & 1 deletion Source/NETworkManager/ViewModels/ARPTableViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using log4net;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization.Resources;
Expand Down Expand Up @@ -69,7 +70,8 @@ public ARPTableViewModel(IDialogCoordinator instance)
#endregion

#region Variables

private static readonly ILog Log = LogManager.GetLogger(typeof(ARPTableViewModel));

private readonly IDialogCoordinator _dialogCoordinator;

private readonly bool _isLoading;
Expand Down Expand Up @@ -390,6 +392,8 @@ private async Task ExportAction()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand Down
20 changes: 12 additions & 8 deletions Source/NETworkManager/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Data;
using System.Windows.Input;
using NETworkManager.Documentation;
using NETworkManager.Documentation;
using NETworkManager.Localization.Resources;
using NETworkManager.Properties;
using NETworkManager.Settings;
using NETworkManager.Update;
using NETworkManager.Utilities;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Input;

namespace NETworkManager.ViewModels;

Expand All @@ -33,13 +34,16 @@ public AboutViewModel()

#region Methods

private void CheckForUpdates()
private async Task CheckForUpdatesAsync()
{
IsUpdateAvailable = false;
ShowUpdaterMessage = false;

IsUpdateCheckRunning = true;

// Show a loading animation for the user
await Task.Delay(1000);

var updater = new Updater();

updater.UpdateAvailable += Updater_UpdateAvailable;
Expand Down Expand Up @@ -208,7 +212,7 @@ public ResourceInfo SelectedResourceInfo

private void CheckForUpdatesAction()
{
CheckForUpdates();
CheckForUpdatesAsync();
}

public ICommand OpenWebsiteCommand => new RelayCommand(OpenWebsiteAction);
Expand Down
3 changes: 2 additions & 1 deletion Source/NETworkManager/ViewModels/BitCalculatorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace NETworkManager.ViewModels;
public class BitCalculatorViewModel : ViewModelBase
{
#region Variables

private readonly IDialogCoordinator _dialogCoordinator;

private static readonly ILog Log = LogManager.GetLogger(typeof(BitCalculatorViewModel));
Expand Down Expand Up @@ -185,6 +184,8 @@ private async Task ExportAction()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand Down
6 changes: 5 additions & 1 deletion Source/NETworkManager/ViewModels/ConnectionsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using log4net;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization;
Expand Down Expand Up @@ -93,7 +94,8 @@ private async void AutoRefreshTimer_Tick(object sender, EventArgs e)
#endregion

#region Variables

private static readonly ILog Log = LogManager.GetLogger(typeof(ConnectionsViewModel));

private readonly IDialogCoordinator _dialogCoordinator;

private readonly bool _isLoading;
Expand Down Expand Up @@ -307,6 +309,8 @@ private async Task ExportAction()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand Down
9 changes: 6 additions & 3 deletions Source/NETworkManager/ViewModels/DNSLookupViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Windows.Input;
using System.Windows.Threading;
using DnsClient;
using log4net;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Controls;
Expand All @@ -25,6 +26,7 @@ namespace NETworkManager.ViewModels;
public class DNSLookupViewModel : ViewModelBase
{
#region Variables
private static readonly ILog Log = LogManager.GetLogger(typeof(DNSLookupViewModel));

private readonly IDialogCoordinator _dialogCoordinator;

Expand Down Expand Up @@ -387,6 +389,8 @@ private async Task Export()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand All @@ -398,10 +402,9 @@ await _dialogCoordinator.ShowMessageAsync(window, Strings.Error,
SettingsManager.Current.DNSLookup_ExportFileType = instance.FileType;
SettingsManager.Current.DNSLookup_ExportFilePath = instance.FilePath;
}, _ => { _dialogCoordinator.HideMetroDialogAsync(window, customDialog); },
new[]
{
[
ExportFileType.Csv, ExportFileType.Xml, ExportFileType.Json
}, true,
], true,
SettingsManager.Current.DNSLookup_ExportFileType, SettingsManager.Current.DNSLookup_ExportFilePath);

customDialog.Content = new ExportDialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using log4net;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Localization.Resources;
using NETworkManager.Models.Export;
Expand All @@ -19,6 +20,7 @@ namespace NETworkManager.ViewModels;
public class DiscoveryProtocolViewModel : ViewModelBase
{
#region Variables
private static readonly ILog Log = LogManager.GetLogger(typeof(DiscoveryProtocolViewModel));

private readonly IDialogCoordinator _dialogCoordinator;

Expand Down Expand Up @@ -281,6 +283,8 @@ private async Task CaptureAction()
}
catch (Exception ex)
{
Log.Error("Error while trying to capture", ex);

await _dialogCoordinator.ShowMessageAsync(this, Strings.Error, ex.Message,
MessageDialogStyle.Affirmative, AppearanceManager.MetroDialog);
}
Expand All @@ -306,6 +310,8 @@ private async Task ExportAction()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand All @@ -316,7 +322,8 @@ await _dialogCoordinator.ShowMessageAsync(this, Strings.Error,

SettingsManager.Current.DiscoveryProtocol_ExportFileType = instance.FileType;
SettingsManager.Current.DiscoveryProtocol_ExportFilePath = instance.FilePath;
}, _ => { _dialogCoordinator.HideMetroDialogAsync(this, customDialog); }, [
}, _ => { _dialogCoordinator.HideMetroDialogAsync(this, customDialog); },
[
ExportFileType.Csv, ExportFileType.Xml, ExportFileType.Json
], false, SettingsManager.Current.DiscoveryProtocol_ExportFileType,
SettingsManager.Current.DiscoveryProtocol_ExportFilePath);
Expand Down
2 changes: 2 additions & 0 deletions Source/NETworkManager/ViewModels/IPGeolocationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ private async Task Export()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand Down
10 changes: 8 additions & 2 deletions Source/NETworkManager/ViewModels/IPScannerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using log4net;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using NETworkManager.Controls;
Expand All @@ -32,11 +33,12 @@ namespace NETworkManager.ViewModels;
public class IPScannerViewModel : ViewModelBase, IProfileManagerMinimal
{
#region Variables

private static readonly ILog Log = LogManager.GetLogger(typeof(IPScannerViewModel));

private readonly IDialogCoordinator _dialogCoordinator;

private CancellationTokenSource _cancellationTokenSource;

private readonly Guid _tabId;
private bool _firstLoad = true;
private bool _closed;
Expand Down Expand Up @@ -510,6 +512,8 @@ private async Task CustomCommand(object guid)
}
catch (Exception ex)
{
Log.Error("Error trying to run custom command", ex);

await _dialogCoordinator.ShowMessageAsync(this,
Strings.ResourceManager.GetString("Error",
LocalizationManager.GetInstance().Culture), ex.Message, MessageDialogStyle.Affirmative,
Expand Down Expand Up @@ -555,6 +559,8 @@ private Task Export()
}
catch (Exception ex)
{
Log.Error("Error while exporting data as " + instance.FileType, ex);

var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Strings.OK;

Expand Down
Loading
Loading