Skip to content

Commit 35444de

Browse files
authored
Fix #444, Fix #446 (#448)
Co-authored-by: BornToBeRoot <[email protected]>
1 parent c5355e0 commit 35444de

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,23 +257,24 @@ public ICollectionView ProfileFiles
257257
}
258258
}
259259

260-
private ProfileFileInfo _selectedProfileFile;
260+
private ProfileFileInfo _selectedProfileFile = null;
261261
public ProfileFileInfo SelectedProfileFile
262262
{
263263
get => _selectedProfileFile;
264264
set
265265
{
266-
if (value == _selectedProfileFile || (value != null && value.Equals(_selectedProfileFile)))
266+
if (_isProfileLoading || (value != null && value.Equals(_selectedProfileFile)))
267267
return;
268268

269269
_selectedProfileFile = value;
270270

271-
if (!_isProfileLoading && value != null && !value.Equals(ProfileManager.LoadedProfileFile))
271+
// Switch profile...
272+
if (value != null && !value.Equals(ProfileManager.LoadedProfileFile))
272273
{
273274
ProfileManager.SwitchProfile(value);
274275
SettingsManager.Current.Profiles_LastSelected = value.Name;
275276
}
276-
277+
277278
OnPropertyChanged();
278279
}
279280
}
@@ -368,19 +369,16 @@ private void AfterContentRendered()
368369

369370
// Load profiles
370371
_isProfileLoading = true;
371-
372372
ProfileFiles = new CollectionViewSource { Source = ProfileManager.ProfileFiles }.View;
373373
ProfileFiles.SortDescriptions.Add(new SortDescription(nameof(ProfileFileInfo.Name), ListSortDirection.Ascending));
374374
ProfileManager.OnProfileFileChangedEvent += ProfileManager_OnProfileFileChangedEvent;
375-
376375
_isProfileLoading = false;
377376

377+
// Switch profile
378378
SelectedProfileFile = ProfileFiles.SourceCollection.Cast<ProfileFileInfo>().FirstOrDefault(x => x.Name == SettingsManager.Current.Profiles_LastSelected);
379379

380-
/*
381380
if (SelectedProfileFile == null)
382381
SelectedProfileFile = ProfileFiles.SourceCollection.Cast<ProfileFileInfo>().FirstOrDefault();
383-
*/
384382

385383
// Hide to tray after the window shows up... not nice, but otherwise the hotkeys do not work
386384
if (CommandLineManager.Current.Autostart && SettingsManager.Current.Autostart_StartMinimizedInTray)

0 commit comments

Comments
 (0)