Skip to content

Commit

Permalink
Issue/270 (#461)
Browse files Browse the repository at this point in the history
* Prevent app crash if profile is corrupted

* Update 04_Changelog.md

Co-authored-by: BornToBeRoot <[email protected]>
  • Loading branch information
BornToBeRoot and BornToBeRoot committed Feb 6, 2021
1 parent 477b33d commit a7de585
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
18 changes: 18 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.

6 changes: 6 additions & 0 deletions Source/NETworkManager.Localization/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2919,4 +2919,10 @@ $$hostname$$ --&gt; Hostname</value>
<data name="SSID" xml:space="preserve">
<value>SSID</value>
</data>
<data name="ProfileCouldNotBeLoaded" xml:space="preserve">
<value>Profile could not be loaded!</value>
</data>
<data name="ProfileCouldNotBeLoadedAndMayBeCorruptedMessage" xml:space="preserve">
<value>The profile could not be loaded and may be corrupted. If this is unexpected or due to an update, please report this issue on GitHub!</value>
</data>
</root>
2 changes: 0 additions & 2 deletions Source/NETworkManager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using System.Windows.Threading;
using NETworkManager.Profiles;
using NETworkManager.Localization;
using ABI.Windows.Devices.AllJoyn;
using System.Threading.Tasks;

namespace NETworkManager
{
Expand Down
23 changes: 21 additions & 2 deletions Source/NETworkManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,15 @@ public ProfileFileInfo SelectedProfileFile
// Switch profile...
if (value != null && !value.Equals(ProfileManager.LoadedProfileFile))
{
ProfileManager.SwitchProfile(value);
SwitchProfile(value);
SettingsManager.Current.Profiles_LastSelected = value.Name;
}

OnPropertyChanged();
}
}
#endregion

#region Constructor, window load and close events
public MainWindow()
{
Expand Down Expand Up @@ -1259,6 +1259,25 @@ private void ClearSearchAction()
#endregion

#region Methods
private async void SwitchProfile(ProfileFileInfo info)
{
try
{
ProfileManager.SwitchProfile(info);
}
catch
{
var settings = AppearanceManager.MetroDialog;
settings.AffirmativeButtonText = Localization.Resources.Strings.OK;

ConfigurationManager.Current.FixAirspace = true;

await this.ShowMessageAsync(Localization.Resources.Strings.ProfileCouldNotBeLoaded, Localization.Resources.Strings.ProfileCouldNotBeLoadedAndMayBeCorruptedMessage, MessageDialogStyle.Affirmative, settings);

ConfigurationManager.Current.FixAirspace = false;
}
}

private void OpenStatusWindow()
{
statusWindow.ShowFromExternal();
Expand Down
1 change: 1 addition & 0 deletions docs/04_Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Date: **xx.xx.2021**


## Bugfixes
- Prevent app crash if profile is corrupted [#270](https://github.com/BornToBeRoot/NETworkManager/issues/270)
- Wrong flags `sl-SI` and `zh-TW` fixed [#438](https://github.com/BornToBeRoot/NETworkManager/issues/438)
- Update link color fixed

Expand Down

0 comments on commit a7de585

Please sign in to comment.