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

Adding appservices library #273

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
6 changes: 6 additions & 0 deletions src/Nightingale.DesktopExtension/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
10 changes: 10 additions & 0 deletions src/Nightingale.DesktopExtension/ITestAppService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using CommunityToolkit.AppServices;
using System.Threading.Tasks;

namespace Nightingale.DesktopExtension;

[AppService("NightingaleAppService")]
public interface ITestAppService
{
Task<int> SumAsync(int x, int y);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Nightingale.DesktopExtension</RootNamespace>
<AssemblyName>Nightingale.DesktopExtension</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ITestAppService.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestAppService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Labs.AppServices">
<Version>0.1.240123-build.1621</Version>
</PackageReference>
<PackageReference Include="PolySharp">
<Version>1.14.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
17 changes: 17 additions & 0 deletions src/Nightingale.DesktopExtension/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using CommunityToolkit.AppServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nightingale.DesktopExtension
{
internal class Program
{
static async Task Main(string[] args)
{
await AppServiceComponent.RunAsync<TestAppService>();
}
}
}
36 changes: 36 additions & 0 deletions src/Nightingale.DesktopExtension/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Nightingale.DesktopExtension")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Nightingale.DesktopExtension")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ab9d98c3-83fd-48b2-a1ed-305064a3c3d4")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
11 changes: 11 additions & 0 deletions src/Nightingale.DesktopExtension/TestAppService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Threading.Tasks;

namespace Nightingale.DesktopExtension;

public sealed partial class TestAppService : ITestAppService
{
public async Task<int> SumAsync(int x, int y)
{
return x + y;
}
}
5 changes: 5 additions & 0 deletions src/Nightingale/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public App()
ThemeController.ThemeChanged += ThemeController_ThemeChanged;
}

protected override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
}

private void ThemeController_ThemeChanged(object sender, EventArgs e)
{
if (Window.Current.Content is Frame rootFrame)
Expand Down
6 changes: 6 additions & 0 deletions src/Nightingale/Views/MainPage2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -386,5 +386,11 @@
x:Load="{x:Bind ViewModel.Loading, Mode=OneWay}"
IsActive="true"
Style="{StaticResource LargeProgressRing}" />

<Button
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="OnClick"
Content="Run test" />
</Grid>
</Page>
6 changes: 6 additions & 0 deletions src/Nightingale/Views/MainPage2.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ private void SetBackground(string imageName)
Stretch = Stretch.UniformToFill
};
}

private async void OnClick(object sender, RoutedEventArgs e)
{
//var x = await App.TestAppService.SumAsync(1, 2);
//Debug.WriteLine(x);
}
}

/// <summary>
Expand Down
8 changes: 6 additions & 2 deletions src/Package/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
xmlns:iot2="http://schemas.microsoft.com/appx/manifest/iot/windows10/2"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
IgnorableNamespaces="uap rescap desktop4 iot2">
IgnorableNamespaces="uap desktop rescap desktop4 iot2">

<Identity
Name="75bf4b83-a7ae-402f-87cb-67e9fcb743a6"
Expand Down Expand Up @@ -59,7 +59,11 @@
<desktop:ParameterGroup GroupId="ServerGroup" Parameters="/Server"/>
</desktop:FullTrustProcess>
</desktop:Extension>
<uap:Extension Category="windows.fileTypeAssociation">
<desktop:Extension Category="windows.fullTrustProcess" Executable="Nightingale.DesktopExtension\Nightingale.DesktopExtension.exe"/>
<uap:Extension Category="windows.appService">
<uap:AppService Name="NightingaleAppService" />
</uap:Extension>
<uap:Extension Category="windows.fileTypeAssociation">
<uap:FileTypeAssociation Name="ncf">
<uap:SupportedFileTypes>
<uap:FileType ContentType="application/json">.ncf</uap:FileType>
Expand Down
1 change: 1 addition & 0 deletions src/Package/Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<ItemGroup>
<ProjectReference Include="..\FullTrust\FullTrust.csproj" />
<ProjectReference Include="..\LocalServer\LocalServer.csproj" />
<ProjectReference Include="..\Nightingale.DesktopExtension\Nightingale.DesktopExtension.csproj" />
<ProjectReference Include="..\Nightingale\Nightingale.csproj" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
Expand Down
26 changes: 24 additions & 2 deletions src/nightingale.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.352
# Visual Studio Version 17
VisualStudioVersion = 17.8.34408.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nightingale", "Nightingale\Nightingale.csproj", "{4AE08123-B5E6-449E-BED5-7C7FD04EF1B1}"
EndProject
Expand All @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoreTests", "CoreTests\Core
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalServer", "LocalServer\LocalServer.csproj", "{2FFD5420-80F1-4DE7-B6FE-A49A7F88E595}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nightingale.DesktopExtension", "Nightingale.DesktopExtension\Nightingale.DesktopExtension.csproj", "{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -157,6 +159,26 @@ Global
{2FFD5420-80F1-4DE7-B6FE-A49A7F88E595}.Release|x64.Build.0 = Release|Any CPU
{2FFD5420-80F1-4DE7-B6FE-A49A7F88E595}.Release|x86.ActiveCfg = Release|Any CPU
{2FFD5420-80F1-4DE7-B6FE-A49A7F88E595}.Release|x86.Build.0 = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|ARM.Build.0 = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|ARM64.Build.0 = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|x64.ActiveCfg = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|x64.Build.0 = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|x86.ActiveCfg = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Debug|x86.Build.0 = Debug|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|Any CPU.Build.0 = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|ARM.ActiveCfg = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|ARM.Build.0 = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|ARM64.ActiveCfg = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|ARM64.Build.0 = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|x64.ActiveCfg = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|x64.Build.0 = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|x86.ActiveCfg = Release|Any CPU
{AB9D98C3-83FD-48B2-A1ED-305064A3C3D4}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
16 changes: 8 additions & 8 deletions src/nuget.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="toolkit-labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="toolkit-labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
</packageSources>
</configuration>