Core refactoring (app doesn't work)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.Security.Credentials;
|
||||
|
||||
namespace FoxTube.Utils
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Terminates current application session
|
||||
/// </summary>
|
||||
public static void CloseApp() =>
|
||||
CoreApplication.Exit();
|
||||
|
||||
/// <summary>
|
||||
/// Restarts application
|
||||
/// </summary>
|
||||
public static void RestartApp() =>
|
||||
RestartApp(null);
|
||||
|
||||
/// <summary>
|
||||
/// Restarts application with specified parameters
|
||||
/// </summary>
|
||||
/// <param name="args">Parameters which will be provided to new application instance</param>
|
||||
public static async void RestartApp(string args) =>
|
||||
await CoreApplication.RequestRestartAsync(args ?? "");
|
||||
|
||||
public static void InitializeFailsafeProtocol()
|
||||
{
|
||||
Metrics.AddEvent("Failsafe protocol initiated");
|
||||
Settings.ResetSettings();
|
||||
PasswordVault passwordVault = new PasswordVault();
|
||||
foreach (PasswordCredential credential in passwordVault.RetrieveAll())
|
||||
passwordVault.Remove(credential);
|
||||
RestartApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user