Skip to content

Commit 9eb02ee

Browse files
authored
(#294) Client package uses NuGet (#300)
1 parent f680cc4 commit 9eb02ee

File tree

6 files changed

+50
-65
lines changed

6 files changed

+50
-65
lines changed

samples/todoapp/TodoApp.Uno/Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
<ItemGroup>
1111
<PackageVersion Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240916" />
1212
<PackageVersion Include="CommunityToolkit.WinUI.Converters" Version="8.1.240916" />
13+
<PackageVersion Include="CommunityToolkit.Datasync.Client" Version="9.0.0" />
1314
<PackageVersion Include="Refit" Version="8.0.0" />
1415
<PackageVersion Include="System.Formats.Asn1" Version="9.0.0" />
1516
<PackageVersion Include="System.IO.Packaging" Version="9.0.0" />
1617
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
1718
<PackageVersion Include="System.Text.Json" Version="9.0.2" />
1819
</ItemGroup>
19-
</Project>
20+
</Project>

samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1414
global.json = global.json
1515
EndProjectSection
1616
EndProject
17-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "library", "library", "{0AAB65A5-8A90-47AF-AAED-AF27E82D50A4}"
18-
EndProject
19-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Datasync.Client", "..\..\..\src\CommunityToolkit.Datasync.Client\CommunityToolkit.Datasync.Client.csproj", "{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}"
20-
EndProject
2117
Global
2218
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2319
Debug|Any CPU = Debug|Any CPU
@@ -30,17 +26,10 @@ Global
3026
{5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.ActiveCfg = Release|Any CPU
3127
{5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.Build.0 = Release|Any CPU
3228
{5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.Deploy.0 = Release|Any CPU
33-
{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
34-
{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Debug|Any CPU.Build.0 = Debug|Any CPU
35-
{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Release|Any CPU.ActiveCfg = Release|Any CPU
36-
{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Release|Any CPU.Build.0 = Release|Any CPU
3729
EndGlobalSection
3830
GlobalSection(SolutionProperties) = preSolution
3931
HideSolutionNode = FALSE
4032
EndGlobalSection
41-
GlobalSection(NestedProjects) = preSolution
42-
{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963} = {0AAB65A5-8A90-47AF-AAED-AF27E82D50A4}
43-
EndGlobalSection
4433
GlobalSection(ExtensibilityGlobals) = postSolution
4534
SolutionGuid = {EA315B6A-4F6C-4482-A88B-61900C1B6934}
4635
EndGlobalSection

samples/todoapp/TodoApp.Uno/TodoApp.Uno/Services/LoggingHandler.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,18 @@ public LoggingHandler(HttpMessageHandler innerHandler) : base(innerHandler)
2929
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
3030
{
3131
Debug.WriteLine($"[HTTP] >>> {request.Method} {request.RequestUri}");
32-
await WriteContentAsync(request.Content, cancellationToken);
32+
if (request.Content is not null)
33+
{
34+
await WriteContentAsync(request.Content, cancellationToken);
35+
}
3336

3437
HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
3538

3639
Debug.WriteLine($"[HTTP] <<< {response.StatusCode} {response.ReasonPhrase}");
37-
await WriteContentAsync(response.Content, cancellationToken);
40+
if (response.Content is not null)
41+
{
42+
await WriteContentAsync(response.Content, cancellationToken);
43+
}
3844

3945
return response;
4046
}

samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
Navigation;
4141
</UnoFeatures>
4242
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
43-
43+
4444
</PropertyGroup>
4545
<ItemGroup>
4646
<None Remove="Assets\AddItem.png" />
@@ -54,15 +54,13 @@
5454
<None Remove="Assets\Wide310x150Logo.scale-200.png" />
5555
<None Remove="Views\TodoListPage.xaml" />
5656
</ItemGroup>
57-
<ItemGroup>
58-
<ProjectReference Include="..\..\..\..\src\CommunityToolkit.Datasync.Client\CommunityToolkit.Datasync.Client.csproj" />
59-
</ItemGroup>
6057
<ItemGroup>
6158
<UpToDateCheckInput Remove="Views\TodoListPage.xaml" />
6259
</ItemGroup>
6360
<ItemGroup>
6461
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" />
6562
<PackageReference Include="CommunityToolkit.WinUI.Converters" />
63+
<PackageReference Include="CommunityToolkit.Datasync.Client" />
6664
<PackageReference Include="System.Formats.Asn1" />
6765
<PackageReference Include="System.IO.Packaging" />
6866
<PackageReference Include="System.Private.Uri" />
Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,42 @@
1-
using CommunityToolkit.Mvvm.ComponentModel;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
71
using TodoApp.Uno.Database;
82

9-
namespace TodoApp.Uno.ViewModels
3+
#nullable disable
4+
5+
namespace TodoApp.Uno.ViewModels;
6+
7+
public partial class TodoItemViewModel(TodoItem todoItem) : ObservableObject
108
{
11-
public partial class TodoItemViewModel(TodoItem todoItem) : ObservableObject
9+
public readonly TodoItem _todoItem = todoItem;
10+
11+
public string Title
12+
{
13+
get => _todoItem.Title;
14+
set => SetProperty(_todoItem.Title, value, _todoItem, (item, value) => item.Title = value);
15+
}
16+
17+
public bool IsComplete
18+
{
19+
get => _todoItem.IsComplete;
20+
set => SetProperty(_todoItem.IsComplete, value, _todoItem, (item, value) => item.IsComplete = value);
21+
}
22+
23+
public string Version
24+
{
25+
get => _todoItem.Version;
26+
set => SetProperty(_todoItem.Version, value, _todoItem, (item, value) => item.Version = value);
27+
}
28+
29+
public string Id => _todoItem.Id;
30+
31+
public DateTimeOffset? UpdatedAt
32+
{
33+
get => _todoItem.UpdatedAt;
34+
set => SetProperty(_todoItem.UpdatedAt, value, _todoItem, (item, value) => item.UpdatedAt = value);
35+
}
36+
37+
public bool Deleted
1238
{
13-
public readonly TodoItem _todoItem = todoItem;
14-
15-
public string Title
16-
{
17-
get => _todoItem.Title;
18-
set => SetProperty(_todoItem.Title, value, _todoItem, (item, value) => item.Title = value);
19-
}
20-
21-
public bool IsComplete
22-
{
23-
get => _todoItem.IsComplete;
24-
set => SetProperty(_todoItem.IsComplete, value, _todoItem, (item, value) => item.IsComplete = value);
25-
}
26-
27-
public string Version
28-
{
29-
get => _todoItem.Version;
30-
set => SetProperty(_todoItem.Version, value, _todoItem, (item, value) => item.Version = value);
31-
}
32-
33-
public string Id => _todoItem.Id;
34-
35-
public DateTimeOffset? UpdatedAt
36-
{
37-
get => _todoItem.UpdatedAt;
38-
set => SetProperty(_todoItem.UpdatedAt, value, _todoItem, (item, value) => item.UpdatedAt = value);
39-
}
40-
41-
public bool Deleted
42-
{
43-
get => _todoItem.Deleted;
44-
set => SetProperty(_todoItem.Deleted, value, _todoItem, (item, value) => item.Deleted = value);
45-
}
39+
get => _todoItem.Deleted;
40+
set => SetProperty(_todoItem.Deleted, value, _todoItem, (item, value) => item.Deleted = value);
4641
}
4742
}

samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
6-
using System.Collections.Generic;
7-
using System.Threading;
8-
using System.Threading.Tasks;
95
using CommunityToolkit.Datasync.Client;
10-
using CommunityToolkit.Mvvm.ComponentModel;
11-
using CommunityToolkit.Mvvm.Input;
126
using Microsoft.EntityFrameworkCore;
137
using TodoApp.Uno.Database;
148

9+
#nullable disable
10+
1511
namespace TodoApp.Uno.ViewModels;
1612

1713
/// <summary>

0 commit comments

Comments
 (0)