Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Files/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.AppService;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Metadata;
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Notifications;
Expand Down Expand Up @@ -71,8 +73,8 @@ public App()
Suspending += OnSuspending;
LeavingBackground += OnLeavingBackground;
// Initialize NLog
Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
NLog.LogManager.Configuration.Variables["LogPath"] = storageFolder.Path;
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
LogManager.Configuration.Variables["LogPath"] = storageFolder.Path;

StartAppCenter();
}
Expand All @@ -86,7 +88,7 @@ private async void StartAppCenter()
var lines = await FileIO.ReadTextAsync(file);
obj = JObject.Parse(lines);
}
catch (Exception e)
catch
{
return;
}
Expand Down Expand Up @@ -142,7 +144,7 @@ private async void Connection_RequestReceived(AppServiceConnection sender, AppSe
var changeType = (string)args.Request.Message["Type"];
var newItem = JsonConvert.DeserializeObject<ShellFileItem>(args.Request.Message.Get("Item", ""));
Debug.WriteLine("{0}: {1}", folderPath, changeType);
await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
// If we are currently displaying the reycle bin lets refresh the items
if (CurrentInstance.FilesystemViewModel?.CurrentFolder?.ItemPath == folderPath)
Expand Down Expand Up @@ -186,7 +188,7 @@ private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs args)

public static void UnpinItem_Click(object sender, RoutedEventArgs e)
{
if (rightClickedItem.Path.Equals(App.AppSettings.RecycleBinPath, StringComparison.OrdinalIgnoreCase))
if (rightClickedItem.Path.Equals(AppSettings.RecycleBinPath, StringComparison.OrdinalIgnoreCase))
{
AppSettings.PinRecycleBinToSideBar = false;
}
Expand All @@ -212,7 +214,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)

Logger.Info("App launched");

bool canEnablePrelaunch = Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch");
bool canEnablePrelaunch = ApiInformation.IsMethodPresent("Windows.ApplicationModel.Core.CoreApplication", "EnablePrelaunch");

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
Expand Down Expand Up @@ -272,7 +274,7 @@ private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs ar

private void Window_BackRequested(object sender, BackRequestedEventArgs e)
{
if (App.CurrentInstance.ContentFrame.CanGoBack)
if (CurrentInstance.ContentFrame.CanGoBack)
{
e.Handled = true;
NavigationActions.Back_Click(null, null);
Expand Down Expand Up @@ -404,7 +406,7 @@ protected override async void OnActivated(IActivatedEventArgs args)

private void TryEnablePrelaunch()
{
Windows.ApplicationModel.Core.CoreApplication.EnablePrelaunch(true);
CoreApplication.EnablePrelaunch(true);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion Files/Helpers/JumpListManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async void AddFolderToJumpList(string path)

private Task AddFolder(string path)
{
if (!JumpListItemPaths.Contains(path) && _instance != null)
if (_instance != null && !JumpListItemPaths.Contains(path))
{
string displayName;
if (path.Equals(App.AppSettings.DesktopPath, StringComparison.OrdinalIgnoreCase))
Expand Down
6 changes: 4 additions & 2 deletions Files/View Models/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ public async Task SetWorkingDirectory(string value)
return;
}

App.JumpList.AddFolderToJumpList(value);

INavigationControlItem item = null;
List<INavigationControlItem> sidebarItems = MainPage.sideBarItems.Where(x => !string.IsNullOrWhiteSpace(x.Path)).ToList();

Expand Down Expand Up @@ -120,6 +118,10 @@ public async Task SetWorkingDirectory(string value)
{
_currentStorageFolder = null;
}
else
{
App.JumpList.AddFolderToJumpList(value);
}

NotifyPropertyChanged(nameof(WorkingDirectory));
}
Expand Down