mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Merge pull request #58 from microsoft/launcherUIAppExecution
Launcher UI app execution
This commit is contained in:
@@ -415,15 +415,13 @@
|
||||
<Grid>
|
||||
<Grid x:Name="ShadowReceiverGrid"/>
|
||||
<Grid x:Name="PowerBar" CornerRadius="4" Height="72" Background="{StaticResource BackdropAcrylicBrush}" Translation="0,0,16" Shadow="{StaticResource ShellBarShadow}" Margin="12" VerticalAlignment="Top" HorizontalAlignment="Center" MinWidth="240">
|
||||
|
||||
|
||||
<AutoSuggestBox x:Name="SearchBox" x:FieldModifier="public" PlaceholderText="Launch an app" FontSize="24" Style="{StaticResource CustomStyledAutoSuggestBox}" MinWidth="720"
|
||||
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Results.Results}">
|
||||
<AutoSuggestBox x:Name="SearchBox" x:FieldModifier="public" PlaceholderText="Launch an app" FontSize="24" Style="{StaticResource CustomStyledAutoSuggestBox}"
|
||||
MinWidth="720" ItemsSource="{Binding Results.Results}">
|
||||
<AutoSuggestBox.QueryIcon>
|
||||
<SymbolIcon Symbol="Find"/>
|
||||
</AutoSuggestBox.QueryIcon>
|
||||
<AutoSuggestBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DataTemplate >
|
||||
<Grid Height="72" Width="690" Background="Transparent" RowSpacing="0">
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<Core:EventTriggerBehavior EventName="PointerEntered">
|
||||
@@ -443,9 +441,9 @@
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image x:Name="AppIcon" Height="36" Margin="8,0,0,0" Grid.RowSpan="2" HorizontalAlignment="Left" Source="{Binding Image}"/>
|
||||
<Image x:Name="AppIcon" Height="36" Margin="8,0,0,0" Grid.RowSpan="2" HorizontalAlignment="Left" Source="{Binding Result.IcoPath}" />
|
||||
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Result.Title}" FontWeight="SemiBold" FontSize="20" VerticalAlignment="Bottom"/>
|
||||
<TextBlock x:Name="Path" Grid.Column="1" Text="C:\Program Files\WindowsApps\Microsoft\Folder " Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/>
|
||||
<TextBlock x:Name="Path" Grid.Column="1" Text= "{Binding Result.SubTitle}" Grid.Row="1" Opacity="0.6" VerticalAlignment="Top"/>
|
||||
<StackPanel Orientation="Horizontal" Opacity="0" HorizontalAlignment="Right" Grid.RowSpan="2" Grid.Column="1">
|
||||
<Interactivity:Interaction.Behaviors>
|
||||
<ToolkitBehaviors:Fade x:Name="ShowActionButtons" Duration="250" Delay="0" AutomaticallyStart="False" Value="1" />
|
||||
@@ -478,7 +476,7 @@
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</AutoSuggestBox.ItemTemplate>
|
||||
</AutoSuggestBox>
|
||||
|
||||
@@ -1,17 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace PowerLauncher.UI
|
||||
{
|
||||
@@ -20,7 +7,7 @@ namespace PowerLauncher.UI
|
||||
public LauncherControl()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ShellBarShadow.Receivers.Add(ShadowReceiverGrid);
|
||||
ShellBarShadow.Receivers.Add(ShadowReceiverGrid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using Microsoft.Toolkit.Wpf.UI.XamlHost;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using System.Diagnostics;
|
||||
using Wox.Plugin;
|
||||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace PowerLauncher
|
||||
{
|
||||
@@ -133,6 +136,8 @@ namespace PowerLauncher
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
private void OnDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
@@ -256,9 +261,8 @@ namespace PowerLauncher
|
||||
_launcher = (PowerLauncher.UI.LauncherControl)host.Child;
|
||||
_launcher.DataContext = _viewModel;
|
||||
_launcher.SearchBox.TextChanged += QueryTextBox_TextChanged;
|
||||
|
||||
_launcher.SearchBox.QuerySubmitted += AutoSuggestBox_QuerySubmitted;
|
||||
_launcher.SearchBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
|
||||
|
||||
_viewModel.PropertyChanged += (o, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(MainViewModel.MainWindowVisibility))
|
||||
@@ -277,14 +281,21 @@ namespace PowerLauncher
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
|
||||
{
|
||||
if (args != null && args.ChosenSuggestion != null)
|
||||
{
|
||||
ResultViewModel result = (ResultViewModel)args.ChosenSuggestion;
|
||||
_ = result.Result.Action != null && result.Result.Action(new ActionContext { });
|
||||
}
|
||||
}
|
||||
|
||||
private void QueryTextBox_TextChanged(Windows.UI.Xaml.Controls.AutoSuggestBox sender, Windows.UI.Xaml.Controls.AutoSuggestBoxTextChangedEventArgs args)
|
||||
{
|
||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||
{
|
||||
if (_viewModel.QueryTextCursorMovedToEnd)
|
||||
{
|
||||
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||
}
|
||||
_viewModel.QueryText = sender.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,8 +64,7 @@ namespace Wox.ViewModel
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Result.ToString();
|
||||
return Result.Title.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user