public async void ResetSettingsAction() { MetroDialogSettings settings = AppearanceManager.MetroDialog; settings.AffirmativeButtonText = Application.Current.Resources["String_Button_Continue"] as string; settings.NegativeButtonText = Application.Current.Resources["String_Button_Cancel"] as string; settings.DefaultButtonFocus = MessageDialogResult.Affirmative; string message = Application.Current.Resources["String_SelectedSettingsAreReset"] as string; if (ResetEverything || ResetApplicationSettings) { message += Environment.NewLine + Environment.NewLine + string.Format("* {0}", Application.Current.Resources["String_TheSettingsLocationIsNotAffected"] as string); message += Environment.NewLine + string.Format("* {0}", Application.Current.Resources["String_ApplicationIsRestartedAfterwards"] as string); } if (await dialogCoordinator.ShowMessageAsync(this, Application.Current.Resources["String_Header_AreYouSure"] as string, message, MessageDialogStyle.AffirmativeAndNegative, settings) != MessageDialogResult.Affirmative) { return; } bool forceRestart = false; if (ApplicationSettingsExists && (ResetEverything || ResetApplicationSettings)) { SettingsManager.Reset(); forceRestart = true; } if (NetworkInterfaceProfilesExists && (ResetEverything || ResetNetworkInterfaceProfiles)) { NetworkInterfaceProfileManager.Reset(); } if (WakeOnLANClientsExists && (ResetEverything || ResetWakeOnLANClients)) { WakeOnLANClientManager.Reset(); } // Restart after reset or show a completed message if (forceRestart) { CloseAction(); } else { settings.AffirmativeButtonText = Application.Current.Resources["String_Button_OK"] as string; await dialogCoordinator.ShowMessageAsync(this, Application.Current.Resources["String_Header_Success"] as string, Application.Current.Resources["String_SettingsSuccessfullyReset"] as string, MessageDialogStyle.Affirmative, settings); } }
public async void ResetSettingsAction() { MetroDialogSettings settings = AppearanceManager.MetroDialog; settings.AffirmativeButtonText = LocalizationManager.GetStringByKey("String_Button_Continue"); settings.NegativeButtonText = LocalizationManager.GetStringByKey("String_Button_Cancel"); settings.DefaultButtonFocus = MessageDialogResult.Affirmative; string message = LocalizationManager.GetStringByKey("String_SelectedSettingsAreReset"); if (ResetEverything || ResetApplicationSettings) { message += Environment.NewLine + Environment.NewLine + string.Format("* {0}", LocalizationManager.GetStringByKey("String_TheSettingsLocationIsNotAffected")); message += Environment.NewLine + string.Format("* {0}", LocalizationManager.GetStringByKey("String_ApplicationIsRestartedAfterwards")); } if (await dialogCoordinator.ShowMessageAsync(this, LocalizationManager.GetStringByKey("String_Header_AreYouSure"), message, MessageDialogStyle.AffirmativeAndNegative, settings) != MessageDialogResult.Affirmative) { return; } bool forceRestart = false; if (ApplicationSettingsExists && (ResetEverything || ResetApplicationSettings)) { SettingsManager.Reset(); forceRestart = true; } if (NetworkInterfaceProfilesExists && (ResetEverything || ResetNetworkInterfaceProfiles)) { NetworkInterfaceProfileManager.Reset(); } if (IPScannerProfilesExists && (ResetEverything || ResetIPScannerProfiles)) { IPScannerProfileManager.Reset(); } if (PortScannerProfilesExists && (ResetEverything || ResetPortScannerProfiles)) { PortScannerProfileManager.Reset(); } if (PingProfilesExists && (ResetEverything || ResetPingProfiles)) { PingProfileManager.Reset(); } if (TracerouteProfilesExists && (ResetEverything || ResetTracerouteProfiles)) { TracerouteProfileManager.Reset(); } if (RemoteDesktopSessionsExists && (ResetEverything || ResetRemoteDesktopSessions)) { RemoteDesktopSessionManager.Reset(); } if (PuTTYSessionsExists && (ResetEverything || ResetPuTTYSessions)) { PuTTYSessionManager.Reset(); } if (WakeOnLANClientsExists && (ResetEverything || ResetWakeOnLANClients)) { WakeOnLANClientManager.Reset(); } // Restart after reset or show a completed message if (forceRestart) { CloseAction(); } else { settings.AffirmativeButtonText = LocalizationManager.GetStringByKey("String_Button_OK"); await dialogCoordinator.ShowMessageAsync(this, LocalizationManager.GetStringByKey("String_Header_Success"), LocalizationManager.GetStringByKey("String_SettingsSuccessfullyReset"), MessageDialogStyle.Affirmative, settings); } }