Upload FastSeekWpf/MainWindow.xaml.cs
Browse files- FastSeekWpf/MainWindow.xaml.cs +36 -14
FastSeekWpf/MainWindow.xaml.cs
CHANGED
|
@@ -302,24 +302,41 @@ public partial class MainWindow : Window, INotifyPropertyChanged
|
|
| 302 |
|
| 303 |
private void Window_Deactivated(object sender, EventArgs e)
|
| 304 |
{
|
| 305 |
-
|
| 306 |
-
_isVisible = false;
|
| 307 |
}
|
| 308 |
|
| 309 |
-
private void
|
| 310 |
{
|
| 311 |
-
|
|
|
|
| 312 |
{
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
|
|
|
|
|
|
|
|
|
| 319 |
{
|
| 320 |
Hide();
|
| 321 |
_isVisible = false;
|
| 322 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
}
|
| 324 |
else
|
| 325 |
{
|
|
@@ -333,7 +350,11 @@ public partial class MainWindow : Window, INotifyPropertyChanged
|
|
| 333 |
|
| 334 |
if (Resources["AppearAnim"] is Storyboard appear)
|
| 335 |
{
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
}
|
| 338 |
_isVisible = true;
|
| 339 |
}
|
|
@@ -352,7 +373,7 @@ public partial class MainWindow : Window, INotifyPropertyChanged
|
|
| 352 |
switch (e.Key)
|
| 353 |
{
|
| 354 |
case Key.Escape:
|
| 355 |
-
|
| 356 |
e.Handled = true;
|
| 357 |
break;
|
| 358 |
case Key.Down:
|
|
@@ -395,6 +416,7 @@ public partial class MainWindow : Window, INotifyPropertyChanged
|
|
| 395 |
Results = new List<ResultItem>();
|
| 396 |
ResultsScroll.Visibility = Visibility.Collapsed;
|
| 397 |
EmptyHint.Visibility = Visibility.Visible;
|
|
|
|
| 398 |
SepLine.Visibility = Visibility.Collapsed;
|
| 399 |
StatusText.Text = $"{_index.Count:N0} files indexed";
|
| 400 |
});
|
|
@@ -503,7 +525,7 @@ public partial class MainWindow : Window, INotifyPropertyChanged
|
|
| 503 |
: item.FullPath;
|
| 504 |
|
| 505 |
Win32Api.ShellExecuteW(IntPtr.Zero, "open", target, null, null, 1);
|
| 506 |
-
|
| 507 |
}
|
| 508 |
|
| 509 |
private static string GetIconGlyph(ResultKind kind) => kind switch
|
|
|
|
| 302 |
|
| 303 |
private void Window_Deactivated(object sender, EventArgs e)
|
| 304 |
{
|
| 305 |
+
FadeOutAndHide();
|
|
|
|
| 306 |
}
|
| 307 |
|
| 308 |
+
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
| 309 |
{
|
| 310 |
+
// Allow dragging the window by clicking anywhere on the background
|
| 311 |
+
if (e.ChangedButton == MouseButton.Left)
|
| 312 |
{
|
| 313 |
+
DragMove();
|
| 314 |
+
}
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
private void FadeOutAndHide()
|
| 318 |
+
{
|
| 319 |
+
if (Resources["FadeAnim"] is Storyboard fade)
|
| 320 |
+
{
|
| 321 |
+
fade.Completed += (s, e) =>
|
| 322 |
{
|
| 323 |
Hide();
|
| 324 |
_isVisible = false;
|
| 325 |
+
};
|
| 326 |
+
fade.Begin(this);
|
| 327 |
+
}
|
| 328 |
+
else
|
| 329 |
+
{
|
| 330 |
+
Hide();
|
| 331 |
+
_isVisible = false;
|
| 332 |
+
}
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
private void ToggleVisibility()
|
| 336 |
+
{
|
| 337 |
+
if (_isVisible)
|
| 338 |
+
{
|
| 339 |
+
FadeOutAndHide();
|
| 340 |
}
|
| 341 |
else
|
| 342 |
{
|
|
|
|
| 350 |
|
| 351 |
if (Resources["AppearAnim"] is Storyboard appear)
|
| 352 |
{
|
| 353 |
+
appear.Begin(this);
|
| 354 |
+
}
|
| 355 |
+
else
|
| 356 |
+
{
|
| 357 |
+
Opacity = 1;
|
| 358 |
}
|
| 359 |
_isVisible = true;
|
| 360 |
}
|
|
|
|
| 373 |
switch (e.Key)
|
| 374 |
{
|
| 375 |
case Key.Escape:
|
| 376 |
+
FadeOutAndHide();
|
| 377 |
e.Handled = true;
|
| 378 |
break;
|
| 379 |
case Key.Down:
|
|
|
|
| 416 |
Results = new List<ResultItem>();
|
| 417 |
ResultsScroll.Visibility = Visibility.Collapsed;
|
| 418 |
EmptyHint.Visibility = Visibility.Visible;
|
| 419 |
+
EmptyHint.Text = "Start typing to search your files...";
|
| 420 |
SepLine.Visibility = Visibility.Collapsed;
|
| 421 |
StatusText.Text = $"{_index.Count:N0} files indexed";
|
| 422 |
});
|
|
|
|
| 525 |
: item.FullPath;
|
| 526 |
|
| 527 |
Win32Api.ShellExecuteW(IntPtr.Zero, "open", target, null, null, 1);
|
| 528 |
+
FadeOutAndHide();
|
| 529 |
}
|
| 530 |
|
| 531 |
private static string GetIconGlyph(ResultKind kind) => kind switch
|