Skip to content

Do not create customized preview panel when preview is off #3867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,8 @@
MinHeight="380"
MaxHeight="{Binding ElementName=ResultListBox, Path=ActualHeight}"
Padding="0 0 10 10"
d:DataContext="{d:DesignInstance vm:ResultViewModel}"
DataContext="{Binding PreviewSelectedItem, Mode=OneWay}"
Visibility="{Binding ShowCustomizedPreview}">
<ContentControl Content="{Binding Result.PreviewPanel.Value}" />
<ContentControl Content="{Binding CustomizedPreviewControl}" />
</Border>
</Grid>
</Grid>
Expand Down
7 changes: 7 additions & 0 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Threading;
using CommunityToolkit.Mvvm.DependencyInjection;
Expand Down Expand Up @@ -267,7 +268,7 @@
#if DEBUG
throw t.Exception;
#else
App.API.LogError(ClassName, $"Error happen in task dealing with viewupdate for results. {t.Exception}");

Check warning on line 271 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`viewupdate` is not a recognized word. (unrecognized-spelling)
_resultsViewUpdateTask =
Task.Run(UpdateActionAsync).ContinueWith(continueAction, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
#endif
Expand Down Expand Up @@ -464,7 +465,7 @@
else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
{
//var defaultSuggestion = SelectedResults.SelectedItem.QuerySuggestionText;
//// check if result.actionkeywordassigned is empty

Check warning on line 468 in Flow.Launcher/ViewModel/MainViewModel.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`actionkeywordassigned` is not a recognized word. (unrecognized-spelling)
//if (!string.IsNullOrEmpty(result.ActionKeywordAssigned))
//{
// autoCompleteText = $"{result.ActionKeywordAssigned} {defaultSuggestion}";
Expand Down Expand Up @@ -883,6 +884,12 @@
}
}

public Visibility ShowCustomizedPreview
=> InternalPreviewVisible && PreviewSelectedItem?.Result.PreviewPanel != null ? Visibility.Visible : Visibility.Collapsed;

public UserControl CustomizedPreviewControl
=> ShowCustomizedPreview == Visibility.Visible ? PreviewSelectedItem?.Result.PreviewPanel.Value : null;

public Visibility ProgressBarVisibility { get; set; }
public Visibility MainWindowVisibility { get; set; }

Expand Down
2 changes: 0 additions & 2 deletions Flow.Launcher/ViewModel/ResultViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ public ResultViewModel(Result result, Settings settings)

public Visibility ShowDefaultPreview => Result.PreviewPanel == null ? Visibility.Visible : Visibility.Collapsed;

public Visibility ShowCustomizedPreview => Result.PreviewPanel == null ? Visibility.Collapsed : Visibility.Visible;

public Visibility ShowIcon
{
get
Expand Down
Loading