Windows 10 RTM Release - August 2015 Update

This commit is contained in:
Raymond Chen 2015-08-06 10:55:02 -07:00
Родитель 714722f53c
Коммит 4968d97b7e
317 изменённых файлов: 6589 добавлений и 2910 удалений

2
.gitattributes поставляемый
Просмотреть файл

@ -19,8 +19,10 @@
*.inf text eol=crlf
*.inx text eol=crlf
*.js text eol=crlf
*.json text eol=crlf
*.jsproj text eol=crlf
*.rc text eol=crlf
*.resjson text eol=crlf
*.rgs text eol=crlf
*.sln text eol=crlf
*.vcxproj text eol=crlf

Просмотреть файл

@ -1,7 +1,9 @@
# Universal Windows app samples
This repo contains the samples that demonstrate the API usage patterns for the Universal Windows Platform (UWP) in the Windows Software Development Kit (SDK) for Windows 10. These code samples were created with the Universal Windows templates available in Visual Studio, and are designed to run on desktop, mobile, and future devices that support the Universal Windows Platform.
## Universal Windows Platform development
These samples require Visual Studio 2015 and the Windows Software Development Kit (SDK) for Windows 10 to build, test, and deploy your Universal Windows apps.
[Get a free copy of Visual Studio 2015 Community Edition with support for building Universal Windows apps](http://go.microsoft.com/fwlink/?LinkID=280676)
@ -11,17 +13,30 @@ Additionally, to stay on top of the latest updates to Windows and the developmen
[Become a Windows Insider](https://insider.windows.com/)
## Using the samples
The easiest way to use these samples without using Git is to download the zip file containing the current version (using the link below or by clicking the "Download ZIP" button on the repo page). You can then unzip the samples and use them in Visual Studio 2015.
The easiest way to use these samples without using Git is to download the zip file containing the current version (using the link below or by clicking the "Download ZIP" button on the repo page). You can then unzip the entire archive and use the samples in Visual Studio 2015.
[Download the samples ZIP](../../archive/master.zip)
**Notes:**
* Before you unzip the archive, right-click it, select Properties, and then select Unblock.
* Be sure to unzip the entire archive, and not just individual samples. The samples all depend on the SharedContent folder in the archive.
* In Visual Studio 2015, the platform target defaults to ARM, so be sure to change that to x64 or x86 if you want to test on a non-ARM device.
The samples use Linked files in Visual Studio to reduce duplication of common files, including sample template files and image assets. These common files are stored in the SharedContent folder at the root of the repository and referred to in the project files using links.
**Reminder:** If you unzip individual samples, they will not build due to references to other portions of the ZIP file that were not unzipped. You must unzip the entire archive if you intend to build the samples.
For more info about the programming models, platforms, languages, and APIs demonstrated in these samples, please refer to the guidance, tutorials, and reference topics provided in the Windows 10 documentation available in the [Windows Developer Center](https://dev.windows.com). These samples are provided as-is in order to indicate or demonstrate the functionality of the programming models and feature APIs for Windows.
## Contributions
These samples are direct from the feature teams and we welcome your input on issues and suggestions for new samples. At this time we are not accepting new samples from the public, but check back here as we evolve our contribution model.
## See also
For additional Windows samples, see [Windows on GitHub](http://microsoft.github.io/windows/).
## Samples by category
<table>
@ -116,44 +131,45 @@ These samples are direct from the feature teams and we welcome your input on iss
<tr>
<td><a href="Samples/XamlContextMenu">Context menu (XAML)</a></td>
<td><a href="Samples/DWriteTextLayoutCloudFont">Downloadable fonts (DirectWrite)</a></td>
<td><a href="Samples/DWriteLineSpacingModes">Line spacing (DirectWrite)</a></td>
<td><a href="Samples/XamlDragAndDrop">Drag and drop</a></td>
</tr>
<tr>
<td><a href="Samples/DWriteLineSpacingModes">Line spacing (DirectWrite)</a></td>
<td><a href="Samples/XamlFocusVisuals">Focus visuals</a></td>
<td><a href="Samples/FullScreenMode">Full screen mode</a></td>
<td><a href="Samples/WebView">HTML WebView control</a></td>
</tr>
<tr>
<td><a href="Samples/WebView">HTML WebView control</a></td>
<td><a href="Samples/XamlListView">ListView and GridView</a></td>
<td><a href="Samples/LockScreenApps">Lock screen apps</a></td>
<td><a href="Samples/MessageDialog">Message dialog</a></td>
</tr>
<tr>
<td><a href="Samples/MessageDialog">Message dialog</a></td>
<td><a href="Samples/MultipleViews">Multiple views</a></td>
<td><a href="Samples/OCR">OCR</a></td>
<td><a href="Samples/Printing">Printing</a></td>
</tr>
<tr>
<td><a href="Samples/Printing">Printing</a></td>
<td><a href="Samples/XamlPullToRefresh">Pull to refresh</a></td>
<td><a href="Samples/ResizeAppView">Window resizing</a></td>
<td><a href="Samples/DpiScaling">Scaling according to DPI</a></td>
</tr>
<tr>
<td><a href="Samples/DpiScaling">Scaling according to DPI</a></td>
<td><a href="Samples/SplashScreen">Splash screen</a></td>
<td><a href="Samples/XamlStateTriggers">State triggers</a></td>
<td><a href="Samples/TitleBar">Title bar</a></td>
</tr>
<tr>
<td><a href="Samples/TitleBar">Title bar</a></td>
<td><a href="Samples/UserSelection">Disabling selection</a></td>
<td><a href="Samples/UserInteractionMode">User interaction mode</a></td>
<td><a href="Samples/XamlCommanding">Commanding</a></td>
</tr>
<tr>
<td><a href="Samples/XamlCommanding">Commanding</a></td>
<td><a href="Samples/XamlCloudFontIntegration">Downloadable fonts (XAML)</a></td>
<td><a href="Samples/XamlResponsiveTechniques">Responsiveness techniques</a></td>
<td><a href="Samples/XamlTailoredMultipleViews">Tailored multiple views</a></td>
</tr>
<tr>
<td><a href="Samples/XamlTailoredMultipleViews">Tailored multiple views</a></td>
<td><a href="Samples/XamlUIBasics">XAML UI basics</a></td>
</tr>
</table>
@ -212,10 +228,10 @@ These samples are direct from the feature teams and we welcome your input on iss
<tr>
<td><a href="Samples/Accelerometer">Accelerometer</a></td>
<td><a href="Samples/ActivitySensor">Activity detection sensor</a></td>
<td><a href="Samples/ConsumerExperiences">AllJoyn consumer experiences</a></td>
<td><a href="Samples/AllJoyn/ConsumerExperiences">AllJoyn Consumer experiences</a></td>
</tr>
<tr>
<td><a href="Samples/ProducerExperiences">AllJoyn producer experiences</a></td>
<td><a href="Samples/AllJoyn/ProducerExperiences">AllJoyn Producer experiences</a></td>
<td><a href="Samples/Altimeter">Altimeter</a></td>
<td><a href="Samples/BackgroundSensors">Background sensors</a></td>
</tr>
@ -334,7 +350,7 @@ These samples are direct from the feature teams and we welcome your input on iss
<th colspan="3" align="left">Identity, security, and encryption</th>
</tr>
<tr>
<td><a href="Samples/AccountPictureName">Account picture name</a></td>
<td><a href="Samples/UserInfo">User information</a></td>
<td><a href="Samples/PasswordVault">Credential locker</a></td>
<td><a href="Samples/CredentialPicker">Credential picker</a></td>
</tr>
@ -376,11 +392,12 @@ These samples are direct from the feature teams and we welcome your input on iss
<th colspan="3" align="left">Navigation</th>
</tr>
<tr>
<td><a href="Samples/BackButton">Back Button</a></td>
<td><a href="Samples/XamlMasterDetail">Master/detail</a></td>
<td><a href="Samples/XamlPivot">Pivot</a></td>
<td><a href="Samples/Projection">Projection</a></td>
</tr>
<tr>
<td><a href="Samples/Projection">Projection</a></td>
<td><a href="Samples/XamlNavigation">XAML navigation menu</a></td>
<td><a href="Samples/PackagedContent">XHR, handling navigation errors, and URL schemes</a></td>
</tr>
@ -451,7 +468,7 @@ These samples are direct from the feature teams and we welcome your input on iss
<th colspan="3" align="left">Tiles, toasts, and notifications</th>
</tr>
<tr>
<td><a href="Samples/Notifications">Badge</a></td>
<td><a href="Samples/Notifications">Notifications</a></td>
<td><a href="Samples/SecondaryTiles">Secondary tiles</a></td>
</tr>
</table>

Просмотреть файл

@ -1,4 +1,4 @@
<!---
<!---
category: DevicesSensorsAndPower
--->
@ -54,9 +54,10 @@ When you choose the **Enable** button for the **Data Events** option, the app be
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++ or C\#. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,53 +0,0 @@
<!---
category: IdentitySecurityAndEncryption
--->
# Account picture name sample
This sample demonstrates different ways of getting the name of the user that is currently logged in. It also demonstrates how to get and set the image used for the user's tile.
Specifically, this sample demonstrates the following scenarios:
- How to get the [**DisplayName**](http://msdn.microsoft.com/library/windows/apps/hh921595) for the current logged on user.
- How to get the first and last name for the current logged on user. (This is available only for Microsoft accounts. An empty string is returned if a Microsoft account is not available.)
- How to obtain the logged on user's account picture as a bitmap. You can get request three different types: small, large, and video. If the size that is requested is not available an empty file is returned.
- How to set the account picture for the currently logged on user. You can set three different types: small, large, and video. (More than one type can be set in the same call, but a small image must be accompanied by a large image and/or video.)
- How to register for a change event for account picture updates.
**Note** The Universal Windows app samples require Visual Studio 2015 to build and Windows 10 to execute.
To obtain information about Windows 10, go to [Windows 10](http://go.microsoft.com/fwlink/?LinkID=532421)
To obtain information about Microsoft Visual Studio 2015 and the tools for developing Windows apps, go to [Visual Studio 2015](http://go.microsoft.com/fwlink/?LinkID=532422)
## Related topics
### Reference
[**Windows.System.UserProfile** namespace](http://msdn.microsoft.com/library/windows/apps/br241881)
## System requirements
**Client:** Windows 10
**Server:** Windows Server 2016 Technical Preview
**Phone:** Not supported
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
### Deploying the sample
- Select Build > Deploy Solution.
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging.

Просмотреть файл

@ -1,155 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include "GetAccountPicture.xaml.h"
using namespace SDKTemplate;
using namespace concurrency;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Storage;
using namespace Windows::Storage::Streams;
using namespace Windows::System::UserProfile;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Media::Imaging;
using namespace Windows::UI::Xaml::Navigation;
GetAccountPicture::GetAccountPicture() : rootPage(MainPage::Current)
{
InitializeComponent();
}
void GetAccountPicture::GetSmallImageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
HideImageAndVideoControls();
if (UserInformation::NameAccessAllowed)
{
auto smallImageFile = UserInformation::GetAccountPicture(AccountPictureKind::SmallImage);
if (smallImageFile != nullptr)
{
rootPage->NotifyUser("Path = " + smallImageFile->Path, NotifyType::StatusMessage);
create_task(smallImageFile->OpenReadAsync()).then(
[this](task<IRandomAccessStreamWithContentType^> imageStreamTask)
{
try
{
auto imageStream = imageStreamTask.get();
auto bitmapImage = ref new BitmapImage();
bitmapImage->SetSource(imageStream);
SmallImage->Source = bitmapImage;
SmallImage->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
catch (Exception^ ex)
{
rootPage->NotifyUser("Error opening stream: " + ex->Message, NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("Small account picture is not available.", NotifyType::ErrorMessage);
}
}
else
{
rootPage->NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}
void GetAccountPicture::GetLargeImageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
HideImageAndVideoControls();
if (UserInformation::NameAccessAllowed)
{
auto largeImageFile = UserInformation::GetAccountPicture(AccountPictureKind::LargeImage);
if (largeImageFile != nullptr)
{
rootPage->NotifyUser("Path = " + largeImageFile->Path, NotifyType::StatusMessage);
create_task(largeImageFile->OpenReadAsync()).then(
[this](task<IRandomAccessStreamWithContentType^> imageStreamTask)
{
try
{
auto imageStream = imageStreamTask.get();
auto bitmapImage = ref new BitmapImage();
bitmapImage->SetSource(imageStream);
LargeImage->Source = bitmapImage;
LargeImage->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
catch (Exception^ ex)
{
rootPage->NotifyUser("Error opening stream: " + ex->Message, NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("No large account picture image returned for current user.", NotifyType::ErrorMessage);
}
}
else
{
rootPage->NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}
void GetAccountPicture::GetVideoButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
HideImageAndVideoControls();
if (UserInformation::NameAccessAllowed)
{
auto videoFile = UserInformation::GetAccountPicture(AccountPictureKind::Video);
if (videoFile != nullptr)
{
rootPage->NotifyUser("Path = " + videoFile->Path, NotifyType::StatusMessage);
create_task(videoFile->OpenReadAsync()).then(
[this](task<IRandomAccessStreamWithContentType^> videoStreamTask)
{
try
{
auto videoStream = videoStreamTask.get();
MediaPlayer->SetSource(videoStream, "video/mp4");
MediaPlayer->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
catch (Exception^ ex)
{
rootPage->NotifyUser("Error opening stream: " + ex->Message, NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("Video is not available.", NotifyType::ErrorMessage);
}
}
else
{
rootPage->NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}
void GetAccountPicture::HideImageAndVideoControls()
{
SmallImage->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
LargeImage->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
MediaPlayer->Visibility = Windows::UI::Xaml::Visibility::Collapsed;
}

Просмотреть файл

@ -1,31 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include "GetAccountPicture.g.h"
#include "MainPage.xaml.h"
namespace SDKTemplate
{
[Windows::Foundation::Metadata::WebHostHidden]
public ref class GetAccountPicture sealed
{
public:
GetAccountPicture();
private:
MainPage^ rootPage;
void GetSmallImageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void GetLargeImageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void GetVideoButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void HideImageAndVideoControls();
};
}

Просмотреть файл

@ -1,55 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include "GetUserDisplayName.xaml.h"
using namespace SDKTemplate;
using namespace concurrency;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::System::UserProfile;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
GetUserDisplayName::GetUserDisplayName() : rootPage(SDKTemplate::MainPage::Current)
{
InitializeComponent();
}
void GetUserDisplayName::GetDisplayNameButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
if (UserInformation::NameAccessAllowed)
{
create_task(UserInformation::GetDisplayNameAsync()).then([this](String^ displayName)
{
if (displayName != nullptr)
{
rootPage->NotifyUser("Display name = " + displayName, NotifyType::StatusMessage);
}
else
{
rootPage->NotifyUser("No display name was returned.", NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}

Просмотреть файл

@ -1,77 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include "GetUserFirstAndLastName.xaml.h"
using namespace SDKTemplate;
using namespace concurrency;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::System::UserProfile;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
GetUserFirstAndLastName::GetUserFirstAndLastName() : rootPage(MainPage::Current)
{
InitializeComponent();
}
void GetUserFirstAndLastName::GetFirstNameButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
if (UserInformation::NameAccessAllowed)
{
create_task(UserInformation::GetFirstNameAsync()).then([this](String^ firstName)
{
if (firstName != nullptr)
{
rootPage->NotifyUser("First name = " + firstName, NotifyType::StatusMessage);
}
else
{
rootPage->NotifyUser("No first name was returned.", NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}
void GetUserFirstAndLastName::GetLastNameButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
if (UserInformation::NameAccessAllowed)
{
create_task(UserInformation::GetLastNameAsync()).then([this](String^ lastName)
{
if (lastName != nullptr)
{
rootPage->NotifyUser("Last name = " + lastName, NotifyType::StatusMessage);
}
else
{
rootPage->NotifyUser("No last name was returned.", NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}

Просмотреть файл

@ -1,29 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#pragma once
#include "GetUserFirstAndLastName.g.h"
#include "MainPage.xaml.h"
namespace SDKTemplate
{
[Windows::Foundation::Metadata::WebHostHidden]
public ref class GetUserFirstAndLastName sealed
{
public:
GetUserFirstAndLastName();
private:
MainPage^ rootPage;
void GetFirstNameButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
void GetLastNameButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
};
}

Просмотреть файл

@ -1,50 +0,0 @@
// Copyright (c) Microsoft. All rights reserved.
#include "pch.h"
#include "MainPage.xaml.h"
#include "SampleConfiguration.h"
using namespace SDKTemplate;
using namespace Platform;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Interop;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Navigation;
Platform::Array<Scenario>^ MainPage::scenariosInner = ref new Platform::Array<Scenario>
{
{ "Get display name", "SDKTemplate.GetUserDisplayName" },
{ "Get first and last name", "SDKTemplate.GetUserFirstAndLastName" },
{ "Get account picture", "SDKTemplate.GetAccountPicture" },
{ "Set account picture and listen for changes", "SDKTemplate.SetAccountPicture" }
};
void App::OnActivated(IActivatedEventArgs^ args)
{
// Check to see if the app was activated via a protocol
if (args->Kind == ActivationKind::Protocol)
{
auto protocolArgs = safe_cast<ProtocolActivatedEventArgs^>(args);
if (protocolArgs->Uri->SchemeName->Equals("ms-accountpictureprovider"))
{
if (Window::Current->Content == nullptr)
{
auto rootFrame = ref new Frame();
TypeName pageType = { "SDKTemplate.MainPage", TypeKind::Custom };
rootFrame->Navigate(pageType);
Window::Current->Content = rootFrame;
Window::Current->Activate();
}
MainPage::Current->NavigateToScenario("SDKTemplate.SetAccountPicture");
}
}
}

Просмотреть файл

@ -1,160 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
#include "pch.h"
#include "SetAccountPicture.xaml.h"
using namespace SDKTemplate;
using namespace concurrency;
using namespace Platform;
using namespace Windows::Foundation;
using namespace Windows::Foundation::Collections;
using namespace Windows::Storage;
using namespace Windows::Storage::Streams;
using namespace Windows::Storage::Pickers;
using namespace Windows::System::UserProfile;
using namespace Windows::UI::Core;
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Controls::Primitives;
using namespace Windows::UI::Xaml::Data;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Media;
using namespace Windows::UI::Xaml::Media::Imaging;
using namespace Windows::UI::Xaml::Navigation;
SetAccountPicture::SetAccountPicture() : rootPage(MainPage::Current)
{
InitializeComponent();
}
void SetAccountPicture::OnNavigatedTo(NavigationEventArgs^ e)
{
accountPictureChangedToken = UserInformation::AccountPictureChanged += ref new EventHandler<Object^>(this, &SetAccountPicture::PictureChanged);
}
void SetAccountPicture::OnNavigatedFrom(NavigationEventArgs^ e)
{
UserInformation::AccountPictureChanged -= accountPictureChangedToken;
}
void SetAccountPicture::SetImageButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
FileOpenPicker^ imagePicker = ref new FileOpenPicker();
imagePicker->ViewMode = PickerViewMode::Thumbnail;
imagePicker->SuggestedStartLocation = PickerLocationId::PicturesLibrary;
imagePicker->FileTypeFilter->Append(".jpg");
imagePicker->FileTypeFilter->Append(".jpeg");
imagePicker->FileTypeFilter->Append(".png");
imagePicker->FileTypeFilter->Append(".bmp");
create_task(imagePicker->PickSingleFileAsync()).then(
[this](StorageFile^ imageFile)
{
if (imageFile != nullptr)
{
rootPage->NotifyUser("Setting " + imageFile->Name + " as account picture ...",
NotifyType::StatusMessage);
create_task(UserInformation::SetAccountPictureAsync(imageFile)).then(
[this](SetAccountPictureResult setPictureResult)
{
if (setPictureResult == SetAccountPictureResult::Success)
{
rootPage->NotifyUser("Successfully updated account picture.", NotifyType::StatusMessage);
}
else
{
rootPage->NotifyUser("Setting account picture failed.", NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("No image was selected.", NotifyType::StatusMessage);
}
});
}
void SetAccountPicture::SetVideoButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
FileOpenPicker^ videoPicker = ref new FileOpenPicker();
videoPicker->ViewMode = PickerViewMode::Thumbnail;
videoPicker->SuggestedStartLocation = PickerLocationId::PicturesLibrary;
videoPicker->FileTypeFilter->Append(".mp4");
videoPicker->FileTypeFilter->Append(".wmv");
videoPicker->FileTypeFilter->Append(".mpeg");
videoPicker->FileTypeFilter->Append(".mov");
create_task(videoPicker->PickSingleFileAsync()).then(
[this](StorageFile^ videoFile)
{
if (videoFile != nullptr)
{
rootPage->NotifyUser("Setting " + videoFile->Name + " as account picture ...",
NotifyType::StatusMessage);
create_task(UserInformation::SetAccountPictureAsync(videoFile)).then(
[this](SetAccountPictureResult setPictureResult)
{
if (setPictureResult == SetAccountPictureResult::Success)
{
rootPage->NotifyUser("Successfully updated account picture.", NotifyType::StatusMessage);
}
else
{
rootPage->NotifyUser("Setting account picture failed.", NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("No video was selected.", NotifyType::StatusMessage);
}
});
}
void SetAccountPicture::PictureChanged(Platform::Object^ sender, Platform::Object^ e)
{
Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this]()
{
if (UserInformation::NameAccessAllowed)
{
auto largeImageFile = UserInformation::GetAccountPicture(AccountPictureKind::LargeImage);
if (largeImageFile != nullptr)
{
create_task(largeImageFile->OpenReadAsync()).then(
[this](task<IRandomAccessStreamWithContentType^> imageStreamTask)
{
try
{
auto imageStream = imageStreamTask.get();
auto bitmapImage = ref new BitmapImage();
bitmapImage->SetSource(imageStream);
AccountPictureImage->Source = bitmapImage;
AccountPictureImage->Visibility = Windows::UI::Xaml::Visibility::Visible;
}
catch (Exception^ ex)
{
rootPage->NotifyUser("Failed to read from stream. " + ex->Message, NotifyType::ErrorMessage);
}
});
}
else
{
rootPage->NotifyUser("No large account picture image returned for current user.", NotifyType::ErrorMessage);
}
}
else
{
rootPage->NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType::ErrorMessage);
}
}));
}

Просмотреть файл

@ -1,43 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22609.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccountPictureName", "AccountPictureName.csproj", "{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.ActiveCfg = Debug|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.Build.0 = Debug|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|ARM.Deploy.0 = Debug|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x64.ActiveCfg = Debug|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x64.Build.0 = Debug|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x64.Deploy.0 = Debug|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.ActiveCfg = Debug|x86
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.Build.0 = Debug|x86
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Debug|x86.Deploy.0 = Debug|x86
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.ActiveCfg = Release|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.Build.0 = Release|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|ARM.Deploy.0 = Release|ARM
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x64.ActiveCfg = Release|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x64.Build.0 = Release|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x64.Deploy.0 = Release|x64
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.ActiveCfg = Release|x86
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.Build.0 = Release|x86
{CF1CD0D5-BF6B-457A-9927-8079FC667CA4}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,151 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Media.Imaging;
using Windows.System.UserProfile;
namespace SDKTemplate
{
public sealed partial class GetAccountPicture : Page
{
private MainPage rootPage;
public GetAccountPicture()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
}
private async void GetSmallImageButton_Click(object sender, RoutedEventArgs e)
{
HideImageAndVideoControls();
if (UserInformation.NameAccessAllowed)
{
// The small picture returned by GetAccountPicture() is 96x96 pixels in size.
StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.SmallImage) as StorageFile;
if (image != null)
{
rootPage.NotifyUser("Path = " + image.Path, NotifyType.StatusMessage);
try
{
IRandomAccessStream imageStream = await image.OpenReadAsync();
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(imageStream);
SmallImage.Source = bitmapImage;
SmallImage.Visibility = Visibility.Visible;
}
catch (Exception ex)
{
rootPage.NotifyUser("Error opening stream: " + ex.ToString(), NotifyType.ErrorMessage);
}
}
else
{
rootPage.NotifyUser("Small account picture is not available.", NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
private async void GetLargeImageButton_Click(object sender, RoutedEventArgs e)
{
HideImageAndVideoControls();
if (UserInformation.NameAccessAllowed)
{
// The large picture returned by GetAccountPicture() is 448x448 pixels in size.
StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile;
if (image != null)
{
rootPage.NotifyUser("Path = " + image.Path, NotifyType.StatusMessage);
try
{
IRandomAccessStream imageStream = await image.OpenReadAsync();
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(imageStream);
LargeImage.Source = bitmapImage;
LargeImage.Visibility = Visibility.Visible;
}
catch (Exception ex)
{
rootPage.NotifyUser("Error opening stream: " + ex.ToString(), NotifyType.ErrorMessage);
}
}
else
{
rootPage.NotifyUser("Large account picture is not available.", NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
private async void GetVideoButton_Click(object sender, RoutedEventArgs e)
{
HideImageAndVideoControls();
if (UserInformation.NameAccessAllowed)
{
// The video returned from getAccountPicture is 448x448 pixels in size.
StorageFile video = UserInformation.GetAccountPicture(AccountPictureKind.Video) as StorageFile;
if (video != null)
{
rootPage.NotifyUser("Path: " + video.Path, NotifyType.StatusMessage);
try
{
IRandomAccessStream videoStream = await video.OpenAsync(FileAccessMode.Read);
MediaPlayer.SetSource(videoStream, "video/mp4");
MediaPlayer.Visibility = Visibility.Visible;
}
catch (Exception ex)
{
rootPage.NotifyUser("Error opening stream: " + ex.ToString(), NotifyType.ErrorMessage);
}
}
else
{
rootPage.NotifyUser("Video is not available.", NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to account picture disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
private void HideImageAndVideoControls()
{
SmallImage.Visibility = Visibility.Collapsed;
LargeImage.Visibility = Visibility.Collapsed;
MediaPlayer.Visibility = Visibility.Collapsed;
}
}
}

Просмотреть файл

@ -1,54 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System;
using Windows.System.UserProfile;
namespace SDKTemplate
{
public sealed partial class GetUserDisplayName : Page
{
private MainPage rootPage;
public GetUserDisplayName()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
}
private async void GetDisplayNameButton_Click(object sender, RoutedEventArgs e)
{
if (UserInformation.NameAccessAllowed)
{
string displayName = await UserInformation.GetDisplayNameAsync();
if (string.IsNullOrEmpty(displayName))
{
rootPage.NotifyUser("No display name was returned.", NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("Display name = " + displayName, NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
}
}

Просмотреть файл

@ -1,74 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System;
using Windows.System.UserProfile;
namespace SDKTemplate
{
public sealed partial class GetUserFirstAndLastName : Page
{
private MainPage rootPage;
public GetUserFirstAndLastName()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
}
private async void GetFirstNameButton_Click(object sender, RoutedEventArgs e)
{
if (UserInformation.NameAccessAllowed)
{
string firstName = await UserInformation.GetFirstNameAsync();
if (string.IsNullOrEmpty(firstName))
{
rootPage.NotifyUser("No first name was returned.", NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("First name = " + firstName, NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
private async void GetLastNameButton_Click(object sender, RoutedEventArgs e)
{
if (UserInformation.NameAccessAllowed)
{
string lastName = await UserInformation.GetLastNameAsync();
if (string.IsNullOrEmpty(lastName))
{
rootPage.NotifyUser("No last name was returned.", NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("Last name = " + lastName, NotifyType.StatusMessage);
}
}
else
{
rootPage.NotifyUser("Access to name disabled by Privacy Setting or Group Policy.", NotifyType.ErrorMessage);
}
}
}
}

Просмотреть файл

@ -1,82 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Collections.Generic;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace SDKTemplate
{
public partial class MainPage : Page
{
public const string FEATURE_NAME = "Account picture name C# sample";
List<Scenario> scenarios = new List<Scenario>
{
new Scenario() { Title = "Get display name", ClassType = typeof(GetUserDisplayName) },
new Scenario() { Title = "Get first and last name", ClassType = typeof(GetUserFirstAndLastName) },
new Scenario() { Title = "Get account picture", ClassType = typeof(GetAccountPicture) },
new Scenario() { Title = "Set account picture and listen for changes", ClassType = typeof(SetAccountPicture) }
};
public void NavigateToScenario(Type type)
{
for (int index = 0; index < scenarios.Count; index++)
{
if (scenarios[index].ClassType == type)
{
ScenarioControl.SelectedIndex = index;
break;
}
}
}
}
public class Scenario
{
public string Title { get; set; }
public Type ClassType { get; set; }
}
/// <summary>
/// Provides sample-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
protected override void OnActivated(IActivatedEventArgs args)
{
// Check to see if the app was activated via a protocol
if (args.Kind == ActivationKind.Protocol)
{
var protocolArgs = (ProtocolActivatedEventArgs)args;
// This app was activated via the Account picture apps section in PC Settings / Personalize / Account picture.
// Here you would do app-specific logic so that the user receives account picture selection UX.
if (protocolArgs.Uri.Scheme == "ms-accountpictureprovider")
{
// The Content might be null if App has not yet been activated, if so first activate the main page.
if (Window.Current.Content == null)
{
Frame rootFrame = new Frame();
rootFrame.Navigate(typeof(MainPage));
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
MainPage.Current.NavigateToScenario(typeof(SDKTemplate.SetAccountPicture));
}
}
}
}
}

Просмотреть файл

@ -1,158 +0,0 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using System;
using System.Linq;
using System.Collections.Generic;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Core;
using Windows.Storage.Pickers;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Media.Imaging;
using Windows.System.UserProfile;
namespace SDKTemplate
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SetAccountPicture : Page
{
MainPage rootPage = MainPage.Current;
public SetAccountPicture()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
//Listen to AccountPictureChanged event
UserInformation.AccountPictureChanged += this.PictureChanged;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
//Remove listener to AccountPictureChanged event
UserInformation.AccountPictureChanged -= this.PictureChanged;
}
private async void SetImageButton_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker imagePicker = new FileOpenPicker
{
ViewMode = PickerViewMode.Thumbnail,
SuggestedStartLocation = PickerLocationId.PicturesLibrary,
FileTypeFilter = { ".jpg", ".jpeg", ".png", ".bmp" }
};
StorageFile imageFile = await imagePicker.PickSingleFileAsync();
if (imageFile != null)
{
// SetAccountPictureAsync() accepts 3 storageFile objects for setting the small image, large image, and video.
// More than one type can be set in the same call, but a small image must be accompanied by a large image and/or video.
// If only a large image is passed, the small image will be autogenerated.
// If only a video is passed, the large image and small will be autogenerated.
// Videos must be convertable to mp4, <=5MB, and height and width >= 448 pixels.
// Setting the Account Picture will fail if user disallows it in PC Settings.
SetAccountPictureResult result = await UserInformation.SetAccountPicturesAsync(null, imageFile, null);
if (result == SetAccountPictureResult.Success)
{
rootPage.NotifyUser("Account picture was successfully changed.", NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("Account picture could not be changed.", NotifyType.StatusMessage);
AccountPictureImage.Visibility = Visibility.Collapsed;
}
}
}
private async void SetVideoButton_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker videoPicker = new FileOpenPicker
{
ViewMode = PickerViewMode.Thumbnail,
SuggestedStartLocation = PickerLocationId.VideosLibrary,
FileTypeFilter = { ".mp4", ".mpeg", ".wmv", ".mov" }
};
StorageFile videoFile = await videoPicker.PickSingleFileAsync();
if (videoFile != null)
{
// SetAccountPictureAsync() accepts 3 storageFile objects for setting the small image, large image, and video.
// More than one type can be set in the same call, but small image must be accompanied by a large image and/or video.
// If only a large image is passed, the small image will be autogenerated.
// If only a video is passed, the large image and small will be autogenerated.
// Videos must be convertable to mp4, <=5MB, and height and width >= 448 pixels.
// Setting the Account Picture will fail if a user disallows it in PC Settings.
SetAccountPictureResult result = await UserInformation.SetAccountPicturesAsync(null, null, videoFile);
if (result == SetAccountPictureResult.Success)
{
rootPage.NotifyUser("Video account picture was successfully changed.", NotifyType.StatusMessage);
}
else
{
rootPage.NotifyUser("Account picture could not be changed.", NotifyType.StatusMessage);
AccountPictureImage.Visibility = Visibility.Collapsed;
}
}
}
private async void PictureChanged(object sender, object e)
{
await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
// The large picture returned by GetAccountPicture() is 448x448 pixels in size.
StorageFile image = UserInformation.GetAccountPicture(AccountPictureKind.LargeImage) as StorageFile;
if (image != null)
{
try
{
IRandomAccessStream imageStream = await image.OpenReadAsync();
BitmapImage bitmapImage = new BitmapImage();
bitmapImage.SetSource(imageStream);
rootPage.NotifyUser("LargeImage path = " + image.Path, NotifyType.StatusMessage);
AccountPictureImage.Source = bitmapImage;
AccountPictureImage.Visibility = Visibility.Visible;
}
catch (Exception ex)
{
rootPage.NotifyUser("Error opening stream: " + ex.ToString(), NotifyType.ErrorMessage);
}
}
else
{
rootPage.NotifyUser("Large Account Picture is not available.", NotifyType.StatusMessage);
}
});
}
}
}

Просмотреть файл

@ -1,40 +0,0 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="/js/getAccountPicture.js"></script>
</head>
<body class="win-type-body">
<div id="scenarioView">
<div>
<h2 id="sampleHeader" class="win-type-subheader">Description:</h2>
<div id="scenarioDescription">
<p>Get the Account Picture for the current user. You can get request three different types: small, large, and video. If the size that is requested is not available an empty file is returned.</p>
</div>
</div>
<div id="scenarioContent">
<button id="getSmallImage" style="margin: 4px" class="win-button">
Get Small Image
</button>
<button id="getLargeImage" style="margin: 4px" class="win-button">
Get Large Image
</button>
<button id="getVideo" style="margin: 4px" class="win-button">
Get Video
</button>
<div>
<img class="imageHolder" style="vertical-align" id="smallImageHolder" alt="image holder" width="96" height="96">
<img class="imageHolder" id="largeImageHolder" alt="image holder" width="300" height="300">
<video id="videoHolder" controls width="300" height="300"></video>
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,38 +0,0 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="/js/setAccountPicture.js"></script>
</head>
<body class="win-type-body">
<div id="scenarioView">
<div>
<h2 id="sampleHeader" class="win-type-subheader">Description:</h2>
<div id="scenarioDescription">
<p>Set the Account Picture image for the current logon user. The setAccountPicture method takes three parameters as input: small image, large image, and video. More than one type can be set in the same call, but a small image must be accompanied
by a large image and/or video. Pass a null for parameters you don&apos;t want to set. A change event can be listened to for Account Picture updates. The images below change by listening to the update.</p>
</div>
</div>
<div id="scenarioContent">
<button id="setImage" class="action win-button">
Set image
</button>
<button id="setVideo" class="action win-button">
Set video
</button>
<img class="imageHolder" style="vertical-align: top" id="smallImageHolder" alt="image holder" width="96" height="96">
<img class="imageHolder" id="largeImageHolder" alt="image holder" width="300" height="300">
<video id="videoHolder" controls width="300" height="300">
Get Dynamic Account Picture video
</video>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,30 +0,0 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="/js/userFirstAndLastName.js"></script>
</head>
<body class="win-type-body">
<div id="scenarioView">
<div>
<h2 id="sampleHeader" class="win-type-subheader">Description:</h2>
<div id="scenarioDescription">
<p>Get the First and Last Name for the current user. This is only available for Microsoft Accounts, an empty string will be returned if not available.</p>
</div>
</div>
<button class="action win-button" id="getFirstName">
Get FirstName
</button>
<button class="action secondary win-button" id="getLastName">
Get LastName
</button>
</div>
</body>
</html>

Просмотреть файл

@ -1,71 +0,0 @@
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/getAccountPicture.html", {
ready: function (element, options) {
hideVisibleHolders();
document.getElementById("getSmallImage").addEventListener("click", getSmallImage, false);
document.getElementById("getLargeImage").addEventListener("click", getLargeImage, false);
document.getElementById("getVideo").addEventListener("click", getVideo, false);
}
});
function getSmallImage() {
hideVisibleHolders();
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
// The small picture returned by getAccountPicture() is 96x96 pixels in size.
var image = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.smallImage);
if (image) {
document.getElementById("smallImageHolder").style.visibility = "visible";
document.getElementById("smallImageHolder").src = URL.createObjectURL(image, { oneTimeOnly: true });
WinJS.log && WinJS.log("Path: " + image.path, "sample", "status");
} else {
WinJS.log && WinJS.log("Small account picture is not available.", "sample", "status");
}
} else {
WinJS.log && WinJS.log("Access to account picture disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
function getLargeImage() {
hideVisibleHolders();
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
// The large picture returned by getAccountPicture() is 448x448 pixels in size.
var image = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.largeImage);
if (image) {
document.getElementById("largeImageHolder").style.visibility = "visible";
document.getElementById("largeImageHolder").src = URL.createObjectURL(image, { oneTimeOnly: true });
WinJS.log && WinJS.log("Path: " + image.path, "sample", "status");
} else {
WinJS.log && WinJS.log("Large account picture is not available.", "sample", "status");
}
} else {
WinJS.log && WinJS.log("Access to account picture disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
function getVideo() {
hideVisibleHolders();
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
// The video returned from getAccountPicture is 448x448 pixels in size.
var video = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.video);
if (video) {
document.getElementById("videoHolder").style.visibility = "visible";
document.getElementById("videoHolder").src = URL.createObjectURL(video, { oneTimeOnly: true });
document.getElementById("videoHolder").play();
WinJS.log && WinJS.log("Path: " + video.path, "sample", "status");
} else {
WinJS.log && WinJS.log("Video is not available.", "sample", "status");
}
} else {
WinJS.log && WinJS.log("Access to account picture disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
function hideVisibleHolders() {
document.getElementById("smallImageHolder").style.visibility = "hidden";
document.getElementById("largeImageHolder").style.visibility = "hidden";
document.getElementById("videoHolder").style.visibility = "hidden";
}
})();

Просмотреть файл

@ -1,32 +0,0 @@
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var sampleTitle = "Account picture name JS sample";
var scenarios = [
{ url: "/html/userDisplayName.html", title: "Get display name" },
{ url: "/html/userFirstAndLastName.html", title: "Get first and last name" },
{ url: "/html/getAccountPicture.html", title: "Get account picture" },
{ url: "/html/setAccountPicture.html", title: "Set account picture and listen for changes" }
];
WinJS.Navigation.addEventListener("navigating", function (e) {
if (e.detail && e.detail.state && e.detail.state.activatedEventArgs) {
var uri = e.detail.state.activatedEventArgs[0].uri;
if (uri && uri.schemeName === "ms-accountpictureprovider") {
// This app was activated via the Account picture apps section in Settings.
// Here you would do app-specific logic for providing the user with account picture selection UX
setImmediate(function () {
WinJS.Navigation.navigate(scenarios[3].url).done();
});
}
}
});
WinJS.Namespace.define("SdkSample", {
sampleTitle: sampleTitle,
scenarios: new WinJS.Binding.List(scenarios)
});
})();

Просмотреть файл

@ -1,102 +0,0 @@
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/setAccountPicture.html", {
ready: function (element, options) {
hideVisibleHolders();
document.getElementById("setImage").addEventListener("click", setImage, false);
document.getElementById("setVideo").addEventListener("click", setVideo, false);
Windows.System.UserProfile.UserInformation.addEventListener("accountpicturechanged", accountPictureChanged);
}
});
function setImage() {
hideVisibleHolders();
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
openPicker.fileTypeFilter.replaceAll([".bmp", ".png", ".jpg", ".jpeg"]);
openPicker.pickSingleFileAsync().done(function (file) {
if (file) {
// setAccountPictureAsync() accepts 3 storageFile objects for setting the small image, large image, and video.
// More than one type can be set in the same call, but small image must be accompanied by a large image and/or video.
// If only a large image is passed, the small image will be autogenerated.
// If only a video is passed, the large image and small will be autogenerated.
// Videos must be convertable to mp4, <=5MB, and height and width >= 448 pixels.
Windows.System.UserProfile.UserInformation.setAccountPicturesAsync(null, file, null).done(function (result) {
// A user might turn off access to the Account Picture in PC Settings, therefore we need to check the result for success.
if (result === Windows.System.UserProfile.SetAccountPictureResult.success) {
WinJS.log && WinJS.log("Successfully updated account picture.", "sample", "status");
} else {
// A user might turn off access to the account
WinJS.log && WinJS.log("Setting account picture failed.", "sample", "status");
}
});
} else {
WinJS.log && WinJS.log("No image was selected.", "sample", "status");
}
});
}
function setVideo() {
hideVisibleHolders();
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.viewMode = Windows.Storage.Pickers.PickerViewMode.thumbnail;
openPicker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary;
openPicker.fileTypeFilter.replaceAll([".mov", ".mp4", ".wmv"]);
openPicker.pickSingleFileAsync().done(function (file) {
if (file) {
// setAccountPictureAsync() accepts 3 storageFile objects for setting the small image, large image, and video.
// More than one type can be set in the same call, but small image must be accompanied by a large image and/or video.
// If only a large image is passed, the small image will be autogenerated.
// If only a video is passed, the large image and small will be autogenerated.
// Videos must be convertable to mp4, <=5MB, and height and width >= 448 pixels.
Windows.System.UserProfile.UserInformation.setAccountPicturesAsync(null, null, file).done(function (result) {
// A user might turn off access to the Account Picture in PC Settings, therefore we need to check the result for success.
if (result === Windows.System.UserProfile.SetAccountPictureResult.success) {
WinJS.log && WinJS.log("Successfully updated account picture.", "sample", "status");
} else {
// A user might turn off access to the account
WinJS.log && WinJS.log("Setting account picture failed.", "sample", "status");
}
});
} else {
WinJS.log && WinJS.log("No video was selected.", "sample", "status");
}
});
}
// This function is the handler for the AccountPictureChangedEvent, the event listener is added in initialize() below.
function accountPictureChanged() {
hideVisibleHolders();
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
var smallImage = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.smallImage);
if (smallImage) {
document.getElementById("smallImageHolder").src = URL.createObjectURL(smallImage, { oneTimeOnly: true });
document.getElementById("smallImageHolder").style.visibility = "visible";
}
var largeImage = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.largeImage);
if (largeImage) {
document.getElementById("largeImageHolder").src = URL.createObjectURL(largeImage, { oneTimeOnly: true });
document.getElementById("largeImageHolder").style.visibility = "visible";
}
var video = Windows.System.UserProfile.UserInformation.getAccountPicture(Windows.System.UserProfile.AccountPictureKind.video);
if (video) {
document.getElementById("videoHolder").src = URL.createObjectURL(video, { oneTimeOnly: true });
document.getElementById("videoHolder").style.visibility = "visible";
}
} else {
WinJS.log && WinJS.log("Access to account picture disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
function hideVisibleHolders() {
document.getElementById("smallImageHolder").style.visibility = "hidden";
document.getElementById("largeImageHolder").style.visibility = "hidden";
document.getElementById("videoHolder").style.visibility = "hidden";
WinJS.log && WinJS.log(" ", "sample", "status");
}
})();

Просмотреть файл

@ -1,24 +0,0 @@
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/userDisplayName.html", {
ready: function (element, options) {
document.getElementById("getDisplayName").addEventListener("click", getDisplayName, false);
}
});
function getDisplayName() {
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
Windows.System.UserProfile.UserInformation.getDisplayNameAsync().done(function (result) {
if (result) {
WinJS.log && WinJS.log("Display name = " + result, "sample", "status");
} else {
WinJS.log && WinJS.log("No display name was returned.", "sample", "status");
}
});
} else {
WinJS.log && WinJS.log("Access to name disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
})();

Просмотреть файл

@ -1,39 +0,0 @@
//// Copyright (c) Microsoft Corporation. All rights reserved
(function () {
"use strict";
var page = WinJS.UI.Pages.define("/html/userFirstAndLastName.html", {
ready: function (element, options) {
document.getElementById("getFirstName").addEventListener("click", getFirstName, false);
document.getElementById("getLastName").addEventListener("click", getLastName, false);
}
});
function getFirstName() {
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
Windows.System.UserProfile.UserInformation.getFirstNameAsync().done(function (result) {
if (result) {
WinJS.log && WinJS.log("First name = " + result, "sample", "status");
} else {
WinJS.log && WinJS.log("No first name was returned.", "sample", "status");
}
});
} else {
WinJS.log && WinJS.log("Access to name disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
function getLastName() {
if (Windows.System.UserProfile.UserInformation.nameAccessAllowed) {
Windows.System.UserProfile.UserInformation.getLastNameAsync().done(function (result) {
if (result) {
WinJS.log && WinJS.log("Last name = " + result, "sample", "status");
} else {
WinJS.log && WinJS.log("No last name was returned.", "sample", "status");
}
});
} else {
WinJS.log && WinJS.log("Access to name disabled by Privacy Setting or Group Policy.", "sample", "error");
}
}
})();

Просмотреть файл

@ -1,59 +0,0 @@
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="SDKTemplate.GetAccountPicture"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="RootGrid" Margin="12,10,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
<Run>Get the Account Picture for the current user.</Run>
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel>
<TextBlock Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
<Run>You can request three different types: small, large and video (dynamic image). If the type that is requested is not available, an empty file is returned.</Run>
</TextBlock>
<VariableSizedWrapGrid Orientation="Horizontal" Margin="0,10,0,0">
<Button x:Name="GetSmallImageButton" Content="Get small image" Margin="0,0,10,0" Click="GetSmallImageButton_Click"/>
<Button x:Name="GetLargeImageButton" Content="Get large image" Margin="0,0,10,0" Click="GetLargeImageButton_Click"/>
<Button x:Name="GetVideoButton" Content="Get video" Margin="0,0,10,0" Click="GetVideoButton_Click"/>
</VariableSizedWrapGrid>
<Grid x:Name="Output" HorizontalAlignment="Left" VerticalAlignment="Top">
<Image x:Name="SmallImage" Visibility="Collapsed" AutomationProperties.Name="SmallImage placeholder" Width="96" Height="96" Margin="0,0,10,0" HorizontalAlignment="Left"/>
<Image x:Name="LargeImage" Visibility="Collapsed" AutomationProperties.Name="LargeImage placeholder" Width="448" Height="448" Margin="0,0,10,0" HorizontalAlignment="Left"/>
<MediaElement x:Name="MediaPlayer" Visibility="Collapsed" AutomationProperties.Name="Video placeholder" Width="448" Height="448" Margin="0,0,10,0" HorizontalAlignment="Left"/>
</Grid>
</StackPanel>
</ScrollViewer>
<!-- Status Block for providing messages to the user. Use the
NotifyUser() method to populate the message -->
<Border x:Name="ErrorBorder" Background="Red" Grid.Row="2"/>
<TextBlock x:Name="StatusBlock" Grid.Row="2" Margin="12, 10, 12, 10" Visibility="Collapsed"/>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -1,61 +0,0 @@
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="SDKTemplate.SetAccountPicture"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="12,10,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
<Run>Set the Account Picture for the current logon user.</Run>
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel>
<TextBlock Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
<Run>The SetAccountPicture method takes three parameters as input:
small image, large image, and video.
More than one type can be set in the same call,
but a small image must be accompanied by a large image and/or video.
Pass a null for parameters you don't want to set.
A change event can be listened to for Account Picture updates.
The images below change by listening to the update.</Run>
</TextBlock>
<VariableSizedWrapGrid Orientation="Horizontal" Margin="0,10,0,0">
<Button x:Name="SetImageButton" Content="Set image" Margin="0,0,10,0" Click="SetImageButton_Click"/>
<Button x:Name="SetVideoButton" Content="Set video" Margin="0,0,10,0" Click="SetVideoButton_Click"/>
</VariableSizedWrapGrid>
<VariableSizedWrapGrid Orientation="Horizontal" Margin="0,10,0,0">
<Image x:Name="AccountPictureImage" AutomationProperties.Name="LargeImage placeholder" Width="448" Height="448" Margin="0,0,10,0" HorizontalAlignment="Left"/>
</VariableSizedWrapGrid>
</StackPanel>
</ScrollViewer>
<!-- Status Block for providing messages to the user. Use the
NotifyUser() method to populate the message -->
<TextBlock x:Name="StatusBlock" Grid.Row="2" Margin="12, 10, 12, 10" Visibility="Collapsed"/>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# Activity Detection Sensor sample
# Activity detection sensor sample
This sample demonstrates the use of the Windows.Devices.Sensors.ActivitySensor API.
@ -39,9 +39,10 @@ Registers a background task for activity changes. The background task runs whene
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++ or C#. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: AudioVideoAndCamera
--->
# Adaptive Streaming Sample
# Adaptive streaming sample
How to create and use an AdaptiveMediaSource to playback HLS and DASH content over HTTP.
@ -31,9 +31,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C\# or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -1,8 +1,8 @@
<!---
category: AudioVideoAndCamera
--->
Advanced Casting Sample
-----------
# Advanced casting sample
This sample shows how to use the APIs in the **Windows.Media.Casting** and **Windows.Media.DialProtocol** namespaces. It also illustrates how to use the **Windows.UI.ViewManagement.ProjectionManager** and **Windows.Devices.Enumeration.DevicePicker** APIs to render media on a remote device. It covers sending media to various devices- Miracast, DLNA, DIAL, and Bluetooth. For an intro to casting, see the *Basic Media Casting Sample*.
@ -48,9 +48,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# AllJoyn Consumer Experiences Sample
# AllJoyn consumer experiences sample
This sample demonstrates how to create an AllJoyn Windows Universal app using Code Generation with Introspection XML and Windows.Devices.AllJoyn.

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# AllJoyn Producer Experiences Sample
# AllJoyn producer experiences sample
This sample demonstrates how to create an AllJoyn Windows Universal app using Code Generation with Introspection XML and Windows.Devices.AllJoyn.

Просмотреть файл

@ -29,9 +29,10 @@ When you choose the **Get Data** button for the **Polling** option, the app will
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,6 +1,7 @@
<!---
category: GraphicsAndAnimation
--->
# HTML animation library sample
This sample shows how to use the Animation Library APIs. These functions provide you with the ability to use animations in your Windows Store apps and custom controls that are consistent with animations used by Windows.
@ -128,9 +129,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,6 +1,7 @@
<!---
category: GraphicsAndAnimation
--->
# Animation metrics sample
This sample shows how to use the Animation Metrics APIs ([**Windows.UI.Core.AnimationMetrics**](http://msdn.microsoft.com/library/windows/apps/br241916) to access the raw parameters that define the animations in the Windows [Animation Library](http://msdn.microsoft.com/library/windows/apps/hh465165). This info can help developers of applications and application frameworks to create animations that are consistent with Windows and other apps that use the Windows Animation Library.
@ -36,9 +37,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,4 +1,8 @@
# App Services Sample
<!---
category: DeepLinksAndAppToAppCommunication
--->
# App services sample
This sample demonstrates how an app can provide a service that other apps can consume. [**Windows.ApplicationModel.AppServices**](https://msdn.microsoft.com/en-us/library/windows.applicationmodel.appservice.aspx) namespace. Some of the classes you might want to review in more detail are the [**AppServiceConnection**](https://msdn.microsoft.com/en-us/library/windows.applicationmodel.appservice.appserviceconnection.aspx) class, which you use to open a connection to an app service and send messages to it, and the [**AppServiceTriggerDetails**](https://msdn.microsoft.com/en-us/library/windows.applicationmodel.appservice.appservicetriggerdetails.aspx) class, which an app service can use to receive and respond to messages.
@ -21,9 +25,10 @@ To obtain an insider copy of Windows 10, go to [Windows 10](http://insider.windo
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -69,9 +69,10 @@ The sample covers these key tasks:
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++ or C\#. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -42,9 +42,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: ContactsAndCalendar
--->
# Appointments API sample
# Appointment calendar sample
Demonstrates the functionality of the API of the [**Windows.ApplicationModel.Appointments**](http://msdn.microsoft.com/library/windows/apps/dn263359) namespace.
@ -35,9 +35,10 @@ For more info about the concepts and APIs demonstrated in this sample, see these
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: LaunchingAndBackgroundTasks
--->
# Association Launching sample
# Association launching sample
This sample shows you how to launch an app for to handle a file type or a protocol (also known as custom scheme). You can also learn how to enable your app to be the handler for a file type or a protocol.
@ -62,9 +62,10 @@ For more info about the concepts and APIs demonstrated in this sample, see these
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: AudioVideoAndCamera
--->
# Audio Categories Sample
# Audio categories sample
This sample demonstrates how to create apps that use various audio categories.
@ -16,9 +16,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C\# or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
AudioGraph Sample
-----------
# Audio graphs sample
This sample shows how to use the APIs in the **Windows.Media.Audio** namespace to create audio graphs for audio routing, mixing, and processing scenarios.
An audio graph is a set of interconnected audio nodes through which audio data flows. Audio input nodes supply audio data to the graph from audio input devices,
@ -101,9 +100,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -0,0 +1,49 @@
<!---
category: Navigation
--->
# Back Button Sample
This sample demonstrates how to set up an event handler for the back button event and how to enable the title bar back button for when the app is in windowed Desktop mode.
Specifically, this sample covers:
- Setting up an event handler for BackRequested and to navigate back in the page stack.
- Enabling and disabling the title bar back button based on the app's internal page stack.
To obtain an insider copy of Windows 10, go to [Windows 10](http://insider.windows.com).
**Note** For Windows 10 app samples, go to [Windows 10 Samples](https://github.com/Microsoft/Windows-universal-samples). The samples for Windows 10 can be built and run using Windows developer [tools](https://developer.windows.com).
## Related topics
- [Windows app samples](http://go.microsoft.com/fwlink/p/?LinkID=227694)
## System requirements
**Client:** Windows 10
**Server:** Windows Server 2016 Technical Preview
**Phone:** Windows 10
## Build the sample
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
### Deploying the sample
- Select Build > Deploy Solution.
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging.

Просмотреть файл

@ -0,0 +1,127 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=402347&clcid=0x409
namespace SDKTemplate
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Construct();
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = false;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Register a global back event handler. This can be registered on a per-page-bases if you only have a subset of your pages
// that needs to handle back or if you want to do page-specific logic before deciding to navigate back on those pages.
SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when a user issues a global back on the device.
/// If the app has no in-app back stack left for the current view/frame the user may be navigated away
/// back to the previous app in the system's app back stack or to the start screen.
/// In windowed mode on desktop there is no system app back stack and the user will stay in the app even when the in-app back stack is depleted.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void App_BackRequested(object sender, BackRequestedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame == null)
return;
// If we can go back and the event has not already been handled, do so.
if (rootFrame.CanGoBack && e.Handled == false)
{
e.Handled = true;
rootFrame.GoBack();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
// Add any application contructor code in here.
partial void Construct();
}
}

Просмотреть файл

@ -0,0 +1,153 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Collections.Generic;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
namespace SDKTemplate
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public static MainPage Current;
public MainPage()
{
this.InitializeComponent();
// This is a static public property that allows downstream pages to get a handle to the MainPage instance
// in order to call methods that are in this class.
Current = this;
SampleTitle.Text = FEATURE_NAME;
// Caching your main page is good practice, this makes it snappy for the user to return to "home" of your app.
this.NavigationCacheMode = NavigationCacheMode.Required;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Populate the scenario list from the SampleConfiguration.cs file
ScenarioControl.ItemsSource = scenarios;
if (Window.Current.Bounds.Width < 640)
{
ScenarioControl.SelectedIndex = -1;
}
else
{
ScenarioControl.SelectedIndex = 0;
}
// This page is always at the top of our in-app back stack.
// Once it is reached there is no further back so we can always disable the title bar back UI when navigated here.
// If you want to you can always to the Frame.CanGoBack check for all your pages and act accordingly.
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
}
/// <summary>
/// Called whenever the user changes selection in the scenarios list. This method will navigate to the respective
/// sample scenario page.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ScenarioControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Clear the status block when navigating scenarios.
NotifyUser(String.Empty, NotifyType.StatusMessage);
ListBox scenarioListBox = sender as ListBox;
Scenario s = scenarioListBox.SelectedItem as Scenario;
if (s != null)
{
ScenarioFrame.Navigate(s.ClassType);
if (Window.Current.Bounds.Width < 640)
{
Splitter.IsPaneOpen = false;
}
}
}
public List<Scenario> Scenarios
{
get { return this.scenarios; }
}
/// <summary>
/// Used to display messages to the user
/// </summary>
/// <param name="strMessage"></param>
/// <param name="type"></param>
public void NotifyUser(string strMessage, NotifyType type)
{
switch (type)
{
case NotifyType.StatusMessage:
StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Green);
break;
case NotifyType.ErrorMessage:
StatusBorder.Background = new SolidColorBrush(Windows.UI.Colors.Red);
break;
}
StatusBlock.Text = strMessage;
// Collapse the StatusBlock if it has no text to conserve real estate.
StatusBorder.Visibility = (StatusBlock.Text != String.Empty) ? Visibility.Visible : Visibility.Collapsed;
if (StatusBlock.Text != String.Empty)
{
StatusBorder.Visibility = Visibility.Visible;
StatusPanel.Visibility = Visibility.Visible;
}
else
{
StatusBorder.Visibility = Visibility.Collapsed;
StatusPanel.Visibility = Visibility.Collapsed;
}
}
async void Footer_Click(object sender, RoutedEventArgs e)
{
await Windows.System.Launcher.LaunchUriAsync(new Uri(((HyperlinkButton)sender).Tag.ToString()));
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Splitter.IsPaneOpen = !Splitter.IsPaneOpen;
}
}
public enum NotifyType
{
StatusMessage,
ErrorMessage
};
public class ScenarioBindingConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
Scenario s = value as Scenario;
return (MainPage.Current.Scenarios.IndexOf(s) + 1) + ") " + s.Title;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return true;
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">
<Identity
Name="Microsoft.SDKSamples.SystemBack.CS"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="da0b9378-eaf1-47f0-b5d0-0e819bb17f41" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>SystemBack C# Sample</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>Assets\StoreLogo-sdk.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="SystemBack.App"
Executable="$targetnametoken$.exe"
EntryPoint="SystemBack.App">
<uap:VisualElements
DisplayName="SystemBack C# sample"
Square150x150Logo="Assets\squareTile-sdk.png"
Square44x44Logo="Assets\SmallTile-sdk.png"
Description="SystemBack C# sample"
BackgroundColor="#00b2f0">
<uap:SplashScreen Image="Assets\Splash-sdk.png" />
<uap:DefaultTile>
<uap:ShowNameOnTiles>
<uap:ShowOn Tile="square150x150Logo" />
</uap:ShowNameOnTiles>
</uap:DefaultTile>
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

Просмотреть файл

@ -0,0 +1,33 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;
namespace SDKTemplate
{
public partial class MainPage : Page
{
public const string FEATURE_NAME = "SystemBack";
List<Scenario> scenarios = new List<Scenario>
{
new Scenario() { Title="Subscribe to the BackRequested event", ClassType=typeof(Scenario1)},
};
}
public class Scenario
{
public string Title { get; set; }
public Type ClassType { get; set; }
}
}

Просмотреть файл

@ -11,15 +11,16 @@
//*********************************************************
-->
<Page
x:Class="SDKTemplate.GetUserDisplayName"
x:Class="SDKTemplate.Scenario1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SDKTemplate"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Margin="12,10,12,12">
<Grid x:Name="RootGrid" Margin="12,10,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
@ -28,19 +29,16 @@
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
<Run>Get the display name for the current user.</Run>
How to enable back navigation using system assets such as hardware back button, global navigation bar, hotkeys and title bar UI
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel>
<Button x:Name="GetDisplayNameButton" Content="Get Display Name" Margin="0,0,10,0" Click="GetDisplayNameButton_Click"/>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<CheckBox Name="checkBox" Content="Enable Title Bar back button" Checked="CheckBox_Toggle" Unchecked="CheckBox_Toggle"/>
<Button Content="Navigate to secondary page" Click="Button_Click"/>
</StackPanel>
</ScrollViewer>
<!-- Status Block for providing messages to the user. Use the
NotifyUser() method to populate the message -->
<TextBlock x:Name="StatusBlock" Grid.Row="2" Margin="12, 10, 12, 10" Visibility="Collapsed"/>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -0,0 +1,56 @@
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace SDKTemplate
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Scenario1 : Page
{
private MainPage rootPage;
private static bool optedIn = false;
public Scenario1()
{
this.InitializeComponent();
// I want this page to be always cached so that we don't have to add logic to save/restore state for the checkbox.
this.NavigationCacheMode = NavigationCacheMode.Required;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Navigate to the next page, with info in the parameters whether to enable the title bar UI or not.
rootFrame.Navigate(typeof(SecondaryPage), optedIn);
}
private void CheckBox_Toggle(object sender, RoutedEventArgs e)
{
optedIn = !optedIn;
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
<Page
x:Class="SDKTemplate.SecondaryPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SDKTemplate"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="RootGrid" Margin="12,10,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Secondary Page" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
The only way to navigate back to the main page is through the use of one of the system back affordances listed below.
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBlock Text="1. Hardware back (if you are on a phone)" />
<TextBlock Text="2. Global Navigation Bar back (if you are in tablet mode)" TextWrapping="Wrap" />
<TextBlock Text="3. Windows key + backspace (if you have a keyboard attached)" TextWrapping="Wrap" />
<TextBlock Text="4. Title bar back (if you have opted in to it and are in desktop mode)" TextWrapping="Wrap" />
<TextBlock Text="5. Say 'Cortana Go Back' (if you are on a Hololens)" TextWrapping="Wrap" />
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace SDKTemplate
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class SecondaryPage : Page
{
public SecondaryPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
bool optedIn = false;
if ((bool)e.Parameter)
{
optedIn = true;
}
Frame rootFrame = Window.Current.Content as Frame;
if (rootFrame.CanGoBack && optedIn)
{
// If we have pages in our in-app backstack and have opted in to showing back, do so
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
}
else
{
// Remove the UI from the title bar if there are no pages in our in-app back stack
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
}
}
}
}

Просмотреть файл

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<ProjectGuid>{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SystemBack</RootNamespace>
<AssemblyName>SystemBack</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10240.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10069.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UAP</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="..\..\..\SharedContent\cs\AssemblyInfo.cs">
<Link>Properties\AssemblyInfo.cs</Link>
</Compile>
<Compile Include="SampleConfiguration.cs" />
<Compile Include="Scenario1.xaml.cs">
<DependentUpon>Scenario1.xaml</DependentUpon>
</Compile>
<Compile Include="SecondaryPage.xaml.cs">
<DependentUpon>SecondaryPage.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml">
<Link>App.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="..\..\..\SharedContent\cs\MainPage.xaml">
<Link>MainPage.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Scenario1.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SecondaryPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="..\..\..\SharedContent\xaml\Styles.xaml">
<Link>Styles\Styles.xaml</Link>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\SharedContent\media\microsoft-sdk.png">
<Link>Assets\microsoft-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\smalltile-sdk.png">
<Link>Assets\smalltile-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\splash-sdk.png">
<Link>Assets\splash-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\squaretile-sdk.png">
<Link>Assets\squaretile-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\storelogo-sdk.png">
<Link>Assets\storelogo-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\tile-sdk.png">
<Link>Assets\tile-sdk.png</Link>
</Content>
<Content Include="..\..\..\SharedContent\media\windows-sdk.png">
<Link>Assets\windows-sdk.png</Link>
</Content>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23023.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemBack", "SystemBack.csproj", "{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.ActiveCfg = Debug|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.Build.0 = Debug|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.Deploy.0 = Debug|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.ActiveCfg = Debug|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.Build.0 = Debug|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.Deploy.0 = Debug|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.ActiveCfg = Debug|x86
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.Build.0 = Debug|x86
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.Deploy.0 = Debug|x86
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.ActiveCfg = Release|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.Build.0 = Release|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.Deploy.0 = Release|ARM
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.ActiveCfg = Release|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.Build.0 = Release|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.Deploy.0 = Release|x64
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.ActiveCfg = Release|x86
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.Build.0 = Release|x86
{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Просмотреть файл

@ -2,7 +2,7 @@
category: AudioVideoAndCamera
--->
# Background Audio
# Background audio sample
This sample demonstrates how to use the Background Media Player and playback lists to create a collection of songs that can continue to play even when the app is no longer in the foreground.
@ -26,9 +26,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C\# or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# Background Sensors sample
# Background sensors sample
This sample shows how to use background tasks with a device use trigger targetting sensors APIs. For the sake of the example, the [**Accelerometer**](http://msdn.microsoft.com/library/windows/apps/br225687) API is used in this sample.
@ -33,9 +33,10 @@ Related topics
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, or C#. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,8 +1,8 @@
<!---
category: LaunchingAndBackgroundTasks
--->
Background task sample
======================
# Background task sample
This sample shows you how to create and register background tasks using the Windows Runtime background task API.
@ -29,10 +29,7 @@ To obtain an evaluation copy of Microsoft Visual Studio 2013, go to [Visual Stu
**Note**  For Windows 8 app samples, download the [Windows 8 app samples pack](http://go.microsoft.com/fwlink/p/?LinkId=301698). The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.
Related topics
--------------
****
## Related topics
[Displaying tiles on the lock screen](http://msdn.microsoft.com/library/windows/apps/hh868260)
@ -50,13 +47,11 @@ Related topics
[**Windows.UI.WebUI.WebUIBackgroundTaskInstance (HTML)**](http://msdn.microsoft.com/library/windows/apps/hh701740)
Related technologies
--------------------
## Related technologies
[**Windows.ApplicationModel.Background**](http://msdn.microsoft.com/library/windows/apps/br224847)
Operating system requirements
-----------------------------
## Operating system requirements
Client
@ -70,15 +65,14 @@ Phone
Windows Phone 10
Build the sample
----------------
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory named for the sample and double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------
## Run the sample
**Deploying the sample**
@ -113,8 +107,7 @@ Add the BackgroundTaskSample app to the lock screen manually:
**Note**  The minimum delay for creating TimeTrigger events is 15 minutes. The first timer event, however, might not occur until 15 minutes after it is expected to expire (30 minutes after the app registers the event).
Read more
---------
## Read more
See the following topics for step-by-step information about using background tasks:

Просмотреть файл

@ -1,7 +1,8 @@
<!---
category: NetworkingAndWebServices
--->
# Background Transfer sample
# Background transfer sample
This sample shows how to use the Background Transfer API to download and upload files in the background in Universal Windows Platform (UWP) apps.
@ -67,10 +68,10 @@ For more information on network capabilities, see [How to set network capabiliti
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the subdirectory for the desired language.
3. Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
### Deploying and running the Windows version of the sample
@ -123,8 +124,7 @@ The remote server address and local filename fields should be updated. This can
To deploy and run the Windows version of the sample:
1. Right-click **BackgroundTransfer.Windows** in **Solution Explorer** and select **Set as StartUp Project**.
2. To debug the sample and then run it, press F5 or use **Debug** \> **Start Debugging**. To run the sample without debugging, press Ctrl+F5 or use **Debug** \> **Start Without Debugging**.
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging.
### Deploying and running the Windows Phone version of the sample
@ -135,6 +135,4 @@ IIS is not available on Windows Phone. For the app to access a web server, there
To deploy and run the Windows Phone version of the sample:
1. Right-click **BackgroundTransfer.WindowsPhone** in **Solution Explorer** and select **Set as StartUp Project**.
2. To debug the sample and then run it, press F5 or use **Debug** \> **Start Debugging**. To run the sample without debugging, press Ctrl+F5 or use **Debug** \> **Start Without Debugging**.
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or select Debug > Start Without Debugging.

Просмотреть файл

@ -1,7 +1,8 @@
<!---
category: DevicesSensorsAndPower
--->
# Barcode Scanner Sample
# Barcode scanner sample
This sample shows how to create a barcode scanner, claim it for exclusive use, enable it to receive data, and read a barcode. This sample uses [**Windows.Devices.PointOfService**](http://msdn.microsoft.com/library/windows/apps/dn298071) API.
@ -61,9 +62,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -29,9 +29,10 @@ When you choose the **Get Data** button for the **Polling** option, the app will
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
Basic Face Detection sample
--------------------
# Basic face detection sample
This sample shows how to use the Windows.Media.FaceAnalysis.FaceDetector WinRT class to find human faces within a still image.
@ -63,9 +62,10 @@ The FaceDetector is intended to operate on a static image or a single frame of v
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
Basic Face Tracking sample
--------------------
# Basic face tracking sample
This sample shows how to use the Windows.Media.FaceAnalysis.FaceTracker WinRT class to find human faces within an video stream.
@ -53,9 +52,10 @@ The FaceTracker is intended to operate on a running video stream and is optimize
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: CustomUserInteractions
---!>
# Basic Input sample
# Basic input sample
This sample shows how to handle input in Universal Windows Apps.
@ -46,9 +46,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,8 +1,8 @@
<!---
category: AudioVideoAndCamera
--->
Basic Media Casting Sample
-----------
# Basic media casting sample
This sample shows how to use the APIs in the **Windows.Media.Casting** namespace to render media on a remote device. It covers sending media to various devices- Miracast, DLNA, and Bluetooth. For more advanced functionality see the *Advanced Casting Sample*.
@ -37,9 +37,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# Bluetooth Advertisement Watcher and Publisher
# Bluetooth advertisement sample
This sample demonstrates use of the [**Bluetooth Advertisement**](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.devices.bluetooth.advertisement.aspx) Runtime API to send and receive Bluetooth Low Energy advertisements.
@ -12,6 +12,8 @@ This sample allows the user to publish and watch for Bluetooth Low Energy advert
- **Background watcher**: Scanning for a particular LE advertisement containing a matching manufacturer data section and above a certain RSSI threshold using a background trigger and task.
- **Background publisher**: Publishing a LE advertisement in the background. The advertisement generated by this scenario can be received by running Scenario 1 or 3 on another Windows platform in close proximity with this one.
**Note:** A working Bluetooth dongle/radio is needed in order to test this sample's functionality. The VS Emulator is a valid target, but since there's technically no valid Bluetooth, the app will treat it as if there's no Bluetooth radio and beacon functionality cannot be used.
## System requirements
**Client:** Windows 10
@ -22,9 +24,10 @@ This sample allows the user to publish and watch for Bluetooth Low Energy advert
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
CameraFaceDetection Sample
--------------------
# Camera face detection sample
This sample applies an end-to-end approach to demonstrate how to write a camera application using the Windows.Media.Capture API in conjunction with orientation sensors to cover the functions that most camera apps will require. In addition, it will show a simple way to use the Face Detection effect included in Windows. This sample is based on the CameraStarterKit.
@ -66,9 +65,10 @@ This sample also implements a custom UI to better simulate the experience that a
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,9 +1,8 @@
<!---
<!---
category: AudioVideoAndCamera
--->
CameraGetPreviewFrame Sample
----------------------------
# Camera preview frame sample
This sample applies an end-to-end approach to demonstrate how to write a camera application using the Windows.Media.Capture API in conjunction with the DisplayInformation API to acquire preview frames from the camera stream for further processing.
@ -58,9 +57,10 @@ Due to the custom UI that this sample implements, any messages intended for the
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
CameraHdr Sample
----------------
# High dynamic range sample
This sample applies an end-to-end approach to demonstrate how to write a video recording camera application using the Windows.Media.Capture API in conjunction with orientation sensors to cover the functions that most camera apps will require. It will also use the Windows.Media.Core.SceneAnalysisEffect API to get information about the preview scene and give a recommendation on how beneficial an HDR capture would be. In addition, it will show a simple way to use the Windows.Media.Capture.AdvancedCapture API, which enables High Dynamic Range (HDR) captures, included in Windows. This sample is based on the CameraStarterKit.
@ -67,9 +66,10 @@ This sample also implements a custom UI to better simulate the experience that a
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,9 +1,8 @@
<!---
<!---
category: AudioVideoAndCamera
--->
CameraProfile Sample
--------------------
# Camera profiles sample
This sample demonstrates a new extension to Windows.Media.Capture.MediaCaptureInitializationSettings API. This new API allows for application
developer to query a device for a collection of media types that can work together on a given device called a Video Profile. These new Video Profiles
@ -55,9 +54,10 @@ Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -1,9 +1,8 @@
<!---
<!---
category: AudioVideoAndCamera
--->
CameraStarterKit Sample
-----------------------
# Basic camera app sample
This sample applies an end-to-end approach to demonstrate how to write a camera application using the Windows.Media.Capture API in conjunction with orientation sensors to cover the functions that most camera apps will require.
@ -63,9 +62,10 @@ This sample also implements a custom UI to better simulate the experience that a
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: AudioVideoAndCamera
--->
CameraVideoStabilization Sample
-------------------------------
# Video stabilization sample
This sample applies an end-to-end approach to demonstrate how to write a video recording camera application using the Windows.Media.Capture API in conjunction with orientation sensors to cover the functions that most camera apps will require. In addition, it will show a simple way to use the Video Stabilization effect included in Windows. This sample is based on the CameraStarterKit.
@ -66,9 +65,10 @@ This sample also implements a custom UI to better simulate the experience that a
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,7 +1,8 @@
<!---
category: DevicesSensorsAndPower
--->
# Cash Drawer Sample
# Cash drawer sample
This sample demonstrates the use of the [**Windows.Devices.PointOfService.CashDrawer**](http://msdn.microsoft.com/library/windows/apps/dn298071) API.
@ -48,9 +49,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: ControlsLayoutAndText
--->
# Clipboard app sample
# Clipboard sample
This sample demonstrates how an app can use clipboard commands, including copy, paste, cut, and move. This sample uses classes from the [**Windows.ApplicationModel.DataTransfer**](http://msdn.microsoft.com/library/windows/apps/br205967) namespace. Some of the classes you might want to review in more detail include the [**Clipboard**](http://msdn.microsoft.com/library/windows/apps/br205867) class, which accesses the Clipboard, and the [**DataPackage**](http://msdn.microsoft.com/library/windows/apps/br205873) class, which you use to package the content before adding it to the Clipboard.
@ -42,9 +42,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -38,9 +38,10 @@ Allows the user to simulate sensor accuracy and demonstrates usage of the calibr
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,7 +1,9 @@
<!---
category: CustomUserInteractions
---!>
# ComplexInk sample
# Complex inking sample
This sample demonstrates how to use advanced InkPresenter functionality to achieve scenarios such as interleaving ink with other objects, selecting ink, copy/paste, and event handling. It is built upon the Universal Windows Platform (UWP) in C++ and can run on both Desktop and Mobile Windows 10 SKUs.
Specifically, this sample covers using the [**Windows.UI.Input.Inking**](http://msdn.microsoft.com/library/windows/apps/br208524) APIs to:
@ -43,9 +45,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
----------------
1. Start Visual Studio 2015 and select **File \> Open \> Project/Solution**.
2. Go to the directory in which you downloaded the sample. Go to the directory named for the sample, and double-click the Microsoft Visual Studio Solution (.sln) file.
3. Press Ctrl+Shift+B or use **Build \> Build Solution** to build the sample.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
--------------

Просмотреть файл

@ -1,5 +1,8 @@
Compression sample
==================
<!---
category: Data
--->
# Compression sample
This sample demonstrates how to read structured data from a file and write compressed data to a new file and how to read compressed data and write decompressed data to a new file.
@ -18,8 +21,7 @@ Specifically, this sample shows the following:
To obtain the Windows 10 developer tools preview, go to [Windows 10 developer tools](https://dev.windows.com/en-us/downloads/windows-10-developer-tools).
Operating system requirements
-----------------------------
## Operating system requirements
Client
@ -33,19 +35,14 @@ Phone
Windows 10 Mobile
Build the sample
----------------
## Build the sample
1. Start Visual Studio 2015 RC and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory named for the sample and double-click the Visual Studio 2015 RC Solution (.sln) file.
3. Follow the steps for the version of the sample you want:
- To build the sample:
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. Select **Compression** in **Solution Explorer**.
2. Press Ctrl+Shift+B, or use **Build** \> **Build Solution**, or use **Build** \> **Build Compression**.
Run the sample
--------------
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.

Просмотреть файл

@ -1,4 +1,8 @@
# ContentIndexer sample
<!---
category: Data
--->
# Content indexer sample
This sample shows how to add, update, and retrieve items and properties from the indexer. Two methods of doing so are demonstrated. The first is using the ContentIndexer APIs to directly interface with the indexer. The second is writing .appcontent-ms files, which contain information to be indexed that the indexer will pick up once the file has been written.
@ -60,9 +64,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -41,9 +41,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,7 +1,8 @@
<!---
category: SpeechAndCortana
--->
# Cortana Voice Command Sample
# Cortana voice command sample
This sample demonstrates integrating with Cortana to provide Voice Command Definitions (VCDs) that allow an application to be invoked in a variety of ways.
@ -38,7 +39,7 @@ The sample also includes a basic application in order to demonstrate how to inte
## Setup
1. Ensure Cortana is signed in with an MSA account. This can be achieved by opening Cortana once and following the sign-in process.
2. Run the application normally once (eg, via F5 debug or deploy/launch). This installs the voice command definitions.
2. Follow the steps in the "Build the sample" section below, then run the application normally once (using either F5 to debug or deploying and then launching normally). This installs the voice command definitions.
3. Close the app.
4. Click on the microphone icon in Cortana's search bar.
5. Say one of the supported voice commands (see below)
@ -74,4 +75,32 @@ Duplicates can also be handled. For an example of handling disambiguation, add a
## System requirements
Cortana requires an appropriate recording device, and the system must be associated with a Microsoft Account in order for Cortana to function.
**Client:** Windows 10
**Server:** Windows Server 2016 Technical Preview
**Phone:** Windows 10
Cortana requires an appropriate recording device, and the system must be associated with a Microsoft Account in order for Cortana to function.
## Build the sample
**Note:** This sample has special instructions in the Setup section above.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
### Deploying the sample
- Select Build > Deploy Solution.
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.

Просмотреть файл

@ -246,7 +246,7 @@ var appService = Windows.ApplicationModel.AppService;
completedMessage.spokenMessage = "Okay, Keeping the trip to " + destination;
var response = voiceCommands.VoiceCommandResponse.createResponse(completedMessage);
return voiceServiceConnection.reportSuccessAsync(completedMessage);
return voiceServiceConnection.reportSuccessAsync(response);
}
}
}).done();

Просмотреть файл

@ -1,4 +1,10 @@
This sample shows how to use the Windows.Security.Credentials.UI.CredentialPicker class to retrieve credentials, which can then be passed to APIs that may require credentials (for example, HttpClient). This can be used in support of single sign on (SSO).
<!---
category: IdentitySecurityAndEncryption
--->
# Credential picker sample
This sample shows how to use the Windows.Security.Credentials.UI.CredentialPicker class to retrieve credentials, which can then be passed to APIs that may require credentials (for example, HttpClient). This can be used in support of single sign on (SSO).
**Note**  This sample was created using one of the universal app templates available in Visual Studio. It shows how its solution is structured so it can run on both Windows 10 and Windows Phone 10.
@ -21,9 +27,10 @@ Related topics
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++ or C\#. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------

Просмотреть файл

@ -2,8 +2,7 @@
category: DevicesSensorsAndPower
--->
Custom HID Device Access Sample
===============================
# Custom HID device sample
This sample shows how to use the [**Windows.Devices.HumanInterfaceDevices**](http://msdn.microsoft.com/library/windows/apps/dn264174) API. It was designed to work with a programmable, USB-based, HID device called the SuperMUTT.
@ -65,8 +64,7 @@ When you press the **Stop Device Watcher** button, the app executes code that di
Also, whenever the app is suspended, it executes code that disconnects from the SuperMUTT device.
Operating system requirements
-----------------------------
## Operating system requirements
**Client:** Windows 10
@ -74,25 +72,24 @@ Operating system requirements
**Phone:** Windows 10
Build the sample
----------------
## Build the sample
To build this sample, open the solution (.sln) file from Visual Studio. Press Ctrl+Shift+B, or select Build \> Build Solution.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------
## Run the sample
To run this sample after building it, press F5 (run with debugging enabled) or Ctrl+F5 (run without debugging enabled) from Visual Studio. (Or select the corresponding options from the Debug menu.)
Device Driver Requirements
--------------------------
## Device Driver Requirements
The sample runs over the inbox USB and HID device-drivers that ship in Windows. These device drivers are installed when you first attach the SuperMUTT device.
Note that the **Windows.Devices.HumanInterfaceDevice** API does not support custom, or filter, drivers.
Understanding the app manifest
------------------------------
## Understanding the app manifest
The app manifest is an XML document that contains the info the system needs to deploy, display, or update a Windows Store app. This info includes package identity, package dependencies, required capabilities, visual elements, and extensibility points. Every app package must include one package manifest.
@ -118,8 +115,7 @@ In the following vendor-defined usage data, the device is identified by the **Ve
</Capabilities>
```
Configuring the SuperMUTT firmware
----------------------------------
## Configuring the SuperMUTT firmware
The following steps allow you to configure the SuperMUTT device to run with your sample.
@ -144,8 +140,7 @@ If needed, the you can revert the SuperMUTT from HID device-mode back to its def
MuttUtil.exe -hidtodefault
```
Limitations
-----------
## Limitations
**Designed for Peripherals**

Просмотреть файл

@ -2,7 +2,7 @@
category: DevicesSensorsAndPower
--->
# Custom Sensors sample
# Custom sensors sample
This sample demonstrates the use of the Windows.Devices.Sensors.Custom sensor API.
@ -29,9 +29,10 @@ When you click on the **Get CO2 level** button for the **Polling** option, the a
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: DevicesSensorsAndPower
--->
Custom Serial Device Sample
===========================
# Custom serial device sample
This sample demonstrates the use of the Windows.Devices.SerialCommunication WinRT APIs to communicate with a Serial device.
@ -30,19 +29,19 @@ This scenario demonstrates the use of Input and Output streams on the SerialDevi
This scenario demonstrates the use of event notification APIs provided by Windows.Devices.SerialCommunication for **Pin Changed** and **Error Received** event types.
Operating system requirements
-----------------------------
## Operating system requirements
**Client:** Windows 10
**Server:** Windows 10
Build the sample
----------------
## Build the sample
To build this sample, open the solution (.sln) file from Visual Studio. Press Ctrl+Shift+B, or select Build \> Build Solution.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------
## Run the sample
To run this sample after building it, press F5 (run with debugging enabled) or Ctrl+F5 (run without debugging enabled) from Visual Studio. (Or select the corresponding options from the Debug menu.)

Просмотреть файл

@ -2,8 +2,7 @@
category: DevicesSensorsAndPower
--->
Custom USB device access sample
===============================
# Custom USB device sample
This sample shows how to communicate with a USB device by using the [**Windows.Devices.Usb**](http://msdn.microsoft.com/library/windows/apps/dn278466) namespace. The sample can communicate with these devices:
@ -22,8 +21,7 @@ The sample demonstrates these key scenarios:
For step-by-step instructions about implementing USB features in a Windows Store app, see [Talking to USB devices, start to finish](http://msdn.microsoft.com/library/windows/apps/dn312121) and [Writing a Windows store app for a USB device](http://msdn.microsoft.com/library/windows/apps/dn303355).
Code Structure
--------------
## Code Structure
* **App**
@ -87,8 +85,7 @@ Code Structure
For more information, see [this topic](http://go.microsoft.com/fwlink/p/?linkid=306314) about sync-ing with a device.
**App manifest package**
------------------------
## App manifest package
The sample adds the [**DeviceCapability**](http://msdn.microsoft.com/library/windows/apps/br211430) element in the Package.appxmanifest file. Device information includes the device's vendor/product Ids and device class information. For OSRFX2 and SuperMUTT devices, the device class is specified by indicating the device class code and a string for the code.
@ -111,8 +108,7 @@ The sample adds the [**DeviceCapability**](http://msdn.microsoft.com/library/win
</Capabilities>
```
Related technologies
--------------------
## Related technologies
* [**Windows.Devices.Usb**](http://msdn.microsoft.com/library/windows/apps/dn278466)
@ -138,15 +134,13 @@ Related technologies
Writes data to an output stream. Used for writing data to a USB pipe.
Operating system requirements
-----------------------------
## Operating system requirements
* **Client:** Windows 10
* **Server:** Windows Server 2016 Technical Preview
Driver requirements
-------------------
## Driver requirements
The sample app communicates with the device through the Microsoft-provided kernel-mode driver, Winusb.sys. You must install it as the device driver.
@ -164,8 +158,7 @@ When you connect your device, you might notice that Windows loads Winusb.sys aut
5. From the list of device classes, select **Universal Serial Bus devices**.
6. The wizard displays **WinUsb Device**. Select it to load the driver.
If you are using the OSRFX2 device...
-------------------------------------
## If you are using the OSRFX2 device...
The preceding procedure does not add a device interface GUID for the app to access the device. You must add the GUID manually by following this procedure.
@ -180,8 +173,7 @@ The preceding procedure does not add a device interface GUID for the app to acce
**Note** If you change the physical port then you must repeat steps 1 through 4.
If you are using the SuperMUTT device...
----------------------------------------
## If you are using the SuperMUTT device...
Windows automatically loads Winusb.sys as the device driver. Otherwise, manually install the driver by using the preceding instructions.
@ -196,9 +188,7 @@ Windows automatically loads Winusb.sys as the device driver. Otherwise, manually
The SuperMUTT device when configured in WinRTUsbPersonality mode, exposes configuration, interfaces, and endpoints, that work with the sample.
Customizing the sample for your device
--------------------------------------
## Customizing the sample for your device
You can extend this sample for your device by performing these tasks.
@ -207,12 +197,13 @@ You can extend this sample for your device by performing these tasks.
If you specify the device class code, make sure that it is supported. For a list of supported device classes see [How to add USB device capabilities to the app manifest](https://msdn.microsoft.com/en-us/library/windows/apps/dn303351).
Build the sample
----------------
## Build the sample
To build this sample, open the solution (.sln) file from Visual Studio. Press Ctrl+Shift+B, or select Build \> Build Solution.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------
## Run the sample
To run this sample after building it, press F5 (run with debugging enabled) or Ctrl+F5 (run without debugging enabled) from Visual Studio. (Or select the corresponding options from the Debug menu.)

Просмотреть файл

@ -50,9 +50,10 @@ Related DirectX app APIs:
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,8 +2,7 @@
category: GraphicsAndAnimation
--->
Direct2D gradient mesh sample
=============================
# Direct2D gradient mesh sample
This sample demonstrates how to instantiate and render a gradient mesh in [Direct2D](http://msdn.microsoft.com/en-us/library/windows/desktop/dd370990). This samples uses the helper method provided by Direct2D to create a mesh consisting of two tensor patches that share a side.
@ -13,7 +12,34 @@ Some important APIs used in this sample are:
- The [**ID2D1DeviceContext2::CreateGradientMesh**](http://msdn.microsoft.com/en-us/library/windows/desktop/dn890790) method, which creates an [**ID2D1GradientMesh**](http://msdn.microsoft.com/en-us/library/windows/desktop/dn900410) object on the Direct2D device.
- The [**ID2D1DeviceContext2::DrawGradientMesh**](http://msdn.microsoft.com/en-us/library/windows/desktop/dn900378) method, which renders the ID2D1GradientMesh object to the device context.
Related topics
--------------
## Related topics
[**D2D1\_GRADIENT\_MESH\_PATCH** structure](http://msdn.microsoft.com/en-us/library/windows/desktop/dn890726)
## System requirements
**Client:** Windows 10
**Server:** Windows Server 2016 Technical Preview
**Phone:** Windows 10
## Build the sample
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
### Deploying the sample
- Select Build > Deploy Solution.
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.
[**D2D1\_GRADIENT\_MESH\_PATCH** structure](http://msdn.microsoft.com/en-us/library/windows/desktop/dn890726)

Просмотреть файл

@ -12,6 +12,14 @@ Specifically, this sample shows how to:
- Setup and control a photo photo editing pipeline
- Hook up UI in XAML
This sample uses the following Direct2D effects:
- [Color management](http://msdn.microsoft.com/en-us/library/windows/desktop/hh706318)
- [Straighten](http://msdn.microsoft.com/en-us/library/windows/desktop/dn900462)
- [Temperature and tint](http://msdn.microsoft.com/en-us/library/windows/desktop/dn900463)
- [Saturation](http://msdn.microsoft.com/en-us/library/windows/desktop/hh706369)
- [Contrast](http://msdn.microsoft.com/en-us/library/windows/desktop/dn890716)
- [Highlights and Shadows](http://msdn.microsoft.com/en-us/library/windows/desktop/dn890773)
**Note** The Windows universal samples require Visual Studio 2015 to build and Windows 10 to execute.
To obtain information about Windows 10, go to [Windows 10](http://go.microsoft.com/fwlink/?LinkID=532421)
@ -49,9 +57,33 @@ Related APIs:
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## System requirements
**Client:** Windows 10
**Server:** Windows Server 2016 Technical Preview
**Phone:** Windows 10
## Build the sample
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
### Deploying the sample
- Select Build > Deploy Solution.
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: ControlsLayoutAndText
--->
#DirectWrite Text Layout Line Spacing Modes Sample
# Line spacing (DirectWrite) sample
This sample demonstrates how to use different line spacing options that are provided for the DirectWrite text layout API.
@ -54,9 +54,10 @@ Other files are boilerplate files used for UWP sample apps.
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** > **Open** > **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** > **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -2,7 +2,7 @@
category: ControlsLayoutAndText
--->
#DirectWrite Text Layout Downloadable Fonts Integration Sample
# Downloadable fonts (DirectWrite) sample
This sample demonstrates how to use DirectWrite downloadable fonts, a feature added in Windows 10, together with the DirectWrite text layout API.
@ -57,9 +57,10 @@ The ClearDownloadableFontCache.ps1 file is not part of the sample project itself
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Просмотреть файл

@ -1,8 +1,8 @@
<!---
category: DataBinding
category: Data
--->
# Reading and writing data sample
# Serializing and deserializing data sample
This sample shows how to use the [**DataReader**](http://msdn.microsoft.com/library/windows/apps/br208119) and [**DataWriter**](http://msdn.microsoft.com/library/windows/apps/br208154) classes to store and retrieve data. Specifcially, this sample demonstrates the following scenarios:
@ -39,9 +39,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
@ -54,3 +55,4 @@ The next steps depend on whether you just want to deploy the sample or you want
### Deploying and running the sample
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.

Просмотреть файл

@ -1,6 +1,7 @@
<!---
category: NetworkingAndWebServices
--->
# DatagramSocket sample
This sample shows you how to a use datagram (UDP) socket to send and receive data using the [**DatagramSocket**](http://msdn.microsoft.com/library/windows/apps/br241319) and related classes in the [**Windows.Networking.Sockets**](http://msdn.microsoft.com/library/windows/apps/br226960) namespace in your Universal Windows Platform (UWP) app.
@ -100,10 +101,10 @@ This sample requires that network capabilities be set in the *Package.appxmanife
## Build the sample
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the subdirectory for the desired language.
3. Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample
@ -111,9 +112,9 @@ The next steps depend on whether you just want to deploy the sample or you want
### Deploying the sample
- Select **Build** \> **Deploy Solution**.
- Select Build > Deploy Solution.
### Deploying and running the sample
- Press F5 or use **Debug** \> **Start Debugging**. To run the sample without debugging, press Ctrl+F5 or use **Debug** \> **Start Without Debugging**.
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.

Просмотреть файл

@ -1,5 +1,8 @@
Device enumeration sample
=========================
<!---
category: DevicesSensorsAndPower
--->
# Device enumeration sample
This sample shows how to use the Windows.Devices.Enumeration APIs find devices internally connected to the system, externally connected, or nearby over wireless or networking protocols and get information about them. It also shows how to pair wireless and networking devices with the system.
@ -22,8 +25,7 @@ The sample demonstrates eight scenarios:
8. Pair Device: This scenario demonstrates how to pair a device with the system. It uses DeviceInformation.PairAsync on a DeviceInformation which is of kind DeviceInformationKind.AssociationEndpoint. e.g. This method can be used to pair devices like WiFi Direct, WSD, or UPnP device. Bluetooth is not supported at this time, but will be in a future release.
Related topics
--------------
## Related topics
[Enumerating devices article](http://msdn.microsoft.com/en-us/library/windows/apps/Hh464977)
@ -31,39 +33,30 @@ Related topics
[Windows Universal App Samples](https://github.com/Microsoft/Windows-universal-samples)
## System requirements
Operating system requirements
-----------------------------
**Client:** Windows 10
Client
**Server:** Windows Server 2016 Technical Preview
Windows 10
**Phone:** Windows 10
Server
## Build the sample
None supported
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Phone
Windows Phone 10
Build the sample
----------------
1. Start Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C\#, or JavaScript. Double-click the Visual Studio Solution (.sln) file.
3. Select the appropriate target: x86, x64, ARM. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
Run the sample
--------------
## Run the sample
The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it.
**Deploying the sample**
## Deploying the sample
1. Select **Build** \> **Deploy Solution**.
- Select Build > Deploy Solution.
**Deploying and running the sample**
### Deploying and running the sample
1. To debug the sample and then run it, press F5 or select **Debug** \> **Start Debugging**. To run the sample without debugging, press Ctrl+F5 or select**Debug** \> **Start Without Debugging**.
- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging.

Просмотреть файл

@ -1,6 +1,7 @@
<!---
category: ControlsLayoutAndText
--->
# Scaling according to DPI sample
This sample describes how to build an app that scales according to the dots per inch (dpi) (pixel density) of the screen by loading images of the right scale or by overriding default scaling. This sample uses the [**Windows.Graphics.Display**](http://msdn.microsoft.com/library/windows/apps/br226166) API.
@ -35,9 +36,10 @@ To obtain information about Microsoft Visual Studio 2015 and the tools for devel
## Build the sample
1. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
2. Go to the directory to which you unzipped the sample. Then go to the subdirectory containing the sample in the language you desire - either C++, C#, or JavaScript. Double-click the Visual Studio 2015 Solution (.sln) file.
3. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build.
2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**.
3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio 2015 Solution (.sln) file.
4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**.
## Run the sample

Двоичные данные
Samples/DpiScaling/shared/assets/projector-stretch.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
Samples/DpiScaling/shared/assets/projector.scale-100.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичные данные
Samples/DpiScaling/shared/assets/projector.scale-140.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.1 KiB

Двоичные данные
Samples/DpiScaling/shared/assets/projector.scale-180.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.3 KiB

Просмотреть файл

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.2" baseProfile="tiny" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
x="0px" y="0px" width="80px" height="80px" viewBox="0 0 80 80" xml:space="preserve">
<g>
<polygon fill="#010101" points="14,63 13,64 7,64 6,63 6,61 14,61 "/>
<polygon fill="#010101" points="74,63 73,64 67,64 66,63 66,61 74,61 "/>
<path fill="#010101" d="M51,35c-6.631,0-12,5.378-12,12c0,6.623,5.369,12,12,12c6.629,0,12-5.377,12-12C63,40.378,57.629,35,51,35z
M51,56c-4.973,0-9-4.033-9-9s4.027-9,9-9c4.971,0,9,4.033,9,9S55.971,56,51,56z"/>
<path fill="#010101" d="M70.932,29H9.069C3.689,29,1,31.727,1,37.182v20.455C1,58.387,1.605,59,2.345,59h39.684
C38.375,56.264,36,51.912,36,47c0-8.277,6.712-15,15-15s15,6.723,15,15c0,4.912-2.375,9.264-6.029,12h17.686
C78.395,59,79,58.387,79,57.637V37.182C79,31.727,76.311,29,70.932,29z M23,55H6v-2h17V55z M23,51H6v-2h17V51z M23,47H6v-2h17V47z
M23,43H6v-2h17V43z"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Просмотреть файл

@ -0,0 +1,160 @@
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="SDKTemplate.Scenario1"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="RootGrid" Margin="12,20,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
Loading images
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}">
Based on the screen's pixel density (DPI) and resolution, Windows scales images and
other UI elements to maintain physical sizing across devices. We recommend that you make your
app <Run FontWeight="Bold">scaling aware</Run> by providing multiple versions of these assets
so that they retain quality across different scales. If you don't provide multiple versions,
Windows will stretch your assets by default.
<LineBreak/><LineBreak/>
This scenario demonstrates different methods you can use to ensure
that Windows loads the correct asset depending on scaling. It also shows what
would have happened if you hadn't provided multiple assets.
You can choose a scaling method
based on your app's specific scenarios.
Use the descriptions below as a guide.
In some cases, you might want to use multiple methods.
<LineBreak/><LineBreak/>
<Run FontWeight="Bold" Text="Note:"/>
Use the simulator to view this scenario at different scales on the PC.
For the 100% scale, use the 10.6" 1366x768 resolution setting. For 140% use 10.6"
1920x1080 and for 180% use 10.6" 2560x1440.
Other scales are possible on phones and other devices.
<LineBreak/><LineBreak/>
<Run FontWeight="Bold" Text="Current scale: "/>
<Run x:Name="ScalingText"/>
<LineBreak/>
<Run FontWeight="Bold" Text="Logical DPI for this scale: "/>
<Run x:Name="LogicalDPIText"/>
</TextBlock>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0"
Background="LightCyan" HorizontalAlignment="Center" VerticalAlignment="Center" Height="90" Width="90" Margin="5,5,5,5">
<Border BorderThickness="2" BorderBrush="#00b9f2"/>
<Image Source="Assets/projector-stretch.png" Margin="5,5,5,5"/>
</Grid>
<TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" Margin="10,0,0,0">
Not scaling aware (not recommended)
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
If only one version of an asset is provided, then the app is not scaling aware.
The asset is distorted at scales other than 100%.
</TextBlock>
<Border Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="Gray" Margin="0,5"/>
<Grid Grid.Row="3" Grid.Column="0"
Background="LightCyan" HorizontalAlignment="Center" VerticalAlignment="Center" Height="90" Width="90" Margin="5,5,5,5">
<Border BorderThickness="2" BorderBrush="#00b9f2"/>
<Image Source="Assets/projector.png" Margin="5,5,5,5"/>
</Grid>
<TextBlock Grid.Row="3" Grid.Column="1" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" Margin="10,0,0,0">
Scaled packaged assets
</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
The framework can select an asset from your package based on
the current DPI. Include multiple versions of each asset
using the following naming convention: image.scale-100.png, image.scale-140.png
and image.scale-180.png. When you use "image.png" within your app, Windows will
select an asset based on the current scale.
<LineBreak/><LineBreak/>
The XAML framework selects the
image when the view is first loaded and will also change the asset
if the scale changes (for example, if the app is moved to a different
monitor). No additional code is required for dynamic reloading.
<LineBreak/><LineBreak/>
Note: Text has been added to the image above in order to make clear which version of the
image is loaded.
</TextBlock>
<Border Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="Gray" Margin="0,5"/>
<Grid Grid.Row="6" Grid.Column="0"
Background="LightCyan" HorizontalAlignment="Center" VerticalAlignment="Center" Height="90" Width="90" Margin="5,5,5,5">
<Border BorderThickness="2" BorderBrush="#00b9f2"/>
<!-- XAML Image -->
<Canvas x:Name="XAMLImage" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="3,0,0,25" >
<Path x:Name="Path" Width="8.53067" Height="3.19733" Canvas.Left="5.33333" Canvas.Top="34.136" Stretch="Fill" Fill="#FF010101" Data="F1 M 13.864,36.2653L 12.796,37.3333L 6.40133,37.3333L 5.33333,36.2653L 5.33333,34.136L 13.864,34.136"/>
<Path x:Name="Path_0" Width="8.53067" Height="3.19733" Canvas.Left="69.3333" Canvas.Top="34.136" Stretch="Fill" Fill="#FF010101" Data="F1 M 77.864,36.2653L 76.796,37.3333L 70.4013,37.3333L 69.3333,36.2653L 69.3333,34.136L 77.864,34.136"/>
<Path x:Name="Path_1" Width="25.5987" Height="25.5987" Canvas.Left="40.5307" Canvas.Top="6.40131" Stretch="Fill" Fill="#FF010101" Data="F1 M 53.3333,6.40131C 46.26,6.40131 40.5307,12.136 40.5307,19.204C 40.5307,26.2653 46.26,32 53.3333,32C 60.4013,32 66.1293,26.2653 66.1293,19.204C 66.1293,12.136 60.4013,6.40131 53.3333,6.40131 Z M 53.3333,28.8026C 48.0253,28.8026 43.7347,24.5 43.7347,19.204C 43.7347,13.9013 48.0253,9.59863 53.3333,9.59863C 58.6347,9.59863 62.932,13.9013 62.932,19.204C 62.932,24.5 58.6347,28.8026 53.3333,28.8026 Z "/>
<Path x:Name="Path_2" Width="83.1973" Height="32" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" Fill="#FF010101" Data="F1 M 74.5933,0L 8.604,0C 2.86933,0 0,2.91199 0,8.72931L 0,30.5466C 0,31.3493 0.645333,32 1.432,32L 43.7653,32C 39.864,29.084 37.3333,24.4426 37.3333,19.204C 37.3333,10.3707 44.4893,3.20398 53.3333,3.20398C 62.172,3.20398 69.3333,10.3707 69.3333,19.204C 69.3333,24.4426 66.796,29.084 62.9013,32L 81.7653,32C 82.552,32 83.1973,31.3493 83.1973,30.5466L 83.1973,8.72931C 83.1973,2.91199 80.328,0 74.5933,0 Z M 23.4627,27.7346L 5.33333,27.7346L 5.33333,25.5986L 23.4627,25.5986M 23.4627,23.4693L 5.33333,23.4693L 5.33333,21.3333L 23.4627,21.3333M 23.4627,19.204L 5.33333,19.204L 5.33333,17.068L 23.4627,17.068M 23.4627,14.9319L 5.33333,14.9319L 5.33333,12.8026L 23.4627,12.8026"/>
</Canvas>
</Grid>
<TextBlock Grid.Row="6" Grid.Column="1" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" Margin="10,0,0,0">
Vector Graphics Using XAML Path
</TextBlock>
<TextBlock Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
To use vector images, directly encode the graphic in XAML markup. The resource will
resize automatically when the scale changes.
</TextBlock>
<Border Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="Gray" Margin="0,5"/>
<TextBlock Grid.Row="9" Grid.Column="1" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" Margin="10,0,0,0">
Scaled external assets
</TextBlock>
<TextBlock Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2" Margin="0,10,0,0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap">
If you load images that did not come with your app's package or
resource pack (e.g. downloaded from a web server), then you must manually query the
RawPixelsPerViewPixel and use that to select an appropriate image. Example:
<Run FontWeight="Bold" x:Name="ManualLoadURL"/>
</TextBlock>
</Grid>
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -0,0 +1,162 @@
<!--
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
-->
<Page
x:Class="SDKTemplate.Scenario2"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="RootGrid" Margin="12,20,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,0,0,10">
<TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/>
<TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
Overriding scaling
</TextBlock>
</StackPanel>
<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical" HorizontalAlignment="Left">
<TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}">
To preserve the physical size of UI, Windows automatically scales UI elements.
You might not want this behavior, especially if your app
doesn't have a high-res version of an element available. This scenario demonstrates how to
counteract the automatic scaling of text and UI elements.
The box is kept at 100 pixels, and the text is kept at 27 pixels (20pt on an unscaled device).
The result is that both elements
get physically smaller as the scale increases.
<LineBreak/><LineBreak/>
<Run FontWeight="Bold" Text="Note:"/>
Use the simulator to view this scenario at different scales on the PC.
For the 100% scale, use the 10.6" 1366x768 resolution setting. For 140% use 10.6"
1920x1080 and for 180% use 10.6" 2560x1440.
Other scales are possible on phones and other devices.
<LineBreak/><LineBreak/>
<Run FontWeight="Bold" Text="Effective Resolution: "/>
<Run x:Name="ResolutionTextBlock"/>
</TextBlock>
<VariableSizedWrapGrid Orientation="Horizontal">
<!-- default scaling -->
<StackPanel Orientation="Vertical">
<TextBlock Style="{StaticResource BasicTextStyle}" Text="Default scaling" FontWeight="Bold" Margin="0,20,20,0"/>
<VariableSizedWrapGrid Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="140"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<!-- Header -->
<Border Grid.Row="0" Grid.Column="0" BorderThickness="2" BorderBrush="Black" Margin="6,6,2,2">
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" FontWeight="Bold" Margin="5,5,5,5">UI element</TextBlock>
</Border>
<Border Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" BorderThickness="2" BorderBrush="Black" Margin="6,2,2,6"/>
<Rectangle x:Name="DefaultLayoutRect" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="LightCyan" Margin="5,5,5,5" Height="100" Width="100"/>
<TextBlock x:Name="DefaultRelativePx" Grid.Row="2" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,0" FontWeight="Bold"/>
<TextBlock x:Name="DefaultPhysicalPx" Grid.Row="3" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,8" FontWeight="Bold"/>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="140"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="0" BorderThickness="2" BorderBrush="Black" Margin="2,6,6,2">
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" FontWeight="Bold" Margin="5,5,5,5">Text</TextBlock>
</Border>
<Border Grid.Row="1" Grid.RowSpan="3" BorderThickness="2" BorderBrush="Black" Margin="2,2,6,6"/>
<TextBlock x:Name="DefaultLayoutText" Grid.Row="1" Grid.RowSpan="3" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#00b9f2"/>
<TextBlock Grid.Row="2" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,0" FontWeight="Bold"/>
<TextBlock Grid.Row="3" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,8" FontWeight="Bold"/>
</Grid>
</VariableSizedWrapGrid>
</StackPanel>
<!-- override scaling -->
<StackPanel Orientation="Vertical">
<TextBlock Style="{StaticResource BasicTextStyle}" Text="Override scaling" FontWeight="Bold" Margin="0,20,20,0"/>
<VariableSizedWrapGrid Orientation="Horizontal">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="140"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<!-- Header -->
<Border Grid.Row="0" Grid.Column="0" BorderThickness="2" BorderBrush="Black" Margin="6,6,2,2">
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" FontWeight="Bold" Margin="5,5,5,5">UI element</TextBlock>
</Border>
<Border Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" BorderThickness="2" BorderBrush="Black" Margin="6,2,2,6"/>
<Rectangle x:Name="OverrideLayoutRect" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Fill="LightCyan" Margin="5,5,5,5" Height="100" Width="100"/>
<TextBlock x:Name="OverrideRelativePx" Grid.Row="2" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,0" FontWeight="Bold"/>
<TextBlock x:Name="OverridePhysicalPx" Grid.Row="3" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,8" FontWeight="Bold"/>
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="140"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<Border Grid.Row="0" BorderThickness="2" BorderBrush="Black" Margin="2,6,6,2">
<TextBlock Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" FontWeight="Bold" Margin="5,5,5,5">Text</TextBlock>
</Border>
<Border Grid.Row="1" Grid.RowSpan="3" BorderThickness="2" BorderBrush="Black" Margin="2,2,6,6"/>
<TextBlock x:Name="OverrideLayoutText" Grid.Row="1" Grid.RowSpan="3" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#00b9f2"/>
<TextBlock Grid.Row="2" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,0" FontWeight="Bold"/>
<TextBlock Grid.Row="3" Grid.Column="0" Style="{StaticResource BasicTextStyle}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="6,0,6,8" FontWeight="Bold"/>
</Grid>
</VariableSizedWrapGrid>
</StackPanel>
</VariableSizedWrapGrid>
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
</Page>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше