mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Set VirtualizingPanel.ScrollUnit and ScrollViewer.CanContentScroll for other tab.
Close Flyout when clicking install
This commit is contained in:
parent
6e76d87f66
commit
ad77ecdf02
3 changed files with 58 additions and 14 deletions
|
|
@ -607,7 +607,8 @@
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Background="{DynamicResource Color01B}"
|
Background="{DynamicResource Color01B}"
|
||||||
ScrollViewer.CanContentScroll="False"
|
CanContentScroll="True"
|
||||||
|
VirtualizingPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True">
|
VirtualizingStackPanel.IsVirtualizing="True">
|
||||||
<StackPanel Margin="5,18,25,30" Orientation="Vertical">
|
<StackPanel Margin="5,18,25,30" Orientation="Vertical">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
@ -1395,6 +1396,7 @@
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
KeyDown="PluginStoreFilterTxb_OnKeyDown"
|
KeyDown="PluginStoreFilterTxb_OnKeyDown"
|
||||||
LostFocus="RefreshPluginStoreEventHandler"
|
LostFocus="RefreshPluginStoreEventHandler"
|
||||||
|
|
||||||
Text=""
|
Text=""
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
ToolTip="{DynamicResource searchpluginToolTip}"
|
ToolTip="{DynamicResource searchpluginToolTip}"
|
||||||
|
|
@ -1436,7 +1438,7 @@
|
||||||
Padding="12,4,12,4"
|
Padding="12,4,12,4"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Click="OnPluginStoreRefreshClick"
|
Command="{Binding RefreshExternalPluginsCommand}"
|
||||||
Content="{DynamicResource refresh}"
|
Content="{DynamicResource refresh}"
|
||||||
DockPanel.Dock="Right"
|
DockPanel.Dock="Right"
|
||||||
FontSize="13" />
|
FontSize="13" />
|
||||||
|
|
@ -1515,7 +1517,8 @@
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
VerticalContentAlignment="Stretch"
|
VerticalContentAlignment="Stretch"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
FocusVisualStyle="{StaticResource StoreItemFocusVisualStyleKey}">
|
FocusVisualStyle="{StaticResource StoreItemFocusVisualStyleKey}"
|
||||||
|
Click="StoreListItem_Click">
|
||||||
<ui:FlyoutService.Flyout>
|
<ui:FlyoutService.Flyout>
|
||||||
<ui:Flyout x:Name="InstallFlyout" Placement="Bottom">
|
<ui:Flyout x:Name="InstallFlyout" Placement="Bottom">
|
||||||
<Grid MinWidth="200">
|
<Grid MinWidth="200">
|
||||||
|
|
@ -1675,7 +1678,8 @@
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Padding="6,0,24,0"
|
Padding="6,0,24,0"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
VirtualizingStackPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True">
|
VirtualizingStackPanel.IsVirtualizing="True">
|
||||||
<Grid Margin="0,0,0,0">
|
<Grid Margin="0,0,0,0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|
@ -2252,7 +2256,8 @@
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Padding="0,0,6,0"
|
Padding="0,0,6,0"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
VirtualizingStackPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True">
|
VirtualizingStackPanel.IsVirtualizing="True">
|
||||||
<Border>
|
<Border>
|
||||||
<Grid Margin="5,18,18,10">
|
<Grid Margin="5,18,18,10">
|
||||||
|
|
@ -2547,7 +2552,8 @@
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Padding="5,0,24,0"
|
Padding="5,0,24,0"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
VirtualizingStackPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True">
|
VirtualizingStackPanel.IsVirtualizing="True">
|
||||||
<Border>
|
<Border>
|
||||||
|
|
||||||
|
|
@ -2720,7 +2726,8 @@
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Margin="0,0,0,0"
|
Margin="0,0,0,0"
|
||||||
Background="{DynamicResource Color01B}"
|
Background="{DynamicResource Color01B}"
|
||||||
ScrollViewer.CanContentScroll="False"
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
VirtualizingStackPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingStackPanel.IsVirtualizing="True">
|
VirtualizingStackPanel.IsVirtualizing="True">
|
||||||
<StackPanel Margin="5,14,25,30" Orientation="Vertical">
|
<StackPanel Margin="5,14,25,30" Orientation="Vertical">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ using System.Windows.Data;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
using Button = System.Windows.Controls.Button;
|
using Button = System.Windows.Controls.Button;
|
||||||
|
|
@ -300,17 +301,35 @@ namespace Flow.Launcher
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPluginStoreRefreshClick(object sender, RoutedEventArgs e)
|
private static T FindParent<T>(DependencyObject child) where T : DependencyObject
|
||||||
{
|
{
|
||||||
_ = viewModel.RefreshExternalPluginsAsync();
|
//get parent item
|
||||||
}
|
DependencyObject parentObject = VisualTreeHelper.GetParent(child);
|
||||||
|
|
||||||
|
//we've reached the end of the tree
|
||||||
|
if (parentObject == null) return null;
|
||||||
|
|
||||||
|
//check if the parent matches the type we're looking for
|
||||||
|
T parent = parentObject as T;
|
||||||
|
if (parent != null)
|
||||||
|
return parent;
|
||||||
|
else
|
||||||
|
return FindParent<T>(parentObject);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnExternalPluginInstallClick(object sender, RoutedEventArgs e)
|
private void OnExternalPluginInstallClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is Button { DataContext: PluginStoreItemViewModel plugin })
|
if (sender is not Button { DataContext: PluginStoreItemViewModel plugin } button)
|
||||||
{
|
{
|
||||||
viewModel.DisplayPluginQuery($"install {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (storeClickedButton != null)
|
||||||
|
{
|
||||||
|
FlyoutService.GetFlyout(storeClickedButton).Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.DisplayPluginQuery($"install {plugin.Name}", PluginManager.GetPluginForId("9f8f9b14-2518-4907-b211-35ab6290dee7"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e)
|
private void OnExternalPluginUninstallClick(object sender, MouseButtonEventArgs e)
|
||||||
|
|
@ -545,5 +564,21 @@ namespace Flow.Launcher
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Button storeClickedButton;
|
||||||
|
|
||||||
|
private void StoreListItem_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is not Button button)
|
||||||
|
return;
|
||||||
|
|
||||||
|
storeClickedButton = button;
|
||||||
|
|
||||||
|
var flyout = FlyoutService.GetFlyout(button);
|
||||||
|
flyout.Closed += (_, _) =>
|
||||||
|
{
|
||||||
|
storeClickedButton = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ using Flow.Launcher.Infrastructure.UserSettings;
|
||||||
using Flow.Launcher.Plugin;
|
using Flow.Launcher.Plugin;
|
||||||
using Flow.Launcher.Plugin.SharedModels;
|
using Flow.Launcher.Plugin.SharedModels;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
namespace Flow.Launcher.ViewModel
|
namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
public class SettingWindowViewModel : BaseModel
|
public partial class SettingWindowViewModel : BaseModel
|
||||||
{
|
{
|
||||||
private readonly Updater _updater;
|
private readonly Updater _updater;
|
||||||
private readonly IPortable _portable;
|
private readonly IPortable _portable;
|
||||||
|
|
@ -330,7 +331,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RefreshExternalPluginsAsync()
|
[RelayCommand]
|
||||||
|
private async Task RefreshExternalPluginsAsync()
|
||||||
{
|
{
|
||||||
await PluginsManifest.UpdateManifestAsync();
|
await PluginsManifest.UpdateManifestAsync();
|
||||||
OnPropertyChanged(nameof(ExternalPlugins));
|
OnPropertyChanged(nameof(ExternalPlugins));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue