mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
Merge branch 'dev/feature/projects' of https://github.com/microsoft/PowerToys into dev/feature/projects
This commit is contained in:
@@ -178,8 +178,12 @@
|
||||
<Border Background="{DynamicResource SecondaryBackgroundBrush}"
|
||||
HorizontalAlignment="Stretch"
|
||||
CornerRadius="5">
|
||||
<DockPanel HorizontalAlignment="Stretch">
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Margin="12,14,10,10">
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="12,14,10,10">
|
||||
<TextBlock
|
||||
Text="{Binding Name, Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
|
||||
FontSize="16"
|
||||
@@ -210,7 +214,7 @@
|
||||
<TextBlock Text="{Binding LastLaunched, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Vertical" DockPanel.Dock="Left" Margin="12,12,12,12">
|
||||
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="12,12,12,12">
|
||||
<StackPanel
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
@@ -259,7 +263,7 @@
|
||||
BorderThickness="1"
|
||||
Click="LaunchButton_Click"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Button>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -176,7 +176,8 @@ namespace ProjectsEditor.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
return Applications.Where(x => x.IsSelected).Count().ToString(CultureInfo.InvariantCulture) + " apps";
|
||||
int count = Applications.Where(x => x.IsSelected).Count();
|
||||
return count.ToString(CultureInfo.InvariantCulture) + " " + (count == 1 ? Properties.Resources.App : Properties.Resources.Apps);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace ProjectsEditor.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to app.
|
||||
/// </summary>
|
||||
public static string App {
|
||||
get {
|
||||
return ResourceManager.GetString("App", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to App name.
|
||||
/// </summary>
|
||||
@@ -69,6 +78,15 @@ namespace ProjectsEditor.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to apps.
|
||||
/// </summary>
|
||||
public static string Apps {
|
||||
get {
|
||||
return ResourceManager.GetString("Apps", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Are you sure?.
|
||||
/// </summary>
|
||||
|
||||
@@ -117,6 +117,12 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="App" xml:space="preserve">
|
||||
<value>app</value>
|
||||
</data>
|
||||
<data name="Apps" xml:space="preserve">
|
||||
<value>apps</value>
|
||||
</data>
|
||||
<data name="App_name" xml:space="preserve">
|
||||
<value>App name</value>
|
||||
</data>
|
||||
|
||||
@@ -8,12 +8,10 @@ using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ManagedCommon;
|
||||
using ProjectsEditor.Models;
|
||||
using ProjectsEditor.Utils;
|
||||
@@ -31,7 +29,7 @@ namespace ProjectsEditor.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
IEnumerable<Project> projects = string.IsNullOrEmpty(_searchTerm) ? Projects : Projects.Where(x => x.Name.Contains(_searchTerm, StringComparison.InvariantCultureIgnoreCase));
|
||||
IEnumerable<Project> projects = GetFilteredProjects();
|
||||
if (projects == null)
|
||||
{
|
||||
return Enumerable.Empty<Project>();
|
||||
@@ -53,6 +51,30 @@ namespace ProjectsEditor.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
// return those projects where the project name or any of the selected apps' name contains the search term
|
||||
private IEnumerable<Project> GetFilteredProjects()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_searchTerm))
|
||||
{
|
||||
return Projects;
|
||||
}
|
||||
|
||||
return Projects.Where(x =>
|
||||
{
|
||||
if (x.Name.Contains(_searchTerm, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (x.Applications == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return x.Applications.Any(app => app.IsSelected && app.AppName.Contains(_searchTerm, StringComparison.InvariantCultureIgnoreCase));
|
||||
});
|
||||
}
|
||||
|
||||
private string _searchTerm;
|
||||
|
||||
public string SearchTerm
|
||||
|
||||
Reference in New Issue
Block a user