|
30 | 30 | using ModernWpf.Controls; |
31 | 31 | using System.Drawing; |
32 | 32 | using System.Windows.Forms.Design.Behavior; |
| 33 | +using System.Security.Cryptography; |
| 34 | +using System.Runtime.CompilerServices; |
| 35 | +using Microsoft.VisualBasic.Devices; |
| 36 | +using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames; |
33 | 37 |
|
34 | 38 | namespace Flow.Launcher |
35 | 39 | { |
@@ -103,7 +107,6 @@ private void OnLoaded(object sender, RoutedEventArgs _) |
103 | 107 | // since the default main window visibility is visible |
104 | 108 | // so we need set focus during startup |
105 | 109 | QueryTextBox.Focus(); |
106 | | - |
107 | 110 | _viewModel.PropertyChanged += (o, e) => |
108 | 111 | { |
109 | 112 | switch (e.PropertyName) |
@@ -211,7 +214,9 @@ private void InitializeNotifyIcon() |
211 | 214 | Icon = Properties.Resources.app, |
212 | 215 | Visible = !_settings.HideNotifyIcon |
213 | 216 | }; |
| 217 | + |
214 | 218 | contextMenu = new ContextMenu(); |
| 219 | + |
215 | 220 | var openIcon = new FontIcon |
216 | 221 | { |
217 | 222 | Glyph = "\ue71e" |
@@ -258,9 +263,11 @@ private void InitializeNotifyIcon() |
258 | 263 | positionreset.Click += (o, e) => PositionReset(); |
259 | 264 | settings.Click += (o, e) => App.API.OpenSettingDialog(); |
260 | 265 | exit.Click += (o, e) => Close(); |
261 | | - contextMenu.Items.Add(open); |
| 266 | + |
262 | 267 | gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip"); |
263 | 268 | positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip"); |
| 269 | + |
| 270 | + contextMenu.Items.Add(open); |
264 | 271 | contextMenu.Items.Add(gamemode); |
265 | 272 | contextMenu.Items.Add(positionreset); |
266 | 273 | contextMenu.Items.Add(settings); |
@@ -368,45 +375,91 @@ public void WindowAnimator() |
368 | 375 |
|
369 | 376 | _animating = true; |
370 | 377 | UpdatePosition(); |
371 | | - Storyboard sb = new Storyboard(); |
| 378 | + |
| 379 | + Storyboard windowsb = new Storyboard(); |
| 380 | + Storyboard clocksb = new Storyboard(); |
372 | 381 | Storyboard iconsb = new Storyboard(); |
373 | | - CircleEase easing = new CircleEase(); // or whatever easing class you want |
| 382 | + CircleEase easing = new CircleEase(); |
374 | 383 | easing.EasingMode = EasingMode.EaseInOut; |
375 | | - var da = new DoubleAnimation |
| 384 | + |
| 385 | + var WindowOpacity = new DoubleAnimation |
376 | 386 | { |
377 | 387 | From = 0, |
378 | 388 | To = 1, |
379 | 389 | Duration = TimeSpan.FromSeconds(0.25), |
380 | 390 | FillBehavior = FillBehavior.Stop |
381 | 391 | }; |
382 | 392 |
|
383 | | - var da2 = new DoubleAnimation |
| 393 | + var WindowMotion = new DoubleAnimation |
384 | 394 | { |
385 | 395 | From = Top + 10, |
386 | 396 | To = Top, |
387 | 397 | Duration = TimeSpan.FromSeconds(0.25), |
388 | 398 | FillBehavior = FillBehavior.Stop |
389 | 399 | }; |
390 | | - var da3 = new DoubleAnimation |
| 400 | + var IconMotion = new DoubleAnimation |
391 | 401 | { |
392 | 402 | From = 12, |
393 | 403 | To = 0, |
394 | 404 | EasingFunction = easing, |
395 | 405 | Duration = TimeSpan.FromSeconds(0.36), |
396 | 406 | FillBehavior = FillBehavior.Stop |
397 | 407 | }; |
398 | | - Storyboard.SetTarget(da, this); |
399 | | - Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); |
400 | | - Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); |
401 | | - Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty)); |
402 | | - sb.Children.Add(da); |
403 | | - sb.Children.Add(da2); |
404 | | - iconsb.Children.Add(da3); |
405 | | - sb.Completed += (_, _) => _animating = false; |
| 408 | + |
| 409 | + var ClockOpacity = new DoubleAnimation |
| 410 | + { |
| 411 | + From = 0, |
| 412 | + To = 1, |
| 413 | + EasingFunction = easing, |
| 414 | + Duration = TimeSpan.FromSeconds(0.36), |
| 415 | + FillBehavior = FillBehavior.Stop |
| 416 | + }; |
| 417 | + double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style |
| 418 | + var IconOpacity = new DoubleAnimation |
| 419 | + { |
| 420 | + From = 0, |
| 421 | + To = TargetIconOpacity, |
| 422 | + EasingFunction = easing, |
| 423 | + Duration = TimeSpan.FromSeconds(0.36), |
| 424 | + FillBehavior = FillBehavior.Stop |
| 425 | + }; |
| 426 | + |
| 427 | + double right = ClockPanel.Margin.Right; |
| 428 | + var thicknessAnimation = new ThicknessAnimation |
| 429 | + { |
| 430 | + From = new Thickness(0, 12, right, 0), |
| 431 | + To = new Thickness(0, 0, right, 0), |
| 432 | + EasingFunction = easing, |
| 433 | + Duration = TimeSpan.FromSeconds(0.36), |
| 434 | + FillBehavior = FillBehavior.Stop |
| 435 | + }; |
| 436 | + |
| 437 | + Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty)); |
| 438 | + Storyboard.SetTargetName(thicknessAnimation, "ClockPanel"); |
| 439 | + Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty)); |
| 440 | + Storyboard.SetTarget(WindowOpacity, this); |
| 441 | + Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty)); |
| 442 | + Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty)); |
| 443 | + Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty)); |
| 444 | + Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty)); |
| 445 | + |
| 446 | + clocksb.Children.Add(thicknessAnimation); |
| 447 | + clocksb.Children.Add(ClockOpacity); |
| 448 | + windowsb.Children.Add(WindowOpacity); |
| 449 | + windowsb.Children.Add(WindowMotion); |
| 450 | + iconsb.Children.Add(IconMotion); |
| 451 | + iconsb.Children.Add(IconOpacity); |
| 452 | + |
| 453 | + windowsb.Completed += (_, _) => _animating = false; |
406 | 454 | _settings.WindowLeft = Left; |
407 | 455 | _settings.WindowTop = Top; |
| 456 | + |
| 457 | + if (QueryTextBox.Text.Length == 0) |
| 458 | + { |
| 459 | + clocksb.Begin(ClockPanel); |
| 460 | + } |
408 | 461 | iconsb.Begin(SearchIcon); |
409 | | - sb.Begin(FlowMainWindow); |
| 462 | + windowsb.Begin(FlowMainWindow); |
410 | 463 | } |
411 | 464 |
|
412 | 465 | private void OnMouseDown(object sender, MouseButtonEventArgs e) |
|
0 commit comments