Skip to content

Commit 2cc8c13

Browse files
author
Yair Aichenbaum
committed
Improved ProHome code
1 parent 958ad2d commit 2cc8c13

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

Files/Interacts/Interaction.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,24 @@ private async void OpenSelectedItems(bool displayApplicationPicker)
426426
}
427427
}
428428

429+
public void CloseTab()
430+
{
431+
if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count == 1)
432+
{
433+
Application.Current.Exit();
434+
}
435+
else if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count > 1)
436+
{
437+
((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.RemoveAt(((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.SelectedIndex);
438+
}
439+
}
440+
441+
public async void LaunchNewWindow()
442+
{
443+
var filesUWPUri = new Uri("files-uwp:");
444+
await Launcher.LaunchUriAsync(filesUWPUri);
445+
}
446+
429447
public void ShareItem_Click(object sender, RoutedEventArgs e)
430448
{
431449
DataTransferManager manager = DataTransferManager.GetForCurrentView();

Files/ProHome.xaml.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
302302
App.CurrentInstance.InteractionOperations.SelectAllItems();
303303
break;
304304
case (true, false, false, true, VirtualKey.N):
305-
LaunchNewWindow();
305+
App.CurrentInstance.InteractionOperations.LaunchNewWindow();
306306
break;
307307
case (true, false, false, true, VirtualKey.W):
308-
CloseTab();
308+
App.CurrentInstance.InteractionOperations.CloseTab();
309309
break;
310310
case (false, false, false, true, VirtualKey.Delete):
311311
App.CurrentInstance.InteractionOperations.DeleteItem_Click(null, null);
@@ -353,25 +353,6 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
353353
}
354354
}
355355
}
356-
357-
private void CloseTab()
358-
{
359-
if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count == 1)
360-
{
361-
Application.Current.Exit();
362-
}
363-
else if (((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.Count > 1)
364-
{
365-
((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.TabItems.RemoveAt(((Window.Current.Content as Frame).Content as InstanceTabsView).TabStrip.SelectedIndex);
366-
}
367-
}
368-
369-
private async void LaunchNewWindow()
370-
{
371-
var filesUWPUri = new Uri("files-uwp:");
372-
await Launcher.LaunchUriAsync(filesUWPUri);
373-
}
374-
375356
}
376357

377358
public enum InteractionOperationType

0 commit comments

Comments
 (0)