Added a Toolkit.WinUI project
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Toolkit.WinUI;
|
||||
|
||||
public class DispatcherTimer :
|
||||
IDispatcherTimer
|
||||
{
|
||||
private readonly System.Windows.Threading.DispatcherTimer timer;
|
||||
private readonly Action actionDelegate;
|
||||
|
||||
public DispatcherTimer(Action actionDelegate, TimeSpan interval)
|
||||
{
|
||||
timer = new System.Windows.Threading.DispatcherTimer
|
||||
{
|
||||
Interval = interval
|
||||
};
|
||||
|
||||
timer.Tick += OnTick;
|
||||
this.actionDelegate = actionDelegate;
|
||||
}
|
||||
|
||||
private void OnTick(object? sender, EventArgs args) =>
|
||||
actionDelegate?.Invoke();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
timer.Stop();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Toolkit.WinUI;
|
||||
|
||||
public class DispatcherTimerFactory :
|
||||
IDispatcherTimerFactory
|
||||
{
|
||||
public IDispatcherTimer Create(Action actionDelegate, TimeSpan interval) =>
|
||||
new DispatcherTimer(actionDelegate, interval);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<RootNamespace>Toolkit.WinUI</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">
|
||||
win-x86;win-x64;win-arm64
|
||||
</RuntimeIdentifiers>
|
||||
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) < 8">
|
||||
win10-x86;win10-x64;win10-arm64
|
||||
</RuntimeIdentifiers>
|
||||
<UseWinUI>true</UseWinUI>
|
||||
<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Toolkit.Foundation\Toolkit.Foundation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user