|
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 | {
|
@@ -105,7 +109,6 @@ private void OnLoaded(object sender, RoutedEventArgs _)
|
105 | 109 | // since the default main window visibility is visible
|
106 | 110 | // so we need set focus during startup
|
107 | 111 | QueryTextBox.Focus();
|
108 |
| - |
109 | 112 | _viewModel.PropertyChanged += (o, e) =>
|
110 | 113 | {
|
111 | 114 | switch (e.PropertyName)
|
@@ -243,7 +246,9 @@ private void InitializeNotifyIcon()
|
243 | 246 | Icon = Properties.Resources.app,
|
244 | 247 | Visible = !_settings.HideNotifyIcon
|
245 | 248 | };
|
| 249 | + |
246 | 250 | contextMenu = new ContextMenu();
|
| 251 | + |
247 | 252 | var openIcon = new FontIcon { Glyph = "\ue71e" };
|
248 | 253 | var open = new MenuItem
|
249 | 254 | {
|
@@ -280,9 +285,11 @@ private void InitializeNotifyIcon()
|
280 | 285 | positionreset.Click += (o, e) => PositionReset();
|
281 | 286 | settings.Click += (o, e) => App.API.OpenSettingDialog();
|
282 | 287 | exit.Click += (o, e) => Close();
|
283 |
| - contextMenu.Items.Add(open); |
| 288 | + |
284 | 289 | gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
|
285 | 290 | positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");
|
| 291 | + |
| 292 | + contextMenu.Items.Add(open); |
286 | 293 | contextMenu.Items.Add(gamemode);
|
287 | 294 | contextMenu.Items.Add(positionreset);
|
288 | 295 | contextMenu.Items.Add(settings);
|
@@ -359,45 +366,91 @@ public void WindowAnimator()
|
359 | 366 |
|
360 | 367 | _animating = true;
|
361 | 368 | UpdatePosition();
|
362 |
| - Storyboard sb = new Storyboard(); |
| 369 | + |
| 370 | + Storyboard windowsb = new Storyboard(); |
| 371 | + Storyboard clocksb = new Storyboard(); |
363 | 372 | Storyboard iconsb = new Storyboard();
|
364 |
| - CircleEase easing = new CircleEase(); // or whatever easing class you want |
| 373 | + CircleEase easing = new CircleEase(); |
365 | 374 | easing.EasingMode = EasingMode.EaseInOut;
|
366 |
| - var da = new DoubleAnimation |
| 375 | + |
| 376 | + var WindowOpacity = new DoubleAnimation |
367 | 377 | {
|
368 | 378 | From = 0,
|
369 | 379 | To = 1,
|
370 | 380 | Duration = TimeSpan.FromSeconds(0.25),
|
371 | 381 | FillBehavior = FillBehavior.Stop
|
372 | 382 | };
|
373 | 383 |
|
374 |
| - var da2 = new DoubleAnimation |
| 384 | + var WindowMotion = new DoubleAnimation |
375 | 385 | {
|
376 | 386 | From = Top + 10,
|
377 | 387 | To = Top,
|
378 | 388 | Duration = TimeSpan.FromSeconds(0.25),
|
379 | 389 | FillBehavior = FillBehavior.Stop
|
380 | 390 | };
|
381 |
| - var da3 = new DoubleAnimation |
382 |
| - { |
| 391 | + var IconMotion = new DoubleAnimation |
| 392 | + { |
383 | 393 | From = 12,
|
384 | 394 | To = 0,
|
385 | 395 | EasingFunction = easing,
|
386 | 396 | Duration = TimeSpan.FromSeconds(0.36),
|
387 | 397 | FillBehavior = FillBehavior.Stop
|
388 |
| - }; |
389 |
| - Storyboard.SetTarget(da, this); |
390 |
| - Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty)); |
391 |
| - Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty)); |
392 |
| - Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty)); |
393 |
| - sb.Children.Add(da); |
394 |
| - sb.Children.Add(da2); |
395 |
| - iconsb.Children.Add(da3); |
396 |
| - sb.Completed += (_, _) => _animating = false; |
| 398 | + }; |
| 399 | + |
| 400 | + var ClockOpacity = new DoubleAnimation |
| 401 | + { |
| 402 | + From = 0, |
| 403 | + To = 1, |
| 404 | + EasingFunction = easing, |
| 405 | + Duration = TimeSpan.FromSeconds(0.36), |
| 406 | + FillBehavior = FillBehavior.Stop |
| 407 | + }; |
| 408 | + double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style |
| 409 | + var IconOpacity = new DoubleAnimation |
| 410 | + { |
| 411 | + From = 0, |
| 412 | + To = TargetIconOpacity, |
| 413 | + EasingFunction = easing, |
| 414 | + Duration = TimeSpan.FromSeconds(0.36), |
| 415 | + FillBehavior = FillBehavior.Stop |
| 416 | + }; |
| 417 | + |
| 418 | + double right = ClockPanel.Margin.Right; |
| 419 | + var thicknessAnimation = new ThicknessAnimation |
| 420 | + { |
| 421 | + From = new Thickness(0, 12, right, 0), |
| 422 | + To = new Thickness(0, 0, right, 0), |
| 423 | + EasingFunction = easing, |
| 424 | + Duration = TimeSpan.FromSeconds(0.36), |
| 425 | + FillBehavior = FillBehavior.Stop |
| 426 | + }; |
| 427 | + |
| 428 | + Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty)); |
| 429 | + Storyboard.SetTargetName(thicknessAnimation, "ClockPanel"); |
| 430 | + Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty)); |
| 431 | + Storyboard.SetTarget(WindowOpacity, this); |
| 432 | + Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty)); |
| 433 | + Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty)); |
| 434 | + Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty)); |
| 435 | + Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty)); |
| 436 | + |
| 437 | + clocksb.Children.Add(thicknessAnimation); |
| 438 | + clocksb.Children.Add(ClockOpacity); |
| 439 | + windowsb.Children.Add(WindowOpacity); |
| 440 | + windowsb.Children.Add(WindowMotion); |
| 441 | + iconsb.Children.Add(IconMotion); |
| 442 | + iconsb.Children.Add(IconOpacity); |
| 443 | + |
| 444 | + windowsb.Completed += (_, _) => _animating = false; |
397 | 445 | _settings.WindowLeft = Left;
|
398 | 446 | _settings.WindowTop = Top;
|
| 447 | + |
| 448 | + if (QueryTextBox.Text.Length == 0) |
| 449 | + { |
| 450 | + clocksb.Begin(ClockPanel); |
| 451 | + } |
399 | 452 | iconsb.Begin(SearchIcon);
|
400 |
| - sb.Begin(FlowMainWindow); |
| 453 | + windowsb.Begin(FlowMainWindow); |
401 | 454 | }
|
402 | 455 |
|
403 | 456 | private void OnMouseDown(object sender, MouseButtonEventArgs e)
|
|
0 commit comments