diff --git a/Files/Views/ColumnShellPage.xaml.cs b/Files/Views/ColumnShellPage.xaml.cs index 1168e971e5d8..8d28b26373b0 100644 --- a/Files/Views/ColumnShellPage.xaml.cs +++ b/Files/Views/ColumnShellPage.xaml.cs @@ -1,6 +1,7 @@ using Files.Common; using Files.Dialogs; using Files.EventArguments; +using Files.Extensions; using Files.Filesystem; using Files.Filesystem.FilesystemHistory; using Files.Filesystem.Search; diff --git a/Files/Views/ModernShellPage.xaml.cs b/Files/Views/ModernShellPage.xaml.cs index 8d489702d7e3..f6f0955690f0 100644 --- a/Files/Views/ModernShellPage.xaml.cs +++ b/Files/Views/ModernShellPage.xaml.cs @@ -2,6 +2,7 @@ using Files.DataModels; using Files.Dialogs; using Files.EventArguments; +using Files.Extensions; using Files.Filesystem; using Files.Filesystem.FilesystemHistory; using Files.Filesystem.Search; diff --git a/Files/Views/WidgetsPage.xaml.cs b/Files/Views/WidgetsPage.xaml.cs index 446b47cb6ead..3983689de2ab 100644 --- a/Files/Views/WidgetsPage.xaml.cs +++ b/Files/Views/WidgetsPage.xaml.cs @@ -18,9 +18,7 @@ namespace Files.Views public sealed partial class WidgetsPage : Page, IDisposable { private IShellPage AppInstance = null; - public SettingsViewModel AppSettings => App.AppSettings; public FolderSettingsViewModel FolderSettings => AppInstance?.InstanceViewModel.FolderSettings; - public NamedPipeAsAppServiceConnection Connection => AppInstance?.ServiceConnection; private LibraryCards libraryCards; private DrivesWidget drivesWidget; @@ -42,6 +40,13 @@ public WidgetsPage() Widgets.ViewModel.WidgetListRefreshRequestedInvoked += ViewModel_WidgetListRefreshRequestedInvoked; } + protected override void OnNavigatedFrom(NavigationEventArgs e) + { + this.Dispose(); + + base.OnNavigatedFrom(e); + } + public void RefreshWidgetList() => Widgets.ViewModel.RefreshWidgetList(); private void ViewModel_WidgetListRefreshRequestedInvoked(object sender, EventArgs e) @@ -135,7 +140,7 @@ private async void RecentFilesWidget_RecentFileInvoked(object sender, UserContro } else { - foreach (DriveItem drive in Enumerable.Concat(App.DrivesManager.Drives, AppSettings.CloudDrivesManager.Drives)) + foreach (DriveItem drive in Enumerable.Concat(App.DrivesManager.Drives, App.AppSettings.CloudDrivesManager.Drives)) { if (drive.Path.ToString() == new DirectoryInfo(e.ItemPath).Root.ToString()) { @@ -236,8 +241,6 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs) #region IDisposable - // TODO: This Dispose() is never called, please implement the functionality to call this function. - // This IDisposable.Dispose() needs to be called to unhook events in BundlesWidget to avoid memory leaks. public void Dispose() { ViewModel.YourHomeLoadedInvoked -= ViewModel_YourHomeLoadedInvoked;