Skip to content

Commit c5bbb64

Browse files
committed
Debug codes
1 parent 60412c2 commit c5bbb64

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

Flow.Launcher.Infrastructure/QuickSwitch/QuickSwitch.cs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
2+
using System.Diagnostics;
23
using System.IO;
34
using System.Runtime.InteropServices;
4-
using Flow.Launcher.Infrastructure.Hotkey;
55
using Flow.Launcher.Infrastructure.Logger;
66
using Interop.UIAutomationClient;
77
using NHotkey;
@@ -61,7 +61,10 @@ public static void OnToggleHotkey(object sender, HotkeyEventArgs args)
6161

6262
private static void NavigateDialogPath(IUIAutomationElement window)
6363
{
64-
if (window is not { CurrentClassName: "#32770" } dialog) return;
64+
if (window is not { CurrentClassName: "#32770" } dialog)
65+
{
66+
return;
67+
}
6568

6669
object document;
6770
try
@@ -73,20 +76,35 @@ private static void NavigateDialogPath(IUIAutomationElement window)
7376
return;
7477
}
7578

76-
if (document is not IShellFolderViewDual2 folder) return;
79+
if (document is not IShellFolderViewDual2 folder)
80+
{
81+
return;
82+
}
7783

78-
var path = folder.Folder.Items().Item().Path;
79-
if (!Path.IsPathRooted(path)) return;
84+
string path;
85+
try
86+
{
87+
path = folder.Folder.Items().Item().Path;
88+
if (!Path.IsPathRooted(path))
89+
{
90+
return;
91+
}
92+
}
93+
catch
94+
{
95+
return;
96+
}
8097

81-
_inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.VK_D);
98+
//_inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.MENU, VirtualKeyCode.VK_D);
8299

83100
var address = dialog.FindFirst(TreeScope.TreeScope_Subtree, _automation.CreateAndCondition(
84101
_automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_EditControlTypeId),
85102
_automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AccessKeyPropertyId, "d")));
86103

87104
if (address == null)
88105
{
89-
Log.Error("Cannot Get specific Control");
106+
// I found issue here
107+
Debug.WriteLine("Failed to find address edit control");
90108
return;
91109
}
92110

@@ -145,11 +163,11 @@ uint dwmsEventTime
145163
}
146164

147165
// Release previous reference if exists
148-
if (lastExplorerView != null)
166+
/*if (lastExplorerView != null)
149167
{
150168
Marshal.ReleaseComObject(lastExplorerView);
151169
lastExplorerView = null;
152-
}
170+
}*/
153171

154172
lastExplorerView = explorer;
155173
}
@@ -160,7 +178,7 @@ uint dwmsEventTime
160178
}
161179
finally
162180
{
163-
if (window != null)
181+
/*if (window != null)
164182
{
165183
Marshal.ReleaseComObject(window);
166184
window = null;
@@ -169,7 +187,7 @@ uint dwmsEventTime
169187
{
170188
Marshal.ReleaseComObject(shellWindows);
171189
shellWindows = null;
172-
}
190+
}*/
173191
}
174192
}
175193

0 commit comments

Comments
 (0)