mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
|
|
// 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 Microsoft.CommandPalette.Extensions;
|
|||
|
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
|||
|
|
|
|||
|
|
namespace Microsoft.CmdPal.UI.ViewModels.BuiltinCommands;
|
|||
|
|
|
|||
|
|
public partial class NewExtensionPage : ContentPage
|
|||
|
|
{
|
|||
|
|
private NewExtensionForm _inputForm = new();
|
|||
|
|
private NewExtensionFormBase? _resultForm;
|
|||
|
|
|
|||
|
|
public override IContent[] GetContent()
|
|||
|
|
{
|
|||
|
|
return _resultForm != null ? [_resultForm] : [_inputForm];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public NewExtensionPage()
|
|||
|
|
{
|
|||
|
|
Name = Properties.Resources.builtin_create_extension_name;
|
|||
|
|
Title = Properties.Resources.builtin_create_extension_title;
|
|||
|
|
Icon = new IconInfo("\uEA86"); // Puzzle
|
|||
|
|
|
|||
|
|
_inputForm.FormSubmitted += FormSubmitted;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void FormSubmitted(NewExtensionFormBase sender, NewExtensionFormBase? args)
|
|||
|
|
{
|
|||
|
|
if (_resultForm != null)
|
|||
|
|
{
|
|||
|
|
_resultForm.FormSubmitted -= FormSubmitted;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
_resultForm = args;
|
|||
|
|
if (_resultForm != null)
|
|||
|
|
{
|
|||
|
|
_resultForm.FormSubmitted += FormSubmitted;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
_inputForm = new();
|
|||
|
|
_inputForm.FormSubmitted += FormSubmitted;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RaiseItemsChanged(1);
|
|||
|
|
}
|
|||
|
|
}
|