diff --git a/src/Files.App/UserControls/RestartControl.xaml b/src/Files.App/UserControls/RestartControl.xaml
deleted file mode 100644
index 231276f210d3..000000000000
--- a/src/Files.App/UserControls/RestartControl.xaml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Files.App/UserControls/RestartControl.xaml.cs b/src/Files.App/UserControls/RestartControl.xaml.cs
deleted file mode 100644
index e3b0e72f9f3e..000000000000
--- a/src/Files.App/UserControls/RestartControl.xaml.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2023 Files Community
-// Licensed under the MIT License. See the LICENSE.
-
-using CommunityToolkit.Mvvm.DependencyInjection;
-using Files.Backend.Services.Settings;
-using Microsoft.UI.Xaml;
-using Microsoft.UI.Xaml.Controls;
-using System;
-using System.Diagnostics;
-using Windows.System;
-
-namespace Files.App.UserControls
-{
- public sealed partial class RestartControl : UserControl
- {
- public IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetRequiredService();
-
- public RestartControl()
- {
- InitializeComponent();
- }
-
- public static readonly DependencyProperty ShowDialogProperty = DependencyProperty.Register(
- "ShowDialog", typeof(bool), typeof(RestartControl), new PropertyMetadata(false, new PropertyChangedCallback(OnShowDialogPropertyChanged)));
- public bool ShowDialog
- {
- get => (bool)GetValue(dp: ShowDialogProperty);
- set => SetValue(ShowDialogProperty, value);
- }
-
- private static void OnShowDialogPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
- {
- var dialog = (RestartControl)sender;
- if ((bool)e.NewValue)
- {
- dialog.RestartNotification.Show(10000);
- }
- else
- {
- dialog.RestartNotification.Dismiss();
- }
- }
-
- public void Show()
- {
- RestartNotification.Show(10000);
- }
-
- public void Dismiss()
- {
- RestartNotification.Dismiss();
- }
-
- private async void YesButton_Click(object sender, RoutedEventArgs e)
- {
- UserSettingsService.AppSettingsService.RestoreTabsOnStartup = true; // Tells the app to restore tabs when it's next launched
- App.SaveSessionTabs(); // Saves the open tabs
- await Launcher.LaunchUriAsync(new Uri("files-uwp:")); // Launches a new instance of Files
- Process.GetCurrentProcess().Kill(); // Closes the current instance
- }
-
- private void NoButton_Click(object sender, RoutedEventArgs e)
- {
- RestartNotification.Dismiss();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Files.App/ViewModels/Settings/GeneralViewModel.cs b/src/Files.App/ViewModels/Settings/GeneralViewModel.cs
index bbb187b8030e..cd35af59e09a 100644
--- a/src/Files.App/ViewModels/Settings/GeneralViewModel.cs
+++ b/src/Files.App/ViewModels/Settings/GeneralViewModel.cs
@@ -9,6 +9,7 @@
using Windows.Globalization;
using Windows.Storage;
using Windows.Storage.Pickers;
+using Windows.System;
using static Files.App.Helpers.MenuFlyoutHelper;
using DispatcherQueue = Microsoft.UI.Dispatching.DispatcherQueue;
@@ -26,6 +27,8 @@ public class GeneralViewModel : ObservableObject, IDisposable
public AsyncRelayCommand ChangePageCommand { get; }
public RelayCommand RemovePageCommand { get; }
public RelayCommand AddPageCommand { get; }
+ public RelayCommand RestartCommand { get; }
+ public RelayCommand CancelRestartCommand { get; }
private bool showRestartControl;
public bool ShowRestartControl
@@ -94,6 +97,8 @@ public GeneralViewModel()
ChangePageCommand = new AsyncRelayCommand(ChangePage);
RemovePageCommand = new RelayCommand(RemovePage);
AddPageCommand = new RelayCommand(async (path) => await AddPage(path));
+ RestartCommand = new RelayCommand(DoRestart);
+ CancelRestartCommand = new RelayCommand(DoCancelRestart);
AddSupportedAppLanguages();
@@ -113,6 +118,19 @@ public GeneralViewModel()
_ = DetectOpenFilesAtStartup();
}
+ private async void DoRestart()
+ {
+ UserSettingsService.AppSettingsService.RestoreTabsOnStartup = true; // Tells the app to restore tabs when it's next launched
+ App.SaveSessionTabs(); // Saves the open tabs
+ await Launcher.LaunchUriAsync(new Uri("files-uwp:")); // Launches a new instance of Files
+ Process.GetCurrentProcess().Kill(); // Closes the current instance
+ }
+
+ private void DoCancelRestart()
+ {
+ ShowRestartControl = false;
+ }
+
private void AddDateTimeOptions()
{
DateTimeOffset sampleDate1 = DateTime.Now.AddSeconds(-5);
diff --git a/src/Files.App/Views/Settings/GeneralPage.xaml b/src/Files.App/Views/Settings/GeneralPage.xaml
index 3a4058ac32c9..cb29b2e597c6 100644
--- a/src/Files.App/Views/Settings/GeneralPage.xaml
+++ b/src/Files.App/Views/Settings/GeneralPage.xaml
@@ -45,6 +45,7 @@
+
+
+
+
+
+
+
+
-
-