Skip to content

Commit

Permalink
Merge pull request #44 from microsoftgraph/patch-43
Browse files Browse the repository at this point in the history
Replaced deprecated package with community package
  • Loading branch information
jasonjoh authored May 16, 2022
2 parents 47b7f72 + 367d274 commit 2f525d3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
6 changes: 3 additions & 3 deletions demo/GraphTutorial/CalendarPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// Licensed under the MIT License.

using Microsoft.Graph;
using Microsoft.Toolkit.Graph.Providers;
using CommunityToolkit.Authentication;
using CommunityToolkit.Graph.Extensions;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -48,7 +48,7 @@ private void ShowNotification(string message)
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
// Get the Graph client from the provider
var graphClient = ProviderManager.Instance.GlobalProvider.Graph;
var graphClient = ProviderManager.Instance.GlobalProvider.GetClient();

try
{
Expand Down
17 changes: 13 additions & 4 deletions demo/GraphTutorial/GraphTutorial.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,23 @@
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Authentication.Msal">
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="CommunityToolkit.Graph.Uwp">
<Version>7.1.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.11</Version>
<Version>6.2.13</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI">
<Version>7.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Graph.Controls">
<Version>7.0.0-preview2</Version>
<PackageReference Include="Microsoft.Toolkit.Uwp.UI.Controls">
<Version>7.1.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.Toolkit.Uwp.Ui.Controls.DataGrid">
<Version>7.0.0-preview4</Version>
<Version>7.1.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 1 addition & 5 deletions demo/GraphTutorial/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:providers="using:Microsoft.Toolkit.Graph.Providers"
xmlns:wgt="using:Microsoft.Toolkit.Graph.Controls"
xmlns:wgt="using:CommunityToolkit.Graph.Uwp.Controls"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Interactivity:Interaction.Behaviors>
<providers:InteractiveProviderBehavior x:Name="MsalProvider" />
</Interactivity:Interaction.Behaviors>

<Grid>
<NavigationView x:Name="NavView"
IsSettingsVisible="False"
Expand Down
10 changes: 5 additions & 5 deletions demo/GraphTutorial/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.Toolkit.Graph.Providers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using CommunityToolkit.Authentication;
using CommunityToolkit.Graph.Extensions;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
Expand Down Expand Up @@ -43,11 +44,10 @@ public MainPage()
else
{
// Configure MSAL provider
MsalProvider.ClientId = appId;
MsalProvider.Scopes = new ScopeSet(scopes.Split(' '));
ProviderManager.Instance.GlobalProvider = new MsalProvider(appId, scopes.Split(' '));

// Handle auth state change
ProviderManager.Instance.ProviderUpdated += ProviderUpdated;
ProviderManager.Instance.ProviderStateChanged += ProviderUpdated;

// Navigate to HomePage.xaml
RootFrame.Navigate(typeof(HomePage));
Expand All @@ -56,7 +56,7 @@ public MainPage()
// </ConstructorSnippet>

// <ProviderUpdatedSnippet>
private void ProviderUpdated(object sender, ProviderUpdatedEventArgs e)
private void ProviderUpdated(object sender, ProviderStateChangedEventArgs e)
{
var globalProvider = ProviderManager.Instance.GlobalProvider;
SetAuthState(globalProvider != null && globalProvider.State == ProviderState.SignedIn);
Expand Down
2 changes: 1 addition & 1 deletion demo/GraphTutorial/NewEventPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Licensed under the MIT License. -->

<!-- <NewEventPageXamlSnippet> -->
<Page xmlns:wgt="using:Microsoft.Toolkit.Graph.Controls"
<Page xmlns:wgt="using:CommunityToolkit.Graph.Uwp.Controls"
x:Class="GraphTutorial.NewEventPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
9 changes: 5 additions & 4 deletions demo/GraphTutorial/NewEventPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

// <UsingStatementsSnippet>
using System.ComponentModel;
using CommunityToolkit.Authentication;
using CommunityToolkit.Graph.Extensions;
using Microsoft.Graph;
using Microsoft.Graph.Extensions;
using Microsoft.Toolkit.Graph.Providers;
using Microsoft.Toolkit.Uwp.UI.Controls;
using System.Runtime.CompilerServices;
// </UsingStatementsSnippet>
Expand Down Expand Up @@ -171,7 +172,7 @@ public NewEventPage()
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
// Get the Graph client from the provider
var graphClient = ProviderManager.Instance.GlobalProvider.Graph;
var graphClient = ProviderManager.Instance.GlobalProvider.GetClient();

try
{
Expand Down Expand Up @@ -213,7 +214,7 @@ private async void CreateEvent(object sender, RoutedEventArgs e)
CreateProgress.Visibility = Visibility.Visible;

// Get the Graph client from the provider
var graphClient = ProviderManager.Instance.GlobalProvider.Graph;
var graphClient = ProviderManager.Instance.GlobalProvider.GetClient();

// Initialize a new Event object with the required fields
var newEvent = new Event
Expand Down Expand Up @@ -250,7 +251,7 @@ private async void CreateEvent(object sender, RoutedEventArgs e)
Type = AttendeeType.Required,
EmailAddress = new EmailAddress
{
Address = person.EmailAddresses.First().Address
Address = person.ScoredEmailAddresses.First().Address
}
});
}
Expand Down

0 comments on commit 2f525d3

Please sign in to comment.