Skip to content

Commit bcd157f

Browse files
committed
1.2
1 parent 20f7998 commit bcd157f

File tree

6 files changed

+67
-15
lines changed

6 files changed

+67
-15
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Right-click opens the files native shell context menu.
2727

2828
F1 key shows the about dialog.
2929

30+
Up/Down key navigates the main list.
31+
32+
Shift+F10 or Menu key show the context menu.
3033

3134
### Download
3235

src/Everything.NET.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<OutDir>$(SolutionDir)\bin</OutDir>
77
<UseWPF>true</UseWPF>
88
<UseWindowsForms>true</UseWindowsForms>
9-
<ApplicationIcon>Everything.ico</ApplicationIcon>
9+
<ApplicationIcon>Icon.ico</ApplicationIcon>
1010
<Authors>Frank Skare (stax76)</Authors>
1111
<Copyright>Copyright (C) 2020 Frank Skare (stax76)</Copyright>
1212
<Product>Everything.NET</Product>
1313
<Description>Everything frontend with dark UI.</Description>
1414
<AssemblyName>EverythingNET</AssemblyName>
1515
<RootNamespace>EverythingNET</RootNamespace>
16-
<Version>1.1.0</Version>
16+
<Version>1.2.0</Version>
1717
</PropertyGroup>
1818

1919
<ItemGroup>

src/Everything.ico

-28 KB
Binary file not shown.

src/Icon.ico

28 KB
Binary file not shown.

src/View.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
Width="800"
1414
WindowStartupLocation="CenterScreen"
1515
Activated="Window_Activated"
16-
SizeChanged="Window_SizeChanged">
16+
SizeChanged="Window_SizeChanged" Loaded="Window_Loaded">
1717

1818
<Window.Resources>
1919
<local:SizeConverter x:Key="SizeConverter" />
@@ -31,14 +31,17 @@
3131
Margin="20"
3232
Padding="2"
3333
FontSize="14"
34+
ContextMenu="{x:Null}"
3435
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
3536
PreviewKeyDown="SearchTextBox_PreviewKeyDown" >
3637
</TextBox>
3738

38-
<DataGrid AutoGenerateColumns="False"
39+
<DataGrid Name="DG"
40+
AutoGenerateColumns="False"
3941
Grid.Row="1"
4042
IsReadOnly="True"
4143
SelectionMode="Single"
44+
IsSynchronizedWithCurrentItem="True"
4245
ItemsSource="{Binding Items}"
4346
MouseDoubleClick="DataGrid_MouseDoubleClick"
4447
MouseRightButtonDown="DataGrid_MouseRightButtonDown"

src/View.xaml.cs

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,21 @@ void DataGrid_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
5252

5353
void DataGrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
5454
{
55-
DataGrid grid = sender as DataGrid;
55+
ShowMenu(PointToScreen(Mouse.GetPosition(this)));
56+
}
5657

57-
if (grid.SelectedItem != null)
58+
void ShowMenu(Point screenPos)
59+
{
60+
if (DG.SelectedItem != null)
5861
{
59-
Item item = grid.SelectedItem as Item;
62+
Item item = DG.SelectedItem as Item;
6063
string file = Path.Combine(item.Directory, item.Name);
6164

6265
if (File.Exists(file))
6366
{
6467
ShellContextMenu menu = new ShellContextMenu();
6568
FileInfo[] files = { new FileInfo(file) };
6669
IntPtr handle = new WindowInteropHelper(this).Handle;
67-
Point screenPos = PointToScreen(Mouse.GetPosition(this));
6870
System.Drawing.Point screenPos2 = new System.Drawing.Point((int)screenPos.X, (int)screenPos.Y);
6971
menu.ShowContextMenu(handle, files, screenPos2);
7072
Task.Run(() => {
@@ -103,15 +105,9 @@ protected override void OnClosing(CancelEventArgs e)
103105
RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "LastText", ViewModel.SearchText);
104106
}
105107

106-
protected override void OnStateChanged(EventArgs e)
107-
{
108-
base.OnStateChanged(e);
109-
110-
}
111-
112108
void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
113109
{
114-
if (e.Key == Key.Up)
110+
if (e.Key == Key.Up && SearchTextBox.Text == "")
115111
{
116112
string last = RegistryHelp.GetString(RegistryHelp.ApplicationKey, "LastText");
117113

@@ -121,6 +117,50 @@ void SearchTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
121117
SearchTextBox.CaretIndex = 1000;
122118
}
123119
}
120+
121+
if (DG.Items.Count > 0)
122+
{
123+
if (e.Key == Key.Up)
124+
{
125+
int index = DG.SelectedIndex;
126+
index--;
127+
128+
if (index < 0)
129+
index = 0;
130+
131+
DG.SelectedIndex = index;
132+
}
133+
134+
if (e.Key == Key.Down)
135+
{
136+
int index = DG.SelectedIndex;
137+
index++;
138+
139+
if (index > DG.Items.Count - 1)
140+
index = DG.Items.Count - 1;
141+
142+
DG.SelectedIndex = index;
143+
}
144+
}
145+
146+
if (e.Key == Key.Apps)
147+
{
148+
Application.Current.Dispatcher.InvokeAsync(() => {
149+
ShowMenu(PointToScreen(new Point(0d, 0d)));
150+
});
151+
}
152+
}
153+
154+
IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
155+
{
156+
if (msg == 0x104 && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
157+
{
158+
Application.Current.Dispatcher.InvokeAsync(() => {
159+
ShowMenu(PointToScreen(new Point(0d, 0d)));
160+
});
161+
}
162+
163+
return IntPtr.Zero;
124164
}
125165

126166
void Window_Activated(object sender, EventArgs e)
@@ -134,5 +174,11 @@ void Window_SizeChanged(object sender, SizeChangedEventArgs e)
134174
NameColumn.Width = ActualWidth * 0.25;
135175
DirectoryColumn.Width = ActualWidth * 0.5;
136176
}
177+
178+
void Window_Loaded(object sender, RoutedEventArgs e)
179+
{
180+
HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(this).Handle);
181+
source.AddHook(new HwndSourceHook(WndProc));
182+
}
137183
}
138184
}

0 commit comments

Comments
 (0)