From fe5ffed338ac1fbeecb37c6a8a23fd124ca9b0ff Mon Sep 17 00:00:00 2001 From: gil zhang Date: Sat, 26 Oct 2024 19:56:44 +0800 Subject: [PATCH] update nuget version --- .../Services/IMicrosoftGraphService.cs | 2 +- .../Verdure.Braincase.Core.csproj | 16 ++--- .../ElectronBot.Braincase.csproj | 2 +- .../Hw75Views/TodoView.xaml | 2 +- .../Services/Graph/MicrosoftGraphService.cs | 26 ++++---- .../ViewModels/Hw75/Hw75DynamicViewModel.cs | 1 + .../ViewModels/TodoViewModel.cs | 1 + .../ViewModels/Video/MovieViewModel.cs | 64 ++++++------------- src/ElectronBot.Braincase/Views/TodoPage.xaml | 2 +- .../HelloWordKeyboard.DotNet.csproj | 2 +- src/Mediapipe.Net/Mediapipe.Net.csproj | 2 +- 11 files changed, 48 insertions(+), 72 deletions(-) diff --git a/src/ElectronBot.Braincase.Core/Contracts/Services/IMicrosoftGraphService.cs b/src/ElectronBot.Braincase.Core/Contracts/Services/IMicrosoftGraphService.cs index bb7e979..db46741 100644 --- a/src/ElectronBot.Braincase.Core/Contracts/Services/IMicrosoftGraphService.cs +++ b/src/ElectronBot.Braincase.Core/Contracts/Services/IMicrosoftGraphService.cs @@ -1,4 +1,4 @@ -using Microsoft.Graph; +using Microsoft.Graph.Models; namespace Verdure.Braincase.Core.Contracts.Services; /// diff --git a/src/ElectronBot.Braincase.Core/Verdure.Braincase.Core.csproj b/src/ElectronBot.Braincase.Core/Verdure.Braincase.Core.csproj index d813e78..141a753 100644 --- a/src/ElectronBot.Braincase.Core/Verdure.Braincase.Core.csproj +++ b/src/ElectronBot.Braincase.Core/Verdure.Braincase.Core.csproj @@ -7,16 +7,16 @@ - - - - - - - + + + + + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/ElectronBot.Braincase/ElectronBot.Braincase.csproj b/src/ElectronBot.Braincase/ElectronBot.Braincase.csproj index 3980e46..55adaeb 100644 --- a/src/ElectronBot.Braincase/ElectronBot.Braincase.csproj +++ b/src/ElectronBot.Braincase/ElectronBot.Braincase.csproj @@ -259,7 +259,7 @@ - + diff --git a/src/ElectronBot.Braincase/Hw75Views/TodoView.xaml b/src/ElectronBot.Braincase/Hw75Views/TodoView.xaml index ffe0fbb..718b213 100644 --- a/src/ElectronBot.Braincase/Hw75Views/TodoView.xaml +++ b/src/ElectronBot.Braincase/Hw75Views/TodoView.xaml @@ -4,7 +4,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:graph="using:Microsoft.Graph" + xmlns:graph="using:Microsoft.Graph.Models" xmlns:local="using:Hw75Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Loaded="UserControl_Loaded" diff --git a/src/ElectronBot.Braincase/Services/Graph/MicrosoftGraphService.cs b/src/ElectronBot.Braincase/Services/Graph/MicrosoftGraphService.cs index 77f46b1..3c8e9c3 100644 --- a/src/ElectronBot.Braincase/Services/Graph/MicrosoftGraphService.cs +++ b/src/ElectronBot.Braincase/Services/Graph/MicrosoftGraphService.cs @@ -1,7 +1,7 @@ -using System.Net.Http.Headers; -using Verdure.Braincase.Core.Contracts.Services; -using Verdure.Braincase.Core.Helpers; +using Azure.Identity; using Microsoft.Graph; +using Microsoft.Graph.Models; +using Verdure.Braincase.Core.Contracts.Services; namespace ElectronBot.Braincase.Services; @@ -21,25 +21,20 @@ public class MicrosoftGraphService : IMicrosoftGraphService public MicrosoftGraphService(IdentityService identityService) { _identityService = identityService; - _graphServiceClient = new GraphServiceClient(_graphAPIEndpoint, - new DelegateAuthenticationProvider(async (requestMessage) => - { - var accessToken = await _identityService.GetAccessTokenForGraphAsync(); - - requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken); - })); + var credential = new ClientSecretCredential("TenantId", "ClientId", "ClientSecret"); + _graphServiceClient = new GraphServiceClient(credential); } public Task PrepareGraphAsync() { - + return Task.CompletedTask; } public async Task GetUserInfoAsync() { - var graphUser = await _graphServiceClient.Me.Request().GetAsync(); + var graphUser = await _graphServiceClient.Me.GetAsync(); return graphUser; } @@ -47,17 +42,18 @@ public class MicrosoftGraphService : IMicrosoftGraphService public async Task GetUserPhotoAsync() { var stream = await _graphServiceClient.Me.Photo.Content - .Request() .GetAsync(); return stream.ToBase64String(); } public async Task> GetTodoTaskListAsync() { - return await _graphServiceClient.Me.Todo.Lists.Request().GetAsync(); + var todoTaskLists = await _graphServiceClient.Me.Todo.Lists.GetAsync(); + return todoTaskLists?.Value ?? new List(); } public async Task> GetTodoTaskListByTaskIdAsync(string id) { - return await _graphServiceClient.Me.Todo.Lists[id].Tasks.Request().GetAsync(); + var tasksResponse = await _graphServiceClient.Me.Todo.Lists[id].Tasks.GetAsync(); + return tasksResponse?.Value ?? new List(); } } diff --git a/src/ElectronBot.Braincase/ViewModels/Hw75/Hw75DynamicViewModel.cs b/src/ElectronBot.Braincase/ViewModels/Hw75/Hw75DynamicViewModel.cs index 998bf6f..9f175d2 100644 --- a/src/ElectronBot.Braincase/ViewModels/Hw75/Hw75DynamicViewModel.cs +++ b/src/ElectronBot.Braincase/ViewModels/Hw75/Hw75DynamicViewModel.cs @@ -5,6 +5,7 @@ using System.Text; using CommunityToolkit.Mvvm.ComponentModel; using ElectronBot.Braincase.Services; using Microsoft.Graph; +using Microsoft.Graph.Models; using Microsoft.UI.Xaml; using Verdure.Braincase.Core.Contracts.Services; diff --git a/src/ElectronBot.Braincase/ViewModels/TodoViewModel.cs b/src/ElectronBot.Braincase/ViewModels/TodoViewModel.cs index f7c0669..5dc910d 100644 --- a/src/ElectronBot.Braincase/ViewModels/TodoViewModel.cs +++ b/src/ElectronBot.Braincase/ViewModels/TodoViewModel.cs @@ -8,6 +8,7 @@ using Verdure.Braincase.Core.Services; using Microsoft.Graph; using Controls.CompactOverlay; using Microsoft.UI.Windowing; +using Microsoft.Graph.Models; namespace ElectronBot.Braincase.ViewModels; diff --git a/src/ElectronBot.Braincase/ViewModels/Video/MovieViewModel.cs b/src/ElectronBot.Braincase/ViewModels/Video/MovieViewModel.cs index 5ad426b..9c82751 100644 --- a/src/ElectronBot.Braincase/ViewModels/Video/MovieViewModel.cs +++ b/src/ElectronBot.Braincase/ViewModels/Video/MovieViewModel.cs @@ -1,58 +1,36 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Text; -using Windows.ApplicationModel; +using System.Diagnostics; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; -using Controls.CompactOverlay; -using ElectronBot.Braincase; using ElectronBot.Braincase.Helpers; +using ElectronBot.Braincase.Services; using HelixToolkit.SharpDX.Core; -using HelixToolkit.WinUI; -using Microsoft.UI.Windowing; -using Microsoft.UI.Xaml; -using Models; -using SharpDX; -using Assimp; using HelixToolkit.SharpDX.Core.Assimp; using HelixToolkit.SharpDX.Core.Model.Scene; -using Microsoft.UI.Xaml.Media; -using BoundingBox = SharpDX.BoundingBox; -using Camera = HelixToolkit.WinUI.Camera; -using Matrix = SharpDX.Matrix; -using Microsoft.UI.Xaml.Controls; -using ElectronBot.Braincase.Services; -using Services; -using System.Diagnostics; -using System.Numerics; -using Windows.Foundation; -using Windows.Graphics.Imaging; +using HelixToolkit.WinUI; using Mediapipe.Net.Solutions; -using Microsoft.UI; -using Constants = ElectronBot.Braincase.Constants; -using Microsoft.Graphics.Canvas.UI.Xaml; using Microsoft.Graphics.Canvas; -using Windows.Media.Playback; -using ElectronBot.Braincase.Extensions; -using Vector3 = SharpDX.Vector3; -using Verdure.Braincase.Core.Models; -using Microsoft.UI.Xaml.Media.Imaging; -using Windows.Media.FaceAnalysis; -using Windows.Media; -using Windows.Graphics.Capture; -using WinRT.Interop; -using Microsoft.Graph.CallRecords; using Microsoft.Graphics.Canvas.UI.Composition; -using Windows.Graphics; using Microsoft.Graphics.DirectX; +using Microsoft.UI; using Microsoft.UI.Composition; using Microsoft.UI.Xaml.Hosting; +using Microsoft.UI.Xaml.Media; +using Services; +using SharpDX; +using Windows.ApplicationModel; +using Windows.Foundation; +using Windows.Graphics; +using Windows.Graphics.Capture; +using Windows.Graphics.Imaging; +using Windows.Media; +using Windows.Media.FaceAnalysis; using Windows.Storage.Streams; -using System.Runtime.InteropServices; -using Mediapipe.Net.Framework.Format; -using Mediapipe.Net.Framework.Protobuf; +using WinRT.Interop; +using BoundingBox = SharpDX.BoundingBox; +using Camera = HelixToolkit.WinUI.Camera; using Color = SharpDX.Color; +using Matrix = SharpDX.Matrix; +using Vector3 = SharpDX.Vector3; namespace ElectronBot.Braincase.ViewModels; @@ -999,8 +977,8 @@ public partial class MovieViewModel : ObservableRecipient using var inputFrame = VideoFrame.CreateWithSoftwareBitmap(softwareBitmap); - using var tmp = new VideoFrame(softwareBitmap.BitmapPixelFormat, (int)(faceBox.Width + faceBox.Width % 2) - 2, - (int)(faceBox.Height + faceBox.Height % 2) - 2); + using var tmp = new VideoFrame(softwareBitmap.BitmapPixelFormat, (int)(faceBox.Width + faceBox.Width % 2) - 2, + (int)(faceBox.Height + faceBox.Height % 2) - 2); await inputFrame.CopyToAsync(tmp, new BitmapBounds(faceBox.X - 20, faceBox.Y - 20, faceBox.Width + 40, faceBox.Height + 40), null); diff --git a/src/ElectronBot.Braincase/Views/TodoPage.xaml b/src/ElectronBot.Braincase/Views/TodoPage.xaml index c1a490f..56fa001 100644 --- a/src/ElectronBot.Braincase/Views/TodoPage.xaml +++ b/src/ElectronBot.Braincase/Views/TodoPage.xaml @@ -7,7 +7,7 @@ xmlns:ic="using:Microsoft.Xaml.Interactions.Core" xmlns:local="using:ElectronBot.Braincase.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:model="using:Microsoft.Graph" + xmlns:model="using:Microsoft.Graph.Models" mc:Ignorable="d"> diff --git a/src/HelloWordKeyboard.DotNet/HelloWordKeyboard.DotNet.csproj b/src/HelloWordKeyboard.DotNet/HelloWordKeyboard.DotNet.csproj index 90666d8..f7de8c0 100644 --- a/src/HelloWordKeyboard.DotNet/HelloWordKeyboard.DotNet.csproj +++ b/src/HelloWordKeyboard.DotNet/HelloWordKeyboard.DotNet.csproj @@ -7,7 +7,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Mediapipe.Net/Mediapipe.Net.csproj b/src/Mediapipe.Net/Mediapipe.Net.csproj index 53f371a..405fb73 100644 --- a/src/Mediapipe.Net/Mediapipe.Net.csproj +++ b/src/Mediapipe.Net/Mediapipe.Net.csproj @@ -22,7 +22,7 @@ - +