mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-14 00:06:52 +01:00
dynamic list page example
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
// 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.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.CmdPal.Extensions;
|
||||
using Microsoft.CmdPal.Extensions.Helpers;
|
||||
using Microsoft.UI.Windowing;
|
||||
|
||||
namespace SamplePagesExtension;
|
||||
|
||||
internal sealed class SampleDynamicListPage : DynamicListPage
|
||||
{
|
||||
public SampleDynamicListPage()
|
||||
{
|
||||
Icon = new(string.Empty);
|
||||
Name = "SSH Keychain";
|
||||
}
|
||||
|
||||
public override ISection[] GetItems(string query)
|
||||
{
|
||||
return [
|
||||
new ListSection()
|
||||
{
|
||||
Title = "Sample List Page",
|
||||
Items = [
|
||||
new ListItem(new NoOpCommand()) { Title = string.IsNullOrEmpty(query) ? "dynamic item" : query, Subtitle = "Notice how the title changes for this list item when you type in the filter box" },
|
||||
new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" },
|
||||
new ListItem(new NoOpCommand()) { Title = "This one has a subtitle too", Subtitle = "Example Subtitle" },
|
||||
new ListItem(new NoOpCommand())
|
||||
{
|
||||
Title = "This one has a tag too",
|
||||
Subtitle = "the one with a tag",
|
||||
Tags = [new Tag()
|
||||
{
|
||||
Text = "Sample Tag",
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"profiles": {
|
||||
"SSHKeychainExtension (Package)": {
|
||||
"SamplePagesExtension (Package)": {
|
||||
"commandName": "MsixPackage"
|
||||
},
|
||||
"SSHKeychainExtension (Unpackaged)": {
|
||||
"SamplePagesExtension (Unpackaged)": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,16 @@ public class SamplePagesCommandsProvider : ICommandProvider
|
||||
Title = "Form Page Sample Command",
|
||||
Subtitle = "SamplePages Extension",
|
||||
},
|
||||
new ListItem(new SampleListPageWithDetails())
|
||||
{
|
||||
Title = "List Page With Details Sample Command",
|
||||
Subtitle = "SamplePages Extension",
|
||||
}
|
||||
new ListItem(new SampleListPageWithDetails())
|
||||
{
|
||||
Title = "List Page With Details Sample Command",
|
||||
Subtitle = "SamplePages Extension",
|
||||
},
|
||||
new ListItem(new SampleDynamicListPage())
|
||||
{
|
||||
Title = "Dynamic List Page Command",
|
||||
Subtitle = "SamplePages Extension",
|
||||
}
|
||||
];
|
||||
|
||||
#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
|
||||
|
||||
Reference in New Issue
Block a user