Merge pull request #52 from zadjii-msft/joadoumie/modify-template

tweaking template
This commit is contained in:
Jordi Adoumie
2024-09-13 10:14:47 -07:00
committed by GitHub
4 changed files with 69 additions and 53 deletions

View File

@@ -0,0 +1,30 @@
// 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 Microsoft.CmdPal.Extensions;
using Microsoft.CmdPal.Extensions.Helpers;
namespace TemplateExtension;
internal sealed partial class TemplateExtensionPage : ListPage
{
public TemplateExtensionPage()
{
Icon = new(string.Empty);
Name = "TemplateDisplayName";
}
public override ISection[] GetItems()
{
return [
new ListSection()
{
Items = [
new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" }
],
}
];
}
}

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\..\Common.Dotnet.CsWinRT.props" />
<PropertyGroup>
<OutputType>WinExe</OutputType>
@@ -36,6 +36,11 @@
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<Folder Include="Data\" />
<Folder Include="Forms\" />
<Folder Include="Commands\" />
</ItemGroup>
<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution

View File

@@ -0,0 +1,33 @@
// 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.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CmdPal.Extensions;
using Microsoft.CmdPal.Extensions.Helpers;
namespace TemplateExtension;
public partial class TemplateExtensionActionsProvider : ICommandProvider
{
public string DisplayName => $"TemplateDisplayName Commands";
public IconDataType Icon => new(string.Empty);
private readonly IListItem[] _commands = [
new ListItem(new TemplateExtensionPage()),
];
#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
public void Dispose() => throw new NotImplementedException();
#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize
public IListItem[] TopLevelCommands()
{
return _commands;
}
}

View File

@@ -1,52 +0,0 @@
// 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 Microsoft.CmdPal.Extensions;
using Microsoft.CmdPal.Extensions.Helpers;
namespace TemplateExtension;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "This is sample code")]
internal sealed partial class TemplateExtensionPage : ListPage
{
public TemplateExtensionPage()
{
Icon = new(string.Empty);
Name = "TemplateDisplayName";
}
public override ISection[] GetItems()
{
return [
new ListSection()
{
Items = [
new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" }
],
}
];
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "This is sample code")]
public partial class TemplateExtensionActionsProvider : ICommandProvider
{
public string DisplayName => $"TemplateDisplayName Commands";
public IconDataType Icon => new(string.Empty);
private readonly IListItem[] _actions = [
new ListItem(new TemplateExtensionPage()),
];
#pragma warning disable CA1816 // Dispose methods should call SuppressFinalize
public void Dispose() => throw new NotImplementedException();
#pragma warning restore CA1816 // Dispose methods should call SuppressFinalize
public IListItem[] TopLevelCommands()
{
return _actions;
}
}