Skip to content
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
4 changes: 2 additions & 2 deletions CommunityToolkit.Authentication/ProviderManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public IProvider GlobalProvider
_provider.StateChanged += ProviderStateChanged;
}

ProviderUpdated?.Invoke(this, new ProviderUpdatedEventArgs(ProviderManagerChangedState.ProviderChanged));

PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(GlobalProvider)));
ProviderUpdated?.Invoke(this, new ProviderUpdatedEventArgs(ProviderManagerChangedState.ProviderChanged));
ProviderUpdated?.Invoke(this, new ProviderUpdatedEventArgs(ProviderManagerChangedState.ProviderStateChanged));
}
}

Expand Down
30 changes: 0 additions & 30 deletions Docs/QuickStart-WindowsProvider.md

This file was deleted.

119 changes: 0 additions & 119 deletions Docs/WindowsProvider.md

This file was deleted.

19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,28 @@ Once you are authenticated, you can then make requests to the Graph using the Gr

> Install the `CommunityToolkit.Graph` package.

```
```csharp
using CommunityToolkit.Authentication;
using CommunityToolkit.Graph.Extensions;

var provider = ProviderManager.Instance.GlobalProvider;
ProviderManager.Instance.ProviderUpdated += OnProviderUpdated;

if (provider != null && provider.State == ProviderState.SignedIn)
void OnProviderUpdated(object sender, ProviderUpdatedEventArgs e)
{
var graphClient = provider.GetClient();
var me = await graphClient.Me.Request().GetAsync();
var provider = ProviderMananager.Instance.GlobalProvider;
if (e.Reason == ProviderManagerChangedState.ProviderStateChanged && provider?.State == ProviderState.SignedIn)
{
var graphClient = provider.GetClient();
var me = await graphClient.Me.Request().GetAsync();
}
}
```

#### Make a Graph request manually

Alternatively if you do not wish to use the Graph SDK you can make requests to Microsoft Graph manually instead:

```
```csharp
using CommunityToolkit.Authentication;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -168,9 +172,10 @@ public ImageSource GetMyPhoto()
}
catch
{
return null;
}
}

return null;
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ await App.DispatcherQueue.EnqueueAsync(async () =>
ProviderManager.Instance.ProviderUpdated += (s, e) =>
{
var providerManager = s as ProviderManager;
if (providerManager.GlobalProvider.State == ProviderState.SignedIn)
if (e.Reason == ProviderManagerChangedState.ProviderStateChanged && providerManager.GlobalProvider.State == ProviderState.SignedIn)
{
test.Invoke();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ await App.DispatcherQueue.EnqueueAsync(async () =>
ProviderManager.Instance.ProviderUpdated += (s, e) =>
{
var providerManager = s as ProviderManager;
if (providerManager.GlobalProvider.State == ProviderState.SignedIn)
if (e.Reason == ProviderManagerChangedState.ProviderStateChanged && providerManager.GlobalProvider.State == ProviderState.SignedIn)
{
test.Invoke();
}
Expand Down
6 changes: 0 additions & 6 deletions Windows-Toolkit-Graph-Controls.sln
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests.UWP", "UnitTests\UnitTests.UWP\UnitTests.UWP.csproj", "{6B33B26C-008B-4ADB-B317-EF996CD6755B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{EACBCDF3-8CCC-4A30-87E9-75FCA815831E}"
ProjectSection(SolutionItems) = preProject
Docs\QuickStart-WindowsProvider.md = Docs\QuickStart-WindowsProvider.md
Docs\WindowsProvider.md = Docs\WindowsProvider.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{022BF202-8D0D-4A6B-8A5B-92376D2EB5DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UwpMsalProviderSample", "Samples\UwpMsalProviderSample\UwpMsalProviderSample.csproj", "{D0F6A1EB-806E-424A-BDCA-9F749F12774F}"
Expand Down