mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #908 from Flow-Launcher/FixNullReferenceError
fix calling mainwindow animation after loaded
This commit is contained in:
commit
83a357affb
3 changed files with 15 additions and 15 deletions
|
|
@ -69,8 +69,6 @@ namespace Flow.Launcher
|
|||
PluginManager.LoadPlugins(_settings.PluginSettings);
|
||||
_mainVM = new MainViewModel(_settings);
|
||||
|
||||
HotKeyMapper.Initialize(_mainVM);
|
||||
|
||||
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet);
|
||||
|
||||
Http.API = API;
|
||||
|
|
@ -83,6 +81,8 @@ namespace Flow.Launcher
|
|||
|
||||
Current.MainWindow = window;
|
||||
Current.MainWindow.Title = Constant.FlowLauncher;
|
||||
|
||||
HotKeyMapper.Initialize(_mainVM);
|
||||
|
||||
// happlebao todo temp fix for instance code logic
|
||||
// load plugin before change language, because plugin language also needs be changed
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using DragEventArgs = System.Windows.DragEventArgs;
|
|||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using NotifyIcon = System.Windows.Forms.NotifyIcon;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -30,6 +31,7 @@ namespace Flow.Launcher
|
|||
private NotifyIcon _notifyIcon;
|
||||
private ContextMenu contextMenu;
|
||||
private MainViewModel _viewModel;
|
||||
private readonly MediaPlayer animationSound = new();
|
||||
private bool _animating;
|
||||
|
||||
#endregion
|
||||
|
|
@ -41,6 +43,7 @@ namespace Flow.Launcher
|
|||
_settings = settings;
|
||||
InitializeComponent();
|
||||
InitializePosition();
|
||||
animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
|
|
@ -84,6 +87,12 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (_viewModel.MainWindowVisibilityStatus)
|
||||
{
|
||||
if (_settings.UseSound)
|
||||
{
|
||||
animationSound.Position = TimeSpan.Zero;
|
||||
animationSound.Play();
|
||||
}
|
||||
|
||||
UpdatePosition();
|
||||
Activate();
|
||||
QueryTextBox.Focus();
|
||||
|
|
@ -99,6 +108,9 @@ namespace Flow.Launcher
|
|||
_progressBarStoryboard.Begin(ProgressBar, true);
|
||||
isProgressBarStoryboardPaused = false;
|
||||
}
|
||||
|
||||
if(_settings.UseAnimation)
|
||||
WindowAnimator();
|
||||
}
|
||||
else if (!isProgressBarStoryboardPaused)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Input;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
|
|
@ -14,7 +13,6 @@ using Flow.Launcher.Infrastructure.Hotkey;
|
|||
using Flow.Launcher.Infrastructure.Storage;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using Flow.Launcher.Storage;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
|
|
@ -734,20 +732,10 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public void Show()
|
||||
{
|
||||
if (_settings.UseSound)
|
||||
{
|
||||
MediaPlayer media = new MediaPlayer();
|
||||
media.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
|
||||
media.Play();
|
||||
}
|
||||
|
||||
MainWindowVisibility = Visibility.Visible;
|
||||
|
||||
MainWindowVisibilityStatus = true;
|
||||
|
||||
if(_settings.UseAnimation)
|
||||
((MainWindow)Application.Current.MainWindow).WindowAnimator();
|
||||
|
||||
|
||||
MainWindowOpacity = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue