Skip to content

Commit 1c80af3

Browse files
committed
Merge branch 'master' into contmenu_empty_space
2 parents 1b2d00a + 55850d3 commit 1c80af3

File tree

79 files changed

+2721
-1592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2721
-1592
lines changed

Files.Launcher/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static async void InitializeAppServiceConnection()
153153
if (status != AppServiceConnectionStatus.Success)
154154
{
155155
// TODO: error handling
156-
connection.Dispose();
156+
connection?.Dispose();
157157
connection = null;
158158
}
159159
}

Files.Package/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
1010
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
1111
IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
12-
<Identity Name="FilesDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.19.0.0" />
12+
<Identity Name="FilesDev" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.19.2.0" />
1313
<Properties>
1414
<DisplayName>Files - Dev</DisplayName>
1515
<PublisherDisplayName>Yair A</PublisherDisplayName>

Files/App.xaml.cs

Lines changed: 3 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,8 @@ namespace Files
3939
{
4040
sealed partial class App : Application
4141
{
42-
public static IMultitaskingControl MultitaskingControl = null;
43-
44-
private static IShellPage currentInstance;
4542
private static bool ShowErrorNotification = false;
4643

47-
public static IShellPage CurrentInstance
48-
{
49-
get
50-
{
51-
return currentInstance;
52-
}
53-
set
54-
{
55-
if (value != currentInstance && value != null)
56-
{
57-
currentInstance = value;
58-
}
59-
}
60-
}
61-
6244
public static SettingsViewModel AppSettings { get; set; }
6345
public static InteractionViewModel InteractionViewModel { get; set; }
6446
public static JumpListManager JumpList { get; } = new JumpListManager();
@@ -73,6 +55,7 @@ public App()
7355
InitializeComponent();
7456
Suspending += OnSuspending;
7557
LeavingBackground += OnLeavingBackground;
58+
7659
// Initialize NLog
7760
StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
7861
LogManager.Configuration.Variables["LogPath"] = storageFolder.Path;
@@ -99,92 +82,9 @@ private async void StartAppCenter()
9982

10083
private void OnLeavingBackground(object sender, LeavingBackgroundEventArgs e)
10184
{
102-
// Need to reinitialize AppService when app is resuming
103-
InitializeAppServiceConnection();
10485
AppSettings?.DrivesManager?.ResumeDeviceWatcher();
10586
}
10687

107-
public static AppServiceConnection Connection;
108-
109-
private async void InitializeAppServiceConnection()
110-
{
111-
Connection = new AppServiceConnection();
112-
Connection.AppServiceName = "FilesInteropService";
113-
Connection.PackageFamilyName = Package.Current.Id.FamilyName;
114-
Connection.RequestReceived += Connection_RequestReceived;
115-
Connection.ServiceClosed += Connection_ServiceClosed;
116-
117-
AppServiceConnectionStatus status = await Connection.OpenAsync();
118-
if (status != AppServiceConnectionStatus.Success)
119-
{
120-
// TODO: error handling
121-
Connection.Dispose();
122-
Connection = null;
123-
}
124-
125-
// Launch fulltrust process
126-
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
127-
}
128-
129-
private void Connection_ServiceClosed(AppServiceConnection sender, AppServiceClosedEventArgs args)
130-
{
131-
Connection = null;
132-
}
133-
134-
private async void Connection_RequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
135-
{
136-
// Get a deferral because we use an awaitable API below to respond to the message
137-
// and we don't want this call to get cancelled while we are waiting.
138-
var messageDeferral = args.GetDeferral();
139-
140-
// The fulltrust process signaled that something in the recycle bin folder has changed
141-
if (args.Request.Message.ContainsKey("FileSystem"))
142-
{
143-
var folderPath = (string)args.Request.Message["FileSystem"];
144-
var itemPath = (string)args.Request.Message["Path"];
145-
var changeType = (string)args.Request.Message["Type"];
146-
var newItem = JsonConvert.DeserializeObject<ShellFileItem>(args.Request.Message.Get("Item", ""));
147-
Debug.WriteLine("{0}: {1}", folderPath, changeType);
148-
await CoreApplication.MainView.ExecuteOnUIThreadAsync(async () =>
149-
{
150-
// If we are currently displaying the reycle bin lets refresh the items
151-
if (CurrentInstance.FilesystemViewModel?.CurrentFolder?.ItemPath == folderPath)
152-
{
153-
switch (changeType)
154-
{
155-
case "Created":
156-
CurrentInstance.FilesystemViewModel.AddFileOrFolderFromShellFile(newItem);
157-
break;
158-
159-
case "Deleted":
160-
await CurrentInstance.FilesystemViewModel.RemoveFileOrFolder(itemPath);
161-
break;
162-
163-
default:
164-
CurrentInstance.FilesystemViewModel.RefreshItems();
165-
break;
166-
}
167-
}
168-
});
169-
}
170-
171-
// Complete the deferral so that the platform knows that we're done responding to the app service call.
172-
// Note for error handling: this must be called even if SendResponseAsync() throws an exception.
173-
messageDeferral.Complete();
174-
}
175-
176-
private void CoreWindow_PointerPressed(CoreWindow sender, PointerEventArgs args)
177-
{
178-
if (args.CurrentPoint.Properties.IsXButton1Pressed)
179-
{
180-
NavigationActions.Back_Click(null, null);
181-
}
182-
else if (args.CurrentPoint.Properties.IsXButton2Pressed)
183-
{
184-
NavigationActions.Forward_Click(null, null);
185-
}
186-
}
187-
18888
public static INavigationControlItem rightClickedItem;
18989

19090
public static void UnpinItem_Click(object sender, RoutedEventArgs e)
@@ -256,10 +156,7 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)
256156

257157
// Ensure the current window is active
258158
Window.Current.Activate();
259-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
260159
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
261-
var currentView = SystemNavigationManager.GetForCurrentView();
262-
currentView.BackRequested += Window_BackRequested;
263160
}
264161
}
265162

@@ -273,19 +170,6 @@ private void CoreWindow_Activated(CoreWindow sender, WindowActivatedEventArgs ar
273170
}
274171
}
275172

276-
private void Window_BackRequested(object sender, BackRequestedEventArgs e)
277-
{
278-
if (CurrentInstance.ContentFrame.CanGoBack)
279-
{
280-
e.Handled = true;
281-
NavigationActions.Back_Click(null, null);
282-
}
283-
else
284-
{
285-
e.Handled = false;
286-
}
287-
}
288-
289173
protected override async void OnActivated(IActivatedEventArgs args)
290174
{
291175
Logger.Info("App activated");
@@ -316,9 +200,7 @@ protected override async void OnActivated(IActivatedEventArgs args)
316200

317201
// Ensure the current window is active.
318202
Window.Current.Activate();
319-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
320203
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
321-
currentView.BackRequested += Window_BackRequested;
322204
return;
323205

324206
case ActivationKind.CommandLineLaunch:
@@ -340,9 +222,7 @@ protected override async void OnActivated(IActivatedEventArgs args)
340222

341223
// Ensure the current window is active.
342224
Window.Current.Activate();
343-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
344225
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
345-
currentView.BackRequested += Window_BackRequested;
346226
return;
347227

348228
case ParsedCommandType.OpenPath:
@@ -355,9 +235,7 @@ protected override async void OnActivated(IActivatedEventArgs args)
355235

356236
// Ensure the current window is active.
357237
Window.Current.Activate();
358-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
359238
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
360-
currentView.BackRequested += Window_BackRequested;
361239

362240
return;
363241
}
@@ -377,9 +255,8 @@ protected override async void OnActivated(IActivatedEventArgs args)
377255
rootFrame.Navigate(typeof(MainPage), null, new SuppressNavigationTransitionInfo());
378256
// Ensure the current window is active.
379257
Window.Current.Activate();
380-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
381258
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
382-
currentView.BackRequested += Window_BackRequested;
259+
383260
return;
384261
}
385262
}
@@ -401,7 +278,6 @@ protected override async void OnActivated(IActivatedEventArgs args)
401278

402279
// Ensure the current window is active.
403280
Window.Current.Activate();
404-
Window.Current.CoreWindow.PointerPressed += CoreWindow_PointerPressed;
405281
Window.Current.CoreWindow.Activated += CoreWindow_Activated;
406282
}
407283

@@ -433,11 +309,7 @@ private void OnSuspending(object sender, SuspendingEventArgs e)
433309

434310
var deferral = e.SuspendingOperation.GetDeferral();
435311
//TODO: Save application state and stop any background activity
436-
if (Connection != null)
437-
{
438-
Connection.Dispose();
439-
Connection = null;
440-
}
312+
441313
AppSettings?.Dispose();
442314
deferral.Complete();
443315
}

0 commit comments

Comments
 (0)