Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new Microsoft.PowerPlatform.PowerApps.Persistence project #513

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

internal static class BuiltInTemplatesUris
{
public static readonly Uri Screen = new("http://microsoft.com/appmagic/screen#screen");
public static readonly Uri Button = new("http://microsoft.com/appmagic/button#button");
public static readonly Uri Label = new("http://microsoft.com/appmagic/label#label");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

[FirstClass(Template)]
internal record Button : Control
{
internal const string Template = "Button";
public Button()
{
ControlUri = BuiltInTemplatesUris.Button;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

//TODO: abstract?
internal record Control
{
// TODO: rename to "Control" in yaml
// TODO: make this a string and handle parsing/matchin later
/// <summary>
/// template uri of the control.
/// </summary>
public Uri? ControlUri { get; init; }

/// <summary>
/// the control's name.
/// </summary>
public string? Name { get; init; }

/// <summary>
/// key/value pairs of Control properties. Mapped to/from Control rules.
/// </summary>
public IReadOnlyDictionary<string, string>? Properties { get; init; }

/// <summary>
/// list of child controls nested under this control.
/// </summary>
public Control[]? Controls { get; init; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

// TODO
//internal sealed record ControlProperty
//{
// public string Name { get; init; }

// public string? Value { get; init; }

// public bool IsFormula { get; init; }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

internal record CustomControl : Control;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
internal class FirstClassAttribute : Attribute
{
public FirstClassAttribute(string? nodeName = null)
{
NodeName = nodeName ?? string.Empty;
}
public string NodeName { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

[FirstClass(Template)]
internal record Label : Control
{
internal const string Template = "Label";
public Label()
{
ControlUri = BuiltInTemplatesUris.Label;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.PowerPlatform.PowerApps.Persistence.Models;

[FirstClass(Template)]
internal record Screen : Control
{
internal const string Template = "Screen";
public Screen()
{
ControlUri = BuiltInTemplatesUris.Screen;
}
}
6 changes: 6 additions & 0 deletions src/PASopa.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\.editorconfig = ..\.editorconfig
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerPlatform.PowerApps.Persistence", "Microsoft.PowerPlatform.PowerApps.Persistence\Microsoft.PowerPlatform.PowerApps.Persistence.csproj", "{906B4EA5-F287-4D0E-A511-0D89B2DD9C14}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -34,6 +36,10 @@ Global
{8AD94CC0-7330-4880-A8E0-177B37CDB27B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AD94CC0-7330-4880-A8E0-177B37CDB27B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AD94CC0-7330-4880-A8E0-177B37CDB27B}.Release|Any CPU.Build.0 = Release|Any CPU
{906B4EA5-F287-4D0E-A511-0D89B2DD9C14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{906B4EA5-F287-4D0E-A511-0D89B2DD9C14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{906B4EA5-F287-4D0E-A511-0D89B2DD9C14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{906B4EA5-F287-4D0E-A511-0D89B2DD9C14}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down