mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +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}"
|
<Border Background="{DynamicResource SecondaryBackgroundBrush}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
CornerRadius="5">
|
CornerRadius="5">
|
||||||
<DockPanel HorizontalAlignment="Stretch">
|
<Grid HorizontalAlignment="Stretch">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" Margin="12,14,10,10">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="120" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Left" Margin="12,14,10,10">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Text="{Binding Name, Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
|
Text="{Binding Name, Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
@@ -210,7 +214,7 @@
|
|||||||
<TextBlock Text="{Binding LastLaunched, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
|
<TextBlock Text="{Binding LastLaunched, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</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
|
<StackPanel
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
HorizontalAlignment="Right">
|
HorizontalAlignment="Right">
|
||||||
@@ -259,7 +263,7 @@
|
|||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
Click="LaunchButton_Click"/>
|
Click="LaunchButton_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Button>
|
</Button>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ namespace ProjectsEditor.Models
|
|||||||
{
|
{
|
||||||
get
|
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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to App name.
|
/// Looks up a localized string similar to App name.
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Are you sure?.
|
/// Looks up a localized string similar to Are you sure?.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -117,6 +117,12 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</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">
|
<data name="App_name" xml:space="preserve">
|
||||||
<value>App name</value>
|
<value>App name</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ using System.Collections.ObjectModel;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
using ProjectsEditor.Models;
|
using ProjectsEditor.Models;
|
||||||
using ProjectsEditor.Utils;
|
using ProjectsEditor.Utils;
|
||||||
@@ -31,7 +29,7 @@ namespace ProjectsEditor.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
IEnumerable<Project> projects = string.IsNullOrEmpty(_searchTerm) ? Projects : Projects.Where(x => x.Name.Contains(_searchTerm, StringComparison.InvariantCultureIgnoreCase));
|
IEnumerable<Project> projects = GetFilteredProjects();
|
||||||
if (projects == null)
|
if (projects == null)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<Project>();
|
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;
|
private string _searchTerm;
|
||||||
|
|
||||||
public string SearchTerm
|
public string SearchTerm
|
||||||
|
|||||||
Reference in New Issue
Block a user