├── .gitignore
├── GrooveApi.sln
├── LICENCE
├── README.md
├── samples
├── Package.appxmanifest
└── UniversalApplication
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
│ ├── Converters
│ ├── ImageUrlSizeConverter.cs
│ ├── SignInButtonTextConverter.cs
│ └── StringFormatConverter.cs
│ ├── GrooveApiUniversalSamples.csproj
│ ├── GrooveApiUniversalSamples.sln
│ ├── Helpers
│ └── StreamClientInstanceId.cs
│ ├── MainPage.xaml
│ ├── MainPage.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
│ ├── ViewModels
│ ├── GrooveApiErrorViewModel.cs
│ ├── MusicContentPaneViewModel.cs
│ ├── PlayerViewModel.cs
│ └── UserProfileViewModel.cs
│ ├── WindowsUniversalUserAccountManager.cs
│ └── project.json
├── src
├── GrooveApiClient
│ ├── ContentExtensions.cs
│ ├── GrooveApiClient.csproj
│ ├── GrooveApiClient.nuspec
│ ├── GrooveClient.cs
│ ├── GrooveClientFactory.cs
│ ├── IGrooveClient.cs
│ ├── IUserTokenManager.cs
│ ├── MicrosoftAccountAuthenticationCache.cs
│ ├── MicrosoftAccountAuthenticationClient.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── SimpleServiceClient.cs
│ └── packages.config
└── GrooveApiDataContract
│ ├── AuthenticationDataContract
│ └── MicrosoftAccountAuthenticationResponse.cs
│ ├── Constants.cs
│ ├── DataContract
│ ├── Activity.cs
│ ├── Album.cs
│ ├── Artist.cs
│ ├── BaseResponse.cs
│ ├── BrowseItemType.cs
│ ├── CollectionEdit
│ │ ├── ActionResult.cs
│ │ ├── IPlaylistEditableMetadata.cs
│ │ ├── PlaylistAction.cs
│ │ ├── PlaylistActionResponse.cs
│ │ ├── PlaylistActionResult.cs
│ │ ├── PlaylistActionType.cs
│ │ ├── TrackAction.cs
│ │ ├── TrackActionRequest.cs
│ │ ├── TrackActionResponse.cs
│ │ ├── TrackActionResult.cs
│ │ └── TrackActionType.cs
│ ├── CollectionState.cs
│ ├── Content.cs
│ ├── ContentCategory.cs
│ ├── ContentItem.cs
│ ├── ContentResponse.cs
│ ├── CreateRadioRequest.cs
│ ├── Error.cs
│ ├── ExtraDetails.cs
│ ├── GenericCollections.cs
│ ├── Genre.cs
│ ├── ItemType.cs
│ ├── MediaNamespace.cs
│ ├── Mood.cs
│ ├── OrderBy.cs
│ ├── PaginatedList.cs
│ ├── Playlist.cs
│ ├── Radio.cs
│ ├── RadioResponse.cs
│ ├── RadioSeed.cs
│ ├── RadioSeedType.cs
│ ├── SearchFilter.cs
│ ├── StreamResponse.cs
│ ├── SubscriptionState.cs
│ ├── Track.cs
│ ├── TrackContainer.cs
│ └── UserProfileResponse.cs
│ ├── ErrorCode.cs
│ ├── GrooveApiDataContract.csproj
│ ├── GrooveApiDataContract.nuspec
│ ├── Properties
│ └── AssemblyInfo.cs
│ └── packages.config
└── tests
└── GrooveApiClient.Tests
├── App.config
├── CatalogShould.cs
├── CollectionShould.cs
├── DeeplinksShould.cs
├── DeveloperAuthenticationShould.cs
├── GettingStarted.cs
├── GrooveApiClient.Tests.csproj
├── ImagesShould.cs
├── Properties
└── AssemblyInfo.cs
├── StreamShould.cs
├── TestBase.cs
├── TestBaseExtensions.cs
└── TestUserTokenManagerFromConfigurationValue.cs
/.gitignore:
--------------------------------------------------------------------------------
1 | *.pfx
2 | .vs
3 | bin
4 | obj
5 | *.suo
6 | *.csproj.user
7 | Package.StoreAssociation.xml
8 | packages
9 | project.lock.json
--------------------------------------------------------------------------------
/GrooveApi.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A5658462-64F2-4091-ACC0-3E202653A304}"
7 | ProjectSection(SolutionItems) = preProject
8 | .gitignore = .gitignore
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiDataContract", "src\GrooveApiDataContract\GrooveApiDataContract.csproj", "{5850FDBC-1778-4107-A7DF-C3E331E4BA6E}"
12 | EndProject
13 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiClient", "src\GrooveApiClient\GrooveApiClient.csproj", "{EFC538C3-4EF6-43B4-B49A-152E35563BDA}"
14 | EndProject
15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiClient.Tests", "tests\GrooveApiClient.Tests\GrooveApiClient.Tests.csproj", "{2F385742-3FF9-4B23-9F95-4154BA9521EE}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Any CPU = Debug|Any CPU
20 | Debug|ARM = Debug|ARM
21 | Debug|x64 = Debug|x64
22 | Debug|x86 = Debug|x86
23 | Release|Any CPU = Release|Any CPU
24 | Release|ARM = Release|ARM
25 | Release|x64 = Release|x64
26 | Release|x86 = Release|x86
27 | EndGlobalSection
28 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
29 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|ARM.ActiveCfg = Debug|Any CPU
32 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|ARM.Build.0 = Debug|Any CPU
33 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x64.ActiveCfg = Debug|Any CPU
34 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x64.Build.0 = Debug|Any CPU
35 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x86.ActiveCfg = Debug|Any CPU
36 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x86.Build.0 = Debug|Any CPU
37 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|Any CPU.Build.0 = Release|Any CPU
39 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|ARM.ActiveCfg = Release|Any CPU
40 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|ARM.Build.0 = Release|Any CPU
41 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x64.ActiveCfg = Release|Any CPU
42 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x64.Build.0 = Release|Any CPU
43 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x86.ActiveCfg = Release|Any CPU
44 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x86.Build.0 = Release|Any CPU
45 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
47 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|ARM.ActiveCfg = Debug|Any CPU
48 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|ARM.Build.0 = Debug|Any CPU
49 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x64.ActiveCfg = Debug|Any CPU
50 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x64.Build.0 = Debug|Any CPU
51 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x86.ActiveCfg = Debug|Any CPU
52 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x86.Build.0 = Debug|Any CPU
53 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
54 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|Any CPU.Build.0 = Release|Any CPU
55 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|ARM.ActiveCfg = Release|Any CPU
56 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|ARM.Build.0 = Release|Any CPU
57 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x64.ActiveCfg = Release|Any CPU
58 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x64.Build.0 = Release|Any CPU
59 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x86.ActiveCfg = Release|Any CPU
60 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x86.Build.0 = Release|Any CPU
61 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
63 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|ARM.ActiveCfg = Debug|Any CPU
64 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|ARM.Build.0 = Debug|Any CPU
65 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|x64.ActiveCfg = Debug|Any CPU
66 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|x64.Build.0 = Debug|Any CPU
67 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|x86.ActiveCfg = Debug|Any CPU
68 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Debug|x86.Build.0 = Debug|Any CPU
69 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
70 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|Any CPU.Build.0 = Release|Any CPU
71 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|ARM.ActiveCfg = Release|Any CPU
72 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|ARM.Build.0 = Release|Any CPU
73 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|x64.ActiveCfg = Release|Any CPU
74 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|x64.Build.0 = Release|Any CPU
75 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|x86.ActiveCfg = Release|Any CPU
76 | {2F385742-3FF9-4B23-9F95-4154BA9521EE}.Release|x86.Build.0 = Release|Any CPU
77 | EndGlobalSection
78 | GlobalSection(SolutionProperties) = preSolution
79 | HideSolutionNode = FALSE
80 | EndGlobalSection
81 | EndGlobal
82 |
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 |
2 | Copyright (c) 2016 Microsoft Corporation
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy
5 | of this software and associated documentation files (the "Software"), to deal
6 | in the Software without restriction, including without limitation the rights
7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the Software is
9 | furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in
12 | all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
2 |
3 | # Groove API SDK for CSharp
4 | Integrate the [Groove API](https://docs.microsoft.com/en-us/groove/api-overview) into your C# project!
5 |
6 | The Groove API SDK is built as a Portable Class Library and targets the following frameworks:
7 | * .NET 4.5
8 | * .NET for Windows Store apps
9 | * Windows Phone 8.1 and higher
10 |
11 | ## Running the sample application
12 | You will need to associate the application with your Microsoft Developer Center account.
13 | Go to the [Microsoft Developer Center](https://developer.microsoft.com/en-us/dashboard/apps/) and create a new application if you don't already have one. The name you choose will be reserved for your application during development.
14 |
15 | Then, copy the Package.appxmanifest file (under /samples) at the root of the GrooveApiUniversalSamples project (/samples/UniversalApplication)
16 |
17 | Finally, in Visual Studio 2015/2017, you will need to associate your application to the one reserved on the Microsoft Developer Center. To do that, simply right-click on your project and select "Store -> Associate App with the Store...", select your application in the drop-down and follow the steps.
--------------------------------------------------------------------------------
/samples/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
8 |
9 | Groove API samples
10 | Microsoft Corporation
11 | Assets\StoreLogo.png
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples
9 | {
10 | using System;
11 |
12 | using Windows.ApplicationModel;
13 | using Windows.ApplicationModel.Activation;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | ///
19 | /// Provides application-specific behavior to supplement the default Application class.
20 | ///
21 | sealed partial class App : Application
22 | {
23 | ///
24 | /// Initializes the singleton application object. This is the first line of authored code
25 | /// executed, and as such is the logical equivalent of main() or WinMain().
26 | ///
27 | public App()
28 | {
29 | InitializeComponent();
30 | Suspending += OnSuspending;
31 | }
32 |
33 | ///
34 | /// Invoked when the application is launched normally by the end user. Other entry points
35 | /// will be used such as when the application is launched to open a specific file.
36 | ///
37 | /// Details about the launch request and process.
38 | protected override void OnLaunched(LaunchActivatedEventArgs e)
39 | {
40 | #if DEBUG
41 | if (System.Diagnostics.Debugger.IsAttached)
42 | {
43 | DebugSettings.EnableFrameRateCounter = true;
44 | }
45 | #endif
46 | Frame rootFrame = Window.Current.Content as Frame;
47 |
48 | // Do not repeat app initialization when the Window already has content,
49 | // just ensure that the window is active
50 | if (rootFrame == null)
51 | {
52 | // Create a Frame to act as the navigation context and navigate to the first page
53 | rootFrame = new Frame();
54 |
55 | rootFrame.NavigationFailed += OnNavigationFailed;
56 |
57 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
58 | {
59 | // Load state from previously suspended application
60 | }
61 |
62 | // Place the frame in the current Window
63 | Window.Current.Content = rootFrame;
64 | }
65 |
66 | if (e.PrelaunchActivated == false)
67 | {
68 | if (rootFrame.Content == null)
69 | {
70 | // When the navigation stack isn't restored navigate to the first page,
71 | // configuring the new page by passing required information as a navigation
72 | // parameter
73 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
74 | }
75 | // Ensure the current window is active
76 | Window.Current.Activate();
77 | }
78 | }
79 |
80 | ///
81 | /// Invoked when Navigation to a certain page fails
82 | ///
83 | /// The Frame which failed navigation
84 | /// Details about the navigation failure
85 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
86 | {
87 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
88 | }
89 |
90 | ///
91 | /// Invoked when application execution is being suspended. Application state is saved
92 | /// without knowing whether the application will be terminated or resumed with the contents
93 | /// of memory still intact.
94 | ///
95 | /// The source of the suspend request.
96 | /// Details about the suspend request.
97 | private void OnSuspending(object sender, SuspendingEventArgs e)
98 | {
99 | var deferral = e.SuspendingOperation.GetDeferral();
100 | // Save application state and stop any background activity
101 | deferral.Complete();
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/groove-api-sdk-csharp/616959c2f3abd3cfd9536e12be484e7bbce20d6d/samples/UniversalApplication/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/samples/UniversalApplication/Converters/ImageUrlSizeConverter.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.Converters
9 | {
10 | using System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Data;
13 | using Windows.UI.Xaml.Media.Imaging;
14 |
15 | public class ImageUrlSizeConverter : IValueConverter
16 | {
17 | public object Convert(object value, Type targetType, object parameter, string language)
18 | {
19 | string imageUrl = value as string;
20 | int size = int.Parse((string) parameter);
21 | if (imageUrl != null)
22 | {
23 | return new BitmapImage(new Uri($"{imageUrl}&w={size}&h={size}"));
24 | }
25 |
26 | return null;
27 | }
28 |
29 | // No need to implement converting back on a one-way binding
30 | public object ConvertBack(object value, Type targetType, object parameter, string language)
31 | {
32 | return DependencyProperty.UnsetValue;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/Converters/SignInButtonTextConverter.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.Converters
9 | {
10 | using System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Data;
13 |
14 | public class SignInButtonTextConverter : IValueConverter
15 | {
16 | private const string SignInText = "Sign in";
17 | private const string SignOutText = "Sign out";
18 |
19 | // This converts the boolean indicating if the user is signed-in to a message to display on the sign-in button
20 | public object Convert(object value, Type targetType, object parameter, string language)
21 | {
22 | if (value is bool)
23 | {
24 | return (bool) value ? SignOutText : SignInText;
25 | }
26 |
27 | return SignInText;
28 | }
29 |
30 | // No need to implement converting back on a one-way binding
31 | public object ConvertBack(object value, Type targetType, object parameter, string language)
32 | {
33 | return DependencyProperty.UnsetValue;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/Converters/StringFormatConverter.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.Converters
9 | {
10 | using System;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Data;
13 |
14 | public class StringFormatConverter : IValueConverter
15 | {
16 | public object Convert(object value, Type targetType, object parameter, string language)
17 | {
18 | if (value == null)
19 | return null;
20 |
21 | if (parameter == null)
22 | return value;
23 |
24 | return string.Format((string) parameter, value);
25 | }
26 |
27 | public object ConvertBack(object value, Type targetType, object parameter, string language)
28 | {
29 | return DependencyProperty.UnsetValue;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/GrooveApiUniversalSamples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {09965119-38F6-4441-A473-B86246B57719}
8 | AppContainerExe
9 | Properties
10 | Microsoft.Groove.Api.Samples
11 | Microsoft.Groove.Api.Samples
12 | en-US
13 | UAP
14 | 10.0.14393.0
15 | 10.0.14393.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | 4C4F955523629F1FF92F8131DE0C68622CE13E4C
20 | GrooveApiUniversalSamples_StoreKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 | true
33 |
34 |
35 | bin\x86\Release\
36 | TRACE;NETFX_CORE;WINDOWS_UWP
37 | true
38 | ;2008
39 | pdbonly
40 | x86
41 | false
42 | prompt
43 | true
44 | true
45 | true
46 |
47 |
48 | true
49 | bin\ARM\Debug\
50 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
51 | ;2008
52 | full
53 | ARM
54 | false
55 | prompt
56 | true
57 |
58 |
59 | bin\ARM\Release\
60 | TRACE;NETFX_CORE;WINDOWS_UWP
61 | true
62 | ;2008
63 | pdbonly
64 | ARM
65 | false
66 | prompt
67 | true
68 | true
69 |
70 |
71 | true
72 | bin\x64\Debug\
73 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
74 | ;2008
75 | full
76 | x64
77 | false
78 | prompt
79 | true
80 |
81 |
82 | bin\x64\Release\
83 | TRACE;NETFX_CORE;WINDOWS_UWP
84 | true
85 | ;2008
86 | pdbonly
87 | x64
88 | false
89 | prompt
90 | true
91 | true
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | App.xaml
101 |
102 |
103 |
104 |
105 |
106 |
107 | MainPage.xaml
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 | Designer
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | MSBuild:Compile
135 | Designer
136 |
137 |
138 | MSBuild:Compile
139 | Designer
140 |
141 |
142 |
143 |
144 | {5850fdbc-1778-4107-a7df-c3e331e4ba6e}
145 | GrooveApiDataContract
146 |
147 |
148 | {efc538c3-4ef6-43b4-b49a-152e35563bda}
149 | GrooveApiClient
150 |
151 |
152 |
153 | 14.0
154 |
155 |
156 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/GrooveApiUniversalSamples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiUniversalSamples", "GrooveApiUniversalSamples.csproj", "{09965119-38F6-4441-A473-B86246B57719}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiClient", "..\..\src\GrooveApiClient\GrooveApiClient.csproj", "{EFC538C3-4EF6-43B4-B49A-152E35563BDA}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrooveApiDataContract", "..\..\src\GrooveApiDataContract\GrooveApiDataContract.csproj", "{5850FDBC-1778-4107-A7DF-C3E331E4BA6E}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|ARM = Debug|ARM
16 | Debug|x64 = Debug|x64
17 | Debug|x86 = Debug|x86
18 | Release|Any CPU = Release|Any CPU
19 | Release|ARM = Release|ARM
20 | Release|x64 = Release|x64
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {09965119-38F6-4441-A473-B86246B57719}.Debug|Any CPU.ActiveCfg = Debug|x86
25 | {09965119-38F6-4441-A473-B86246B57719}.Debug|Any CPU.Build.0 = Debug|x86
26 | {09965119-38F6-4441-A473-B86246B57719}.Debug|Any CPU.Deploy.0 = Debug|x86
27 | {09965119-38F6-4441-A473-B86246B57719}.Debug|ARM.ActiveCfg = Debug|ARM
28 | {09965119-38F6-4441-A473-B86246B57719}.Debug|ARM.Build.0 = Debug|ARM
29 | {09965119-38F6-4441-A473-B86246B57719}.Debug|ARM.Deploy.0 = Debug|ARM
30 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x64.ActiveCfg = Debug|x64
31 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x64.Build.0 = Debug|x64
32 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x64.Deploy.0 = Debug|x64
33 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x86.ActiveCfg = Debug|x86
34 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x86.Build.0 = Debug|x86
35 | {09965119-38F6-4441-A473-B86246B57719}.Debug|x86.Deploy.0 = Debug|x86
36 | {09965119-38F6-4441-A473-B86246B57719}.Release|Any CPU.ActiveCfg = Release|x86
37 | {09965119-38F6-4441-A473-B86246B57719}.Release|ARM.ActiveCfg = Release|ARM
38 | {09965119-38F6-4441-A473-B86246B57719}.Release|ARM.Build.0 = Release|ARM
39 | {09965119-38F6-4441-A473-B86246B57719}.Release|ARM.Deploy.0 = Release|ARM
40 | {09965119-38F6-4441-A473-B86246B57719}.Release|x64.ActiveCfg = Release|x64
41 | {09965119-38F6-4441-A473-B86246B57719}.Release|x64.Build.0 = Release|x64
42 | {09965119-38F6-4441-A473-B86246B57719}.Release|x64.Deploy.0 = Release|x64
43 | {09965119-38F6-4441-A473-B86246B57719}.Release|x86.ActiveCfg = Release|x86
44 | {09965119-38F6-4441-A473-B86246B57719}.Release|x86.Build.0 = Release|x86
45 | {09965119-38F6-4441-A473-B86246B57719}.Release|x86.Deploy.0 = Release|x86
46 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|ARM.ActiveCfg = Debug|Any CPU
49 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|ARM.Build.0 = Debug|Any CPU
50 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x64.ActiveCfg = Debug|Any CPU
51 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x64.Build.0 = Debug|Any CPU
52 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x86.ActiveCfg = Debug|Any CPU
53 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Debug|x86.Build.0 = Debug|Any CPU
54 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|Any CPU.Build.0 = Release|Any CPU
56 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|ARM.ActiveCfg = Release|Any CPU
57 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|ARM.Build.0 = Release|Any CPU
58 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x64.ActiveCfg = Release|Any CPU
59 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x64.Build.0 = Release|Any CPU
60 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x86.ActiveCfg = Release|Any CPU
61 | {EFC538C3-4EF6-43B4-B49A-152E35563BDA}.Release|x86.Build.0 = Release|Any CPU
62 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|ARM.ActiveCfg = Debug|Any CPU
65 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|ARM.Build.0 = Debug|Any CPU
66 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x64.ActiveCfg = Debug|Any CPU
67 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x64.Build.0 = Debug|Any CPU
68 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x86.ActiveCfg = Debug|Any CPU
69 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Debug|x86.Build.0 = Debug|Any CPU
70 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
71 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|Any CPU.Build.0 = Release|Any CPU
72 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|ARM.ActiveCfg = Release|Any CPU
73 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|ARM.Build.0 = Release|Any CPU
74 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x64.ActiveCfg = Release|Any CPU
75 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x64.Build.0 = Release|Any CPU
76 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x86.ActiveCfg = Release|Any CPU
77 | {5850FDBC-1778-4107-A7DF-C3E331E4BA6E}.Release|x86.Build.0 = Release|Any CPU
78 | EndGlobalSection
79 | GlobalSection(SolutionProperties) = preSolution
80 | HideSolutionNode = FALSE
81 | EndGlobalSection
82 | EndGlobal
83 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/Helpers/StreamClientInstanceId.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.Helpers
9 | {
10 | using System;
11 | using System.Runtime.InteropServices.WindowsRuntime;
12 | using Windows.ApplicationModel;
13 | using Windows.System.Profile;
14 |
15 | public static class StreamClientInstanceId
16 | {
17 | ///
18 | /// Compute a stable application-specific client instance id string for use as "clientInstanceId" parameters in IGrooveClient
19 | ///
20 | /// A valid clientInstanceId string. This string is specific to the current machine, user and application.
21 | public static string GetStableClientInstanceId()
22 | {
23 | // Generate a somewhat stable application instance id
24 | HardwareToken ashwid = HardwareIdentification.GetPackageSpecificToken(null);
25 |
26 | byte[] id = ashwid.Id.ToArray();
27 | string idstring = Package.Current.Id.Name + ":";
28 |
29 | for (int i = 0; i < id.Length; i += 4)
30 | {
31 | short what = BitConverter.ToInt16(id, i);
32 | short value = BitConverter.ToInt16(id, i + 2);
33 | // Only include stable components in the id
34 | // http://msdn.microsoft.com/en-us/library/windows/apps/jj553431.aspx
35 | const int cpuId = 1;
36 | const int memorySize = 2;
37 | const int diskSerial = 3;
38 | const int bios = 9;
39 | if (what == cpuId || what == memorySize || what == diskSerial || what == bios)
40 | {
41 | idstring += value.ToString("X4");
42 | }
43 | }
44 |
45 | string machineClientInstanceId = idstring.PadRight(32, 'X');
46 | return machineClientInstanceId;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
23 |
28 |
34 |
38 |
44 |
51 |
56 |
61 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
93 |
97 |
98 |
99 |
100 |
103 |
104 |
105 |
107 |
108 |
110 |
112 |
114 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
202 |
203 |
204 |
205 |
206 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples
9 | {
10 | using System;
11 | using System.Diagnostics;
12 | using Windows.System;
13 | using Windows.UI.ApplicationSettings;
14 | using Windows.UI.Xaml;
15 | using Windows.UI.Xaml.Controls;
16 | using Windows.UI.Xaml.Input;
17 | using Windows.UI.Xaml.Navigation;
18 | using Client;
19 | using DataContract;
20 | using ViewModels;
21 |
22 | public sealed partial class MainPage : Page
23 | {
24 | // Provide your own values here
25 | // See https://review.docs.microsoft.com/en-us/groove/using-the-groove-restful-services/obtaining-a-developer-access-token
26 | // WARNING: this is used here as an example but authentication for Universal Windows App should be done only using User
27 | // auth (cf. WindowsUniversalUserAccountManager) since you should not to put your Application secret in a client app.
28 | private const string ApplicationClientId = "";
29 | private const string ApplicationClientSecret = "";
30 |
31 | private readonly WindowsUniversalUserAccountManager _userAccountManager;
32 |
33 | public string SearchQuery { get; set; }
34 | public PlayerViewModel PlayerViewModel { get; set; }
35 | public MusicContentPaneViewModel MusicContentPaneViewModel { get; set; }
36 | public UserProfileViewModel UserProfileViewModel { get; set; }
37 | public GrooveApiErrorViewModel ErrorViewModel { get; set; }
38 |
39 | public MainPage()
40 | {
41 | InitializeComponent();
42 |
43 | _userAccountManager = new WindowsUniversalUserAccountManager();
44 | IGrooveClient grooveClient = GrooveClientFactory.CreateGrooveClient(ApplicationClientId, ApplicationClientSecret, _userAccountManager);
45 |
46 | ErrorViewModel = new GrooveApiErrorViewModel();
47 | MusicContentPaneViewModel = new MusicContentPaneViewModel(grooveClient, ErrorViewModel);
48 | PlayerViewModel = new PlayerViewModel(grooveClient, ErrorViewModel);
49 | UserProfileViewModel = new UserProfileViewModel(_userAccountManager, grooveClient, ErrorViewModel);
50 | }
51 |
52 | protected override async void OnNavigatedTo(NavigationEventArgs e)
53 | {
54 | AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested += _userAccountManager.BuildAccountPaneAsync;
55 | await _userAccountManager.SignInUserAccountSilentlyAsync();
56 | if (_userAccountManager.UserIsSignedIn)
57 | {
58 | Debug.WriteLine("Successful silent sign-in");
59 | }
60 | }
61 |
62 | protected override void OnNavigatedFrom(NavigationEventArgs e)
63 | {
64 | AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested -= _userAccountManager.BuildAccountPaneAsync;
65 | }
66 |
67 | private async void SignInButton_Click(object sender, RoutedEventArgs e)
68 | {
69 | ((Button)sender).IsEnabled = false;
70 |
71 | if (_userAccountManager.UserIsSignedIn)
72 | {
73 | await _userAccountManager.SignOutAccountAsync();
74 | }
75 | else
76 | {
77 | AccountsSettingsPane.Show();
78 | }
79 |
80 | ((Button)sender).IsEnabled = true;
81 | }
82 |
83 | private async void PlaylistsButton_OnClick(object sender, RoutedEventArgs e)
84 | {
85 | ((Button)sender).IsEnabled = false;
86 |
87 | if (_userAccountManager.UserIsSignedIn)
88 | {
89 | await MusicContentPaneViewModel.GetPlaylistsAsync();
90 | }
91 | else
92 | {
93 | AccountsSettingsPane.Show();
94 | }
95 |
96 | ((Button)sender).IsEnabled = true;
97 | }
98 |
99 | private async void SearchButton_OnClick(object sender, RoutedEventArgs e)
100 | {
101 | ((Button)sender).IsEnabled = false;
102 |
103 | await MusicContentPaneViewModel.SearchCatalogAsync(
104 | SearchQuery,
105 | UserProfileViewModel.UserGrooveSubscriptionCountry);
106 |
107 | ((Button)sender).IsEnabled = true;
108 | }
109 |
110 | private async void PlayButton_OnTapped(object sender, TappedRoutedEventArgs e)
111 | {
112 | SymbolIcon expectedSender = sender as SymbolIcon;
113 | Track selectedTrack = expectedSender?.DataContext as Track;
114 | if (selectedTrack != null)
115 | {
116 | await PlayerViewModel.PlayTrackAsync(
117 | selectedTrack,
118 | _userAccountManager.UserIsSignedIn,
119 | UserProfileViewModel.UserHasGrooveSubscription);
120 | }
121 | }
122 |
123 | private async void DeeplinkButton_OnTapped(object sender, TappedRoutedEventArgs e)
124 | {
125 | SymbolIcon expectedSender = sender as SymbolIcon;
126 | Track selectedTrack = expectedSender?.DataContext as Track;
127 | if (selectedTrack != null)
128 | {
129 | string deeplink = selectedTrack.Link;
130 | await Launcher.LaunchUriAsync(new Uri(deeplink));
131 | }
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | [assembly: AssemblyTitle("Microsoft.Groove.Api.Samples")]
5 | [assembly: AssemblyDescription("Samples for interacting with the Groove API")]
6 | [assembly: AssemblyConfiguration("")]
7 | [assembly: AssemblyCompany("Microsoft")]
8 | [assembly: AssemblyProduct("Microsoft.Groove.Api.Samples")]
9 | [assembly: AssemblyCopyright("Copyright © 2016")]
10 | [assembly: AssemblyTrademark("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | [assembly: AssemblyVersion("1.0.*")]
14 | [assembly: AssemblyFileVersion("1.0.0.0")]
15 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/samples/UniversalApplication/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/ViewModels/GrooveApiErrorViewModel.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.ViewModels
9 | {
10 | using System;
11 | using System.Diagnostics;
12 | using System.Threading.Tasks;
13 | using Windows.UI.Popups;
14 | using DataContract;
15 |
16 | public class GrooveApiErrorViewModel
17 | {
18 | public async Task HandleGrooveApiErrorAsync(Error error)
19 | {
20 | if (error == null)
21 | {
22 | Debug.WriteLine("Successful Groove API call");
23 | }
24 | else
25 | {
26 | Debug.WriteLine($"Groove API error: {error.ErrorCode}");
27 | Debug.WriteLine($"Groove API error message: {error.Message}");
28 | Debug.WriteLine($"Groove API error description: {error.Description}");
29 |
30 | MessageDialog errorPopup = new MessageDialog(
31 | $"{error.ErrorCode} : {error.Message}. {error.Description}",
32 | "Groove API error");
33 | await errorPopup.ShowAsync();
34 | }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/samples/UniversalApplication/ViewModels/MusicContentPaneViewModel.cs:
--------------------------------------------------------------------------------
1 | // ------------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation.
3 | // All Rights Reserved.
4 | // Licensed under the MIT License.
5 | // See License in the project root for license information.
6 | // ------------------------------------------------------------------------------
7 |
8 | namespace Microsoft.Groove.Api.Samples.ViewModels
9 | {
10 | using System.Collections.Generic;
11 | using System.Collections.ObjectModel;
12 | using System.ComponentModel;
13 | using System.Runtime.CompilerServices;
14 | using System.Threading.Tasks;
15 | using Client;
16 | using DataContract;
17 |
18 | public class MusicContentPaneViewModel : INotifyPropertyChanged
19 | {
20 | private ObservableCollection