diff --git a/samples/todoapp/TodoApp.Uno/Directory.Packages.props b/samples/todoapp/TodoApp.Uno/Directory.Packages.props index a62098b6..8d2942b8 100644 --- a/samples/todoapp/TodoApp.Uno/Directory.Packages.props +++ b/samples/todoapp/TodoApp.Uno/Directory.Packages.props @@ -10,10 +10,11 @@ + - \ No newline at end of file + diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln b/samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln index cc4fa640..9f27162b 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno.sln @@ -14,10 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution global.json = global.json EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "library", "library", "{0AAB65A5-8A90-47AF-AAED-AF27E82D50A4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Datasync.Client", "..\..\..\src\CommunityToolkit.Datasync.Client\CommunityToolkit.Datasync.Client.csproj", "{2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,17 +26,10 @@ Global {5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.Build.0 = Release|Any CPU {5FD4876C-302E-42DF-B28B-55035009E545}.Release|Any CPU.Deploy.0 = Release|Any CPU - {2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2D6F113F-D3A1-43A5-BF57-E72E5D5F5963}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {2D6F113F-D3A1-43A5-BF57-E72E5D5F5963} = {0AAB65A5-8A90-47AF-AAED-AF27E82D50A4} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EA315B6A-4F6C-4482-A88B-61900C1B6934} EndGlobalSection diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/Services/LoggingHandler.cs b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/Services/LoggingHandler.cs index 67eac603..278e5a30 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/Services/LoggingHandler.cs +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/Services/LoggingHandler.cs @@ -29,12 +29,18 @@ public LoggingHandler(HttpMessageHandler innerHandler) : base(innerHandler) protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { Debug.WriteLine($"[HTTP] >>> {request.Method} {request.RequestUri}"); - await WriteContentAsync(request.Content, cancellationToken); + if (request.Content is not null) + { + await WriteContentAsync(request.Content, cancellationToken); + } HttpResponseMessage response = await base.SendAsync(request, cancellationToken); Debug.WriteLine($"[HTTP] <<< {response.StatusCode} {response.ReasonPhrase}"); - await WriteContentAsync(response.Content, cancellationToken); + if (response.Content is not null) + { + await WriteContentAsync(response.Content, cancellationToken); + } return response; } diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj index f8517896..04ebfc7c 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj @@ -40,7 +40,7 @@ Navigation; True - + @@ -54,15 +54,13 @@ - - - + diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoItemViewModel.cs b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoItemViewModel.cs index bfd471af..3a7e4b75 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoItemViewModel.cs +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoItemViewModel.cs @@ -1,47 +1,42 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using TodoApp.Uno.Database; -namespace TodoApp.Uno.ViewModels +#nullable disable + +namespace TodoApp.Uno.ViewModels; + +public partial class TodoItemViewModel(TodoItem todoItem) : ObservableObject { - public partial class TodoItemViewModel(TodoItem todoItem) : ObservableObject + public readonly TodoItem _todoItem = todoItem; + + public string Title + { + get => _todoItem.Title; + set => SetProperty(_todoItem.Title, value, _todoItem, (item, value) => item.Title = value); + } + + public bool IsComplete + { + get => _todoItem.IsComplete; + set => SetProperty(_todoItem.IsComplete, value, _todoItem, (item, value) => item.IsComplete = value); + } + + public string Version + { + get => _todoItem.Version; + set => SetProperty(_todoItem.Version, value, _todoItem, (item, value) => item.Version = value); + } + + public string Id => _todoItem.Id; + + public DateTimeOffset? UpdatedAt + { + get => _todoItem.UpdatedAt; + set => SetProperty(_todoItem.UpdatedAt, value, _todoItem, (item, value) => item.UpdatedAt = value); + } + + public bool Deleted { - public readonly TodoItem _todoItem = todoItem; - - public string Title - { - get => _todoItem.Title; - set => SetProperty(_todoItem.Title, value, _todoItem, (item, value) => item.Title = value); - } - - public bool IsComplete - { - get => _todoItem.IsComplete; - set => SetProperty(_todoItem.IsComplete, value, _todoItem, (item, value) => item.IsComplete = value); - } - - public string Version - { - get => _todoItem.Version; - set => SetProperty(_todoItem.Version, value, _todoItem, (item, value) => item.Version = value); - } - - public string Id => _todoItem.Id; - - public DateTimeOffset? UpdatedAt - { - get => _todoItem.UpdatedAt; - set => SetProperty(_todoItem.UpdatedAt, value, _todoItem, (item, value) => item.UpdatedAt = value); - } - - public bool Deleted - { - get => _todoItem.Deleted; - set => SetProperty(_todoItem.Deleted, value, _todoItem, (item, value) => item.Deleted = value); - } + get => _todoItem.Deleted; + set => SetProperty(_todoItem.Deleted, value, _todoItem, (item, value) => item.Deleted = value); } } diff --git a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs index c39f2d9d..cc6ee471 100644 --- a/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs +++ b/samples/todoapp/TodoApp.Uno/TodoApp.Uno/ViewModels/TodoListViewModel.cs @@ -2,16 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; using CommunityToolkit.Datasync.Client; -using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; using Microsoft.EntityFrameworkCore; using TodoApp.Uno.Database; +#nullable disable + namespace TodoApp.Uno.ViewModels; ///