mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
fix logic
This commit is contained in:
parent
19aa45df05
commit
421ca3340b
1 changed files with 42 additions and 43 deletions
|
|
@ -77,54 +77,53 @@ namespace Flow.Launcher
|
||||||
switch (e.PropertyName)
|
switch (e.PropertyName)
|
||||||
{
|
{
|
||||||
case nameof(MainViewModel.MainWindowVisibility):
|
case nameof(MainViewModel.MainWindowVisibility):
|
||||||
{
|
|
||||||
if (_viewModel.MainWindowVisibility == Visibility.Visible)
|
|
||||||
{
|
{
|
||||||
Activate();
|
if (_viewModel.MainWindowVisibility == Visibility.Visible)
|
||||||
QueryTextBox.Focus();
|
|
||||||
UpdatePosition();
|
|
||||||
_settings.ActivateTimes++;
|
|
||||||
if (!_viewModel.LastQuerySelected)
|
|
||||||
{
|
{
|
||||||
QueryTextBox.SelectAll();
|
Activate();
|
||||||
_viewModel.LastQuerySelected = true;
|
QueryTextBox.Focus();
|
||||||
|
UpdatePosition();
|
||||||
|
_settings.ActivateTimes++;
|
||||||
|
if (!_viewModel.LastQuerySelected)
|
||||||
|
{
|
||||||
|
QueryTextBox.SelectAll();
|
||||||
|
_viewModel.LastQuerySelected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused)
|
||||||
|
{
|
||||||
|
_progressBarStoryboard.Begin(ProgressBar, true);
|
||||||
|
isProgressBarStoryboardPaused = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (!isProgressBarStoryboardPaused)
|
||||||
if (_viewModel.ProgressBarVisibility == Visibility.Visible && isProgressBarStoryboardPaused)
|
|
||||||
{
|
{
|
||||||
_progressBarStoryboard.Begin(ProgressBar, true);
|
|
||||||
isProgressBarStoryboardPaused = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isProgressBarStoryboardPaused)
|
|
||||||
{
|
|
||||||
_progressBarStoryboard.Stop(ProgressBar);
|
|
||||||
isProgressBarStoryboardPaused = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case nameof(MainViewModel.ProgressBarVisibility):
|
|
||||||
{
|
|
||||||
Dispatcher.Invoke(async () =>
|
|
||||||
{
|
|
||||||
if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused)
|
|
||||||
{
|
|
||||||
await Task.Delay(50);
|
|
||||||
_progressBarStoryboard.Stop(ProgressBar);
|
_progressBarStoryboard.Stop(ProgressBar);
|
||||||
isProgressBarStoryboardPaused = true;
|
isProgressBarStoryboardPaused = true;
|
||||||
}
|
}
|
||||||
else if (_viewModel.MainWindowVisibility == Visibility.Visible &&
|
|
||||||
isProgressBarStoryboardPaused)
|
|
||||||
{
|
|
||||||
_progressBarStoryboard.Begin(ProgressBar, true);
|
|
||||||
isProgressBarStoryboardPaused = false;
|
|
||||||
}
|
|
||||||
}, System.Windows.Threading.DispatcherPriority.Render);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case nameof(MainViewModel.ProgressBarVisibility):
|
||||||
|
{
|
||||||
|
Dispatcher.Invoke(async () =>
|
||||||
|
{
|
||||||
|
if (_viewModel.ProgressBarVisibility == Visibility.Hidden && !isProgressBarStoryboardPaused)
|
||||||
|
{
|
||||||
|
await Task.Delay(50);
|
||||||
|
_progressBarStoryboard.Stop(ProgressBar);
|
||||||
|
isProgressBarStoryboardPaused = true;
|
||||||
|
}
|
||||||
|
else if (_viewModel.MainWindowVisibility == Visibility.Visible &&
|
||||||
|
isProgressBarStoryboardPaused)
|
||||||
|
{
|
||||||
|
_progressBarStoryboard.Begin(ProgressBar, true);
|
||||||
|
isProgressBarStoryboardPaused = false;
|
||||||
|
}
|
||||||
|
}, System.Windows.Threading.DispatcherPriority.Render);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
case nameof(MainViewModel.QueryTextCursorMovedToEnd):
|
case nameof(MainViewModel.QueryTextCursorMovedToEnd):
|
||||||
if (_viewModel.QueryTextCursorMovedToEnd)
|
if (_viewModel.QueryTextCursorMovedToEnd)
|
||||||
{
|
{
|
||||||
|
|
@ -230,10 +229,10 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
if (sender != null && e.OriginalSource != null)
|
if (sender != null && e.OriginalSource != null)
|
||||||
{
|
{
|
||||||
var r = (ResultListBox) sender;
|
var r = (ResultListBox)sender;
|
||||||
var d = (DependencyObject) e.OriginalSource;
|
var d = (DependencyObject)e.OriginalSource;
|
||||||
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
|
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
|
||||||
var result = (ResultViewModel) item?.DataContext;
|
var result = (ResultViewModel)item?.DataContext;
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
if (e.ChangedButton == MouseButton.Left)
|
if (e.ChangedButton == MouseButton.Left)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue