mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-03 03:19:08 +08:00
Started porting functionality
This commit is contained in:
parent
73bd2dbfb2
commit
e23e98e2aa
@ -13,6 +13,7 @@
|
||||
IsResizable="True"
|
||||
IsShownInSwitchers="True"
|
||||
IsTitleBarVisible="True"
|
||||
Title="{x:Bind p:Resources.FileLocksmithTitle}"
|
||||
mc:Ignorable="d">
|
||||
<winuiex:WindowEx.Backdrop>
|
||||
<winuiex:AcrylicSystemBackdrop
|
||||
@ -25,4 +26,14 @@
|
||||
LightTintColor="#FCFCFC"
|
||||
LightTintOpacity="0" />
|
||||
</winuiex:WindowEx.Backdrop>
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid>
|
||||
<Button Margin="8,8,8,0" Click="OnRefreshClick" HorizontalAlignment="Right">Refresh</Button>
|
||||
</Grid>
|
||||
<ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<StackPanel x:Name="stackPanel" Orientation="Vertical"/>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
|
||||
</winuiex:WindowEx>
|
||||
|
@ -3,6 +3,8 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
@ -11,6 +13,7 @@ using Microsoft.UI.Xaml.Automation.Provider;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using PowerToys.FileLocksmithUI.Properties;
|
||||
using Windows.Graphics;
|
||||
using WinUIEx;
|
||||
|
||||
@ -26,6 +29,26 @@ namespace FileLocksmithUI
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnRefreshClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StartFindingProcesses();
|
||||
}
|
||||
|
||||
private void StartFindingProcesses()
|
||||
{
|
||||
Thread thread = new Thread(FindProcesses);
|
||||
thread.Start();
|
||||
}
|
||||
|
||||
private void FindProcesses()
|
||||
{
|
||||
DispatcherQueue.TryEnqueue(() =>
|
||||
{
|
||||
// Mock
|
||||
stackPanel.Children.Add(new ProcessEntry("WindowsTerminal.exe", 123456, 1));
|
||||
});
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
36
src/modules/FileLocksmith/FileLocksmithUI/ProcessEntry.xaml
Normal file
36
src/modules/FileLocksmith/FileLocksmithUI/ProcessEntry.xaml
Normal file
@ -0,0 +1,36 @@
|
||||
<UserControl
|
||||
x:Class="FileLocksmithUI.ProcessEntry"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:FileLocksmithUI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Expander Margin="8,8,8,0" HorizontalAlignment="Stretch">
|
||||
<Expander.Header>
|
||||
<Grid>
|
||||
<BitmapIcon Name="processIcon"></BitmapIcon>
|
||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
|
||||
<TextBlock Margin="4" FontSize="28" Name="processName"/>
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.25*"/>
|
||||
<ColumnDefinition Width="0.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Margin="4" FontSize="12" Name="processPid" HorizontalAlignment="Left"/>
|
||||
<TextBlock Grid.Column="1" Margin="4" FontSize="12" Name="processFileCount" HorizontalAlignment="Left"/>
|
||||
<TextBlock Grid.Column="2" Margin="4" FontSize="12" Name="processUser" HorizontalAlignment="Left"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Button Margin="4" Click="KillProcessClick" HorizontalAlignment="Right">End Task</Button>
|
||||
</Grid>
|
||||
</Expander.Header>
|
||||
<Expander.Content>
|
||||
<StackPanel Margin="4" Orientation="Vertical" Name="filesContainer"/>
|
||||
</Expander.Content>
|
||||
</Expander>
|
||||
|
||||
</UserControl>
|
@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Automation.Peers;
|
||||
using Microsoft.UI.Xaml.Automation.Provider;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using PowerToys.FileLocksmithUI.Properties;
|
||||
using Windows.Graphics;
|
||||
using WinUIEx;
|
||||
|
||||
namespace FileLocksmithUI
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty window that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class ProcessEntry : UserControl
|
||||
{
|
||||
public ProcessEntry(string process, uint pid, ulong numFiles)
|
||||
{
|
||||
InitializeComponent();
|
||||
processName.Text = process;
|
||||
|
||||
processPid.Text = PowerToys.FileLocksmithUI.Properties.Resources.ProcessId + ": " + pid;
|
||||
processFileCount.Text = PowerToys.FileLocksmithUI.Properties.Resources.FilesUsed + ": " + numFiles;
|
||||
processUser.Text = PowerToys.FileLocksmithUI.Properties.Resources.User + ": " + "<TODO PID TO USER>";
|
||||
}
|
||||
|
||||
private void KillProcessClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
}
|
@ -61,38 +61,38 @@ namespace PowerToys.FileLocksmithUI.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bounds.
|
||||
/// Looks up a localized string similar to File Locksmith.
|
||||
/// </summary>
|
||||
public static string Bounds {
|
||||
public static string FileLocksmithTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("Bounds", resourceCulture);
|
||||
return ResourceManager.GetString("FileLocksmithTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Horizontal spacing.
|
||||
/// Looks up a localized string similar to Files used.
|
||||
/// </summary>
|
||||
public static string HorizontalSpacing {
|
||||
public static string FilesUsed {
|
||||
get {
|
||||
return ResourceManager.GetString("HorizontalSpacing", resourceCulture);
|
||||
return ResourceManager.GetString("FilesUsed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Spacing.
|
||||
/// Looks up a localized string similar to Process ID.
|
||||
/// </summary>
|
||||
public static string Spacing {
|
||||
public static string ProcessId {
|
||||
get {
|
||||
return ResourceManager.GetString("Spacing", resourceCulture);
|
||||
return ResourceManager.GetString("ProcessId", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Vertical spacing.
|
||||
/// Looks up a localized string similar to User.
|
||||
/// </summary>
|
||||
public static string VerticalSpacing {
|
||||
public static string User {
|
||||
get {
|
||||
return ResourceManager.GetString("VerticalSpacing", resourceCulture);
|
||||
return ResourceManager.GetString("User", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,16 +117,20 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Bounds" xml:space="preserve">
|
||||
<value>Bounds</value>
|
||||
<data name="FileLocksmithTitle" xml:space="preserve">
|
||||
<value>File Locksmith</value>
|
||||
<comment>Name of this PowerToy</comment>
|
||||
</data>
|
||||
<data name="Spacing" xml:space="preserve">
|
||||
<value>Spacing</value>
|
||||
<data name="FilesUsed" xml:space="preserve">
|
||||
<value>Files used</value>
|
||||
<comment>Number of files used, this is followed by a colon and a number</comment>
|
||||
</data>
|
||||
<data name="HorizontalSpacing" xml:space="preserve">
|
||||
<value>Horizontal spacing</value>
|
||||
<data name="ProcessId" xml:space="preserve">
|
||||
<value>Process ID</value>
|
||||
<comment>An operating system wide numerical identifier of the process, also known as PID</comment>
|
||||
</data>
|
||||
<data name="VerticalSpacing" xml:space="preserve">
|
||||
<value>Vertical spacing</value>
|
||||
<data name="User" xml:space="preserve">
|
||||
<value>User</value>
|
||||
<comment>Username of the Windows user running this process</comment>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user