Skip to content

Commit daab010

Browse files
committed
Prevent PathBox Edit Mode from Being Unfocused
1 parent 0376ce7 commit daab010

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

Files.Package/Files.Package.wapproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
<GenerateTestArtifacts>True</GenerateTestArtifacts>
6060
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
6161
<EntryPointProjectUniqueName>..\Files\Files.csproj</EntryPointProjectUniqueName>
62+
<PackageCertificateThumbprint>FB6F64C35E4B9AAED7318BCAB75942DD75BB4AD3</PackageCertificateThumbprint>
63+
<PackageCertificateKeyFile>Files.Package_TemporaryKey.pfx</PackageCertificateKeyFile>
6264
</PropertyGroup>
6365
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
6466
<AppxBundle>Always</AppxBundle>

Files/UserControls/NavigationToolbar/NavigationToolbar.xaml.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,15 @@ public async void CheckPathInput(ItemViewModel instance, string CurrentInput)
399399
}
400400
private void VisiblePath_LostFocus(object sender, RoutedEventArgs e)
401401
{
402-
App.CurrentInstance.NavigationControl.IsEditModeEnabled = false;
402+
var element = FocusManager.GetFocusedElement() as Control;
403+
if(element.FocusState != FocusState.Programmatic && element.FocusState != FocusState.Keyboard)
404+
{
405+
App.CurrentInstance.NavigationControl.IsEditModeEnabled = false;
406+
}
407+
else
408+
{
409+
this.VisiblePath.Focus(FocusState.Programmatic);
410+
}
403411
}
404412

405413
private void PathViewInteract_ItemClick(object sender, ItemClickEventArgs e)

Files/Views/Pages/ProHome.xaml.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
125125

126126
private void Page_Loaded(object sender, RoutedEventArgs e)
127127
{
128-
129-
130128
viewModel = new ItemViewModel();
131129
interactionOperation = new Interaction();
132130

@@ -237,16 +235,20 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
237235
await App.addItemDialog.ShowAsync();
238236
break;
239237
case (true, false, false, true, VirtualKey.C): //ctrl + c, copy
240-
App.CurrentInstance.InteractionOperations.CopyItem_ClickAsync(null, null);
238+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
239+
App.CurrentInstance.InteractionOperations.CopyItem_ClickAsync(null, null);
241240
break;
242241
case (true, false, false, true, VirtualKey.V): //ctrl + v, paste
243-
App.CurrentInstance.InteractionOperations.PasteItem_ClickAsync(null, null);
242+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
243+
App.CurrentInstance.InteractionOperations.PasteItem_ClickAsync(null, null);
244244
break;
245245
case (true, false, false, true, VirtualKey.X): //ctrl + x, cut
246-
App.CurrentInstance.InteractionOperations.CutItem_Click(null, null);
246+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
247+
App.CurrentInstance.InteractionOperations.CutItem_Click(null, null);
247248
break;
248249
case (true, false, false, true, VirtualKey.A): //ctrl + a, select all
249-
App.CurrentInstance.InteractionOperations.SelectAllItems();
250+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
251+
App.CurrentInstance.InteractionOperations.SelectAllItems();
250252
break;
251253
case (true, false, false, true, VirtualKey.N): //ctrl + n, new window
252254
App.CurrentInstance.InteractionOperations.LaunchNewWindow();
@@ -258,12 +260,16 @@ private async void ProHomeInstance_KeyUp(object sender, KeyRoutedEventArgs e)
258260
App.CurrentInstance.InteractionOperations.CloseTab();
259261
break;
260262
case (false, false, false, true, VirtualKey.Delete): //delete, delete item
261-
App.CurrentInstance.InteractionOperations.DeleteItem_Click(null, null);
263+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
264+
App.CurrentInstance.InteractionOperations.DeleteItem_Click(null, null);
262265
break;
263266
case (false, false, false, true, VirtualKey.Space): //space, quick look
264-
if ((App.CurrentInstance.ContentPage).IsQuickLookEnabled)
267+
if (!App.CurrentInstance.NavigationControl.IsEditModeEnabled)
265268
{
266-
App.CurrentInstance.InteractionOperations.ToggleQuickLook();
269+
if ((App.CurrentInstance.ContentPage).IsQuickLookEnabled)
270+
{
271+
App.CurrentInstance.InteractionOperations.ToggleQuickLook();
272+
}
267273
}
268274
break;
269275
case (false, false, true, true, VirtualKey.Left): //alt + back arrow, backward

0 commit comments

Comments
 (0)