Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated package with community package #44

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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