From 99c24d0ce0bf59f5a1e5a38181eb4bf63f85caa9 Mon Sep 17 00:00:00 2001 From: Raymond Chen Date: Wed, 8 Jun 2016 17:00:00 -0700 Subject: [PATCH] Windows 10 RTM Release - June 2016 Update 2 --- .../js/js/scenario3_BackgroundWatcher.js | 4 +- .../js/js/scenario4_BackgroundPublisher.js | 4 +- Samples/CameraHdr/cpp/MainPage.xaml.cpp | 2 +- .../cpp/D2DGradientMesh.vcxproj | 12 +- Samples/Geotag/README.md | 16 +- Samples/Geotag/cpp/Geotag.vcxproj | 6 +- Samples/Geotag/cpp/Geotag.vcxproj.filters | 2 +- Samples/Geotag/cpp/SampleConfiguration.cpp | 2 +- Samples/Geotag/cpp/Scenario1_Geotag.xaml | 43 --- Samples/Geotag/cpp/Scenario1_Geotag.xaml.cpp | 170 ++++------ Samples/Geotag/cpp/Scenario1_Geotag.xaml.h | 19 +- Samples/Geotag/cs/Geotag.csproj | 7 +- Samples/Geotag/cs/Package.appxmanifest | 5 +- Samples/Geotag/cs/SampleConfiguration.cs | 5 +- Samples/Geotag/cs/Scenario1.xaml | 54 --- Samples/Geotag/cs/Scenario1.xaml.cs | 141 -------- Samples/Geotag/cs/Scenario1_Geotag.xaml.cs | 115 +++++++ Samples/Geotag/js/Geotag.jsproj | 1 - Samples/Geotag/js/css/placeholder.txt | 0 Samples/Geotag/js/css/scenario1.css | 6 - Samples/Geotag/js/html/scenario1.html | 22 +- Samples/Geotag/js/js/sample-configuration.js | 4 +- Samples/Geotag/js/js/scenario1.js | 180 ++++------ Samples/Geotag/shared/Scenario1_Geotag.xaml | 37 ++ Samples/XamlPivot/cs/MainPage.xaml | 89 ++--- Samples/XamlPivot/cs/MainPage.xaml.cs | 13 +- Samples/XamlPivot/cs/Scenario1.xaml | 107 +++--- Samples/XamlPivot/cs/Scenario2.xaml | 30 +- Samples/XamlPivot/cs/Scenario3.xaml | 129 ++++--- .../ControlPages/RichEditBoxPage.xaml | 35 +- .../ControlPages/RichEditBoxPage.xaml.cs | 111 +++--- SharedContent/xaml/Styles.xaml | 315 +++++++++++++----- 32 files changed, 797 insertions(+), 889 deletions(-) delete mode 100644 Samples/Geotag/cpp/Scenario1_Geotag.xaml delete mode 100644 Samples/Geotag/cs/Scenario1.xaml delete mode 100644 Samples/Geotag/cs/Scenario1.xaml.cs create mode 100644 Samples/Geotag/cs/Scenario1_Geotag.xaml.cs create mode 100644 Samples/Geotag/js/css/placeholder.txt delete mode 100644 Samples/Geotag/js/css/scenario1.css create mode 100644 Samples/Geotag/shared/Scenario1_Geotag.xaml diff --git a/Samples/BluetoothAdvertisement/js/js/scenario3_BackgroundWatcher.js b/Samples/BluetoothAdvertisement/js/js/scenario3_BackgroundWatcher.js index ca1e96c691..6008ebed56 100644 --- a/Samples/BluetoothAdvertisement/js/js/scenario3_BackgroundWatcher.js +++ b/Samples/BluetoothAdvertisement/js/js/scenario3_BackgroundWatcher.js @@ -183,8 +183,8 @@ taskRegistration.addEventListener("completed", onBackgroundTaskCompleted, false); // Even though the trigger is registered successfully, it might be blocked. Notify the user if that is the case. - if ((backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.Denied) || - (backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.Unspecified)) { + if ((backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.denied) || + (backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.unspecified)) { WinJS.log && WinJS.log("Not able to run in background. Application must given permission to be added to lock screen.", "sample", "error"); } diff --git a/Samples/BluetoothAdvertisement/js/js/scenario4_BackgroundPublisher.js b/Samples/BluetoothAdvertisement/js/js/scenario4_BackgroundPublisher.js index 9ee9355399..50f17a713d 100644 --- a/Samples/BluetoothAdvertisement/js/js/scenario4_BackgroundPublisher.js +++ b/Samples/BluetoothAdvertisement/js/js/scenario4_BackgroundPublisher.js @@ -159,8 +159,8 @@ taskRegistration.addEventListener("completed", onBackgroundTaskCompleted, false); // Even though the trigger is registered successfully, it might be blocked. Notify the user if that is the case. - if ((backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.Denied) || - (backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.Unspecified)) { + if ((backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.denied) || + (backgroundAccessStatus == Windows.ApplicationModel.Background.BackgroundAccessStatus.unspecified)) { WinJS.log && WinJS.log("Not able to run in background. Application must given permission to be added to lock screen.", "sample", "error"); } diff --git a/Samples/CameraHdr/cpp/MainPage.xaml.cpp b/Samples/CameraHdr/cpp/MainPage.xaml.cpp index ff19ba2576..c2e86a80dc 100644 --- a/Samples/CameraHdr/cpp/MainPage.xaml.cpp +++ b/Samples/CameraHdr/cpp/MainPage.xaml.cpp @@ -1012,7 +1012,7 @@ void MainPage::AdvancedCapture_OptionalReferencePhotoCaptured(Capture::AdvancedP fileName << context->CaptureFileName->Data(); StringReplace(fileName.str(), std::wstring(L"_HDR"), std::wstring(L"")); - ReencodeAndSavePhotoAsync(args->Frame, ref new String(fileName.str().c_str()), context->CptureOrientation); + ReencodeAndSavePhotoAsync(args->Frame, ref new String(fileName.str().c_str()), context->CaptureOrientation); } /// diff --git a/Samples/D2DGradientMesh/cpp/D2DGradientMesh.vcxproj b/Samples/D2DGradientMesh/cpp/D2DGradientMesh.vcxproj index a988b73504..b97db0e998 100644 --- a/Samples/D2DGradientMesh/cpp/D2DGradientMesh.vcxproj +++ b/Samples/D2DGradientMesh/cpp/D2DGradientMesh.vcxproj @@ -105,7 +105,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h @@ -117,7 +117,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h @@ -129,7 +129,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h @@ -141,7 +141,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h @@ -153,7 +153,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h @@ -165,7 +165,7 @@ - d2d1.lib; d3d11.lib; dxgi.lib; ole32.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) + d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; dxguid.lib; %(AdditionalDependencies) pch.h diff --git a/Samples/Geotag/README.md b/Samples/Geotag/README.md index 9f12446f65..c060e4f46f 100644 --- a/Samples/Geotag/README.md +++ b/Samples/Geotag/README.md @@ -5,19 +5,19 @@ # Geotag sample -This sample demonstrates Windows.Storage.FileProperties.GeotagHelper API usage +This sample demonstrates the GeotagHelper runtime class. -Specifically, this sample covers: - -Scenario 1: Demonstrates using GetGeotagAsync API to retrieve location info from a file. - Also demostrates using SetGeotagAsync API to geotag a file with known location - info, and using SetGeotagFromGeolocatorAsync API to geotag a file with current - device location info provided by location framework. +- Read geotag information from a file. +- Set a file's geotag information to a specific location. +- Set a file's geotag information to the location obtained from a Geolocator. Related topics -------------- -[Known Folders](https://msdn.microsoft.com/library/windows/apps/windows.storage.knownfolders.aspx) +[GeotagHelper class](https://msdn.microsoft.com/library/windows/apps/windows.storage.fileproperties.geotaghelper.aspx) + +[Geolocator class](https://msdn.microsoft.com/library/windows/apps/windows.devices.geolocation.geolocator.aspx) +[Geolocation sample](/Samples/Geolocation) System requirements ------------------- diff --git a/Samples/Geotag/cpp/Geotag.vcxproj b/Samples/Geotag/cpp/Geotag.vcxproj index 98db200a8e..951903f65f 100644 --- a/Samples/Geotag/cpp/Geotag.vcxproj +++ b/Samples/Geotag/cpp/Geotag.vcxproj @@ -149,7 +149,7 @@ - Scenario1_Geotag.xaml + ..\shared\Scenario1_Geotag.xaml @@ -159,7 +159,7 @@ Designer - + Styles\Styles.xaml @@ -186,7 +186,7 @@ - Scenario1_Geotag.xaml + ..\shared\Scenario1_Geotag.xaml diff --git a/Samples/Geotag/cpp/Geotag.vcxproj.filters b/Samples/Geotag/cpp/Geotag.vcxproj.filters index 869679f4c5..e02d6e5e47 100644 --- a/Samples/Geotag/cpp/Geotag.vcxproj.filters +++ b/Samples/Geotag/cpp/Geotag.vcxproj.filters @@ -45,7 +45,7 @@ - + Styles diff --git a/Samples/Geotag/cpp/SampleConfiguration.cpp b/Samples/Geotag/cpp/SampleConfiguration.cpp index 19b8a5c26b..6b42f95fa1 100644 --- a/Samples/Geotag/cpp/SampleConfiguration.cpp +++ b/Samples/Geotag/cpp/SampleConfiguration.cpp @@ -8,5 +8,5 @@ using namespace SDKTemplate; Platform::Array^ MainPage::scenariosInner = ref new Platform::Array { - { "Geotag CPP Sample", "GeotagCPPSample.Scenario1_Geotag" } + { "Geotag a file", "SDKTemplate.Scenario1_Geotag" } }; diff --git a/Samples/Geotag/cpp/Scenario1_Geotag.xaml b/Samples/Geotag/cpp/Scenario1_Geotag.xaml deleted file mode 100644 index 1f6e5c1931..0000000000 --- a/Samples/Geotag/cpp/Scenario1_Geotag.xaml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - Use Geotag API to geotag JPEG/MP4 test file and retrieve geolocation from the file. The test file needs to be put in Pictures library on the device. - For example, put a test file test.jpg in pictures library, and input test.jpg in the text box under File Name: below. Then use these buttons to geotag test - file or retrieve geolocation from the file. - - - - - - File Name: - - -
- -
- -

+ +

+ diff --git a/Samples/Geotag/js/js/sample-configuration.js b/Samples/Geotag/js/js/sample-configuration.js index 2f49f85bc1..a50569676b 100644 --- a/Samples/Geotag/js/js/sample-configuration.js +++ b/Samples/Geotag/js/js/sample-configuration.js @@ -3,10 +3,10 @@ (function () { "use strict"; - var sampleTitle = "Geotag API"; + var sampleTitle = "Geotag JS Sample"; var scenarios = [ - { url: "/html/scenario1.html", title: "Geotag JS Sample" }, + { url: "/html/scenario1.html", title: "Geotag a file" }, ]; WinJS.Namespace.define("SdkSample", { diff --git a/Samples/Geotag/js/js/scenario1.js b/Samples/Geotag/js/js/scenario1.js index 509a4877fb..2c6ee414b1 100644 --- a/Samples/Geotag/js/js/scenario1.js +++ b/Samples/Geotag/js/js/scenario1.js @@ -3,127 +3,89 @@ (function () { "use strict"; - function logError(msg) { - WinJS.log && WinJS.log(msg, "", "error"); - } + // namespaces and classes + var GeotagHelper = Windows.Storage.FileProperties.GeotagHelper; + var Geolocator = Windows.Devices.Geolocation.Geolocator; + var GeolocationAccessStatus = Windows.Devices.Geolocation.GeolocationAccessStatus; + var Geopoint = Windows.Devices.Geolocation.Geopoint; - function logStatus(msg) { - WinJS.log && WinJS.log(msg, "", "status"); - } + // Local variables + var file; + + // DOM elements + var fileOperationsPanel; + var fileDisplayName; - // Apps need to call RequestAccessAsync to get user permission on location usage, - // otherwise SetGeotagFromGeolocator will fail. Also RequestAccessAsync needs - // to be called from a UI thread. - function requestLocationAccess() { - try { - Windows.Devices.Geolocation.Geolocator.requestAccessAsync().then( - function (status) { - if (status != Windows.Devices.Geolocation.GeolocationAccessStatus.allowed) { - logStatus("Location access is NOT allowed"); - } - }, - function (error) { - logError("requestAccessAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); + var page = WinJS.UI.Pages.define("/html/scenario1.html", { + ready: function (element, options) { + fileOperationsPanel = document.getElementById("fileOperationsPanel"); + fileDisplayName = document.getElementById("fileDisplayName"); + + document.getElementById("chooseFileButton").addEventListener("click", chooseFile, false); + document.getElementById("getGeotagButton").addEventListener("click", getGeotag, false); + document.getElementById("setGeotagFromGeolocatorButton").addEventListener("click", setGeotagFromGeolocator, false); + document.getElementById("setGeotagButton").addEventListener("click", setGeotag, false); } + }); + + function chooseFile() { + var picker = new Windows.Storage.Pickers.FileOpenPicker(); + picker.fileTypeFilter.push(".jpg", ".jpeg", ".mp4"); + picker.suggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.picturesLibrary; + picker.pickSingleFileAsync().done(function (pickedFile) { + file = pickedFile; + if (file) { + fileDisplayName.innerText = file.displayName; + fileOperationsPanel.style.display = "block"; + } else { + fileOperationsPanel.style.display = "none"; + } + }); } function getGeotag() { - try { - var inputFilename = document.getElementById("filename").value; - Windows.Storage.KnownFolders.picturesLibrary.getFileAsync(inputFilename).then( - function (file) { - try { - Windows.Storage.FileProperties.GeotagHelper.getGeotagAsync(file).then( - function (result) { - if (result != null) { - logStatus("getGeotagAsync complete - latitude: " + result.position.latitude + " longitude: " + result.position.longitude); - } else { - logStatus("getGeotagAsync complete - location info not available") - } - }, - function (error) { - logError("getGeotagAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); - } - }, - function (error) { - logError("getGeotagAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); - } + GeotagHelper.getGeotagAsync(file).done(function (geopoint) { + if (geopoint) { + WinJS.log && WinJS.log("Latitude = " + geopoint.position.latitude + + ", Longitude = " + geopoint.position.longitude, "sample", "status"); + } else { + // File I/O errors are converted to "No information". + WinJS.log && WinJS.log("No location information available", "sample", "error"); + } + }); } function setGeotagFromGeolocator() { - try { - var inputFilename = document.getElementById("filename").value; - Windows.Storage.KnownFolders.picturesLibrary.getFileAsync(inputFilename).then( - function (file) { - var geolocator = new Windows.Devices.Geolocation.Geolocator(); - geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High; - - Windows.Storage.FileProperties.GeotagHelper.setGeotagFromGeolocatorAsync(file, geolocator).then( - function () { - logStatus("setGeotagFromGeolocatorAsync complete"); - }, - function (error) { - logError("setGeotagFromGeolocatorAsync failed: " + error.message); - } - ); - }, - function (error) { - logError("getFileAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); - } + // Call RequestAccessAsync to get user permission on location usage. + // Otherwise SetGeotagFromGeolocator will fail. + Geolocator.requestAccessAsync().done(function (status) { + if (status != GeolocationAccessStatus.allowed) { + WinJS.log && WinJS.log("Location access is not allowed", "sample", "error"); + } else { + var geolocator = new Geolocator(); + geolocator.desiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.high; + GeotagHelper.setGeotagFromGeolocatorAsync(file, geolocator).done(function () { + WinJS.log && WinJS.log("Geolocation set to current location", "sample", "status"); + }, function (e) { + // File I/O errors are reported as exceptions. + // AccessDeniedExcetion can be raised if the user revoked location access + // after RequestAccessAsync completed. + WinJS.log && WinJS.log("Exception: " + e.message, "sample", "error"); + }); + } + }); } function setGeotag() { - try { - var inputFilename = document.getElementById("filename").value; - Windows.Storage.KnownFolders.picturesLibrary.getFileAsync(inputFilename).then( - function (file) { - try { - // Use latitude 10.0, longitude 20.0 as an example - var geopoint = new Windows.Devices.Geolocation.Geopoint({ latitude: 10.0, longitude: 20.0, altitude: 0.0 }); - Windows.Storage.FileProperties.GeotagHelper.setGeotagAsync(file, geopoint).then( - function () { - logStatus("setGeotagAsync complete"); - }, - function (error) { - logError("setGeotagAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); - } - }, - function (error) { - logError("getFileAsync failed: " + error.message); - } - ); - } catch (error) { - logError("Expection: " + error.message); - } + // Set the approximate position of the observation deck of the Seattle Space Needle. + var geopoint = new Geopoint({ latitude: 47.620491, longitude: -122.349319, altitude: 158.12 }); + + GeotagHelper.setGeotagAsync(file, geopoint).done(function() { + WinJS.log && WinJS.log("Geolocation set to Seattle Space Needle", "sample", "status"); + }, function (e) { + // File I/O errors are reported as exceptions + WinJS.log && WinJS.log("Exception: " + e.message, "sample", "error"); + }); } - - var page = WinJS.UI.Pages.define("/html/scenario1.html", { - ready: function (element, options) { - document.getElementById("GetGeotagButton").addEventListener("click", getGeotag, false); - document.getElementById("SetGeotagFromGeolocatorButton").addEventListener("click", setGeotagFromGeolocator, false); - document.getElementById("SetGeotagButton").addEventListener("click", setGeotag, false); - requestLocationAccess(); - } - }); })(); diff --git a/Samples/Geotag/shared/Scenario1_Geotag.xaml b/Samples/Geotag/shared/Scenario1_Geotag.xaml new file mode 100644 index 0000000000..5dab4d1ff6 --- /dev/null +++ b/Samples/Geotag/shared/Scenario1_Geotag.xaml @@ -0,0 +1,37 @@ + + + + + + + + Use the Geotag API to set and read geolocation information from JPEG and MP4 files. + + + - - - - - - -
+ + + + + diff --git a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RichEditBoxPage.xaml.cs b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RichEditBoxPage.xaml.cs index 90a0727fd5..97af9dfc11 100644 --- a/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RichEditBoxPage.xaml.cs +++ b/Samples/XamlUIBasics/cs/AppUIBasics/ControlPages/RichEditBoxPage.xaml.cs @@ -26,13 +26,9 @@ namespace AppUIBasics.ControlPages ///
public sealed partial class RichEditBoxPage : Page { - List m_highlightedWords = null; - public RichEditBoxPage() { this.InitializeComponent(); - - m_highlightedWords = new List(); } private async void OpenButton_Click(object sender, RoutedEventArgs e) @@ -48,11 +44,12 @@ private async void OpenButton_Click(object sender, RoutedEventArgs e) if (file != null) { - Windows.Storage.Streams.IRandomAccessStream randAccStream = - await file.OpenAsync(Windows.Storage.FileAccessMode.Read); - - // Load the file into the Document property of the RichEditBox. - editor.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, randAccStream); + using (Windows.Storage.Streams.IRandomAccessStream randAccStream = + await file.OpenAsync(Windows.Storage.FileAccessMode.Read)) + { + // Load the file into the Document property of the RichEditBox. + editor.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, randAccStream); + } } } @@ -74,10 +71,11 @@ private async void SaveButton_Click(object sender, RoutedEventArgs e) // finish making changes and call CompleteUpdatesAsync. CachedFileManager.DeferUpdates(file); // write to file - Windows.Storage.Streams.IRandomAccessStream randAccStream = - await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite); - - editor.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, randAccStream); + using (Windows.Storage.Streams.IRandomAccessStream randAccStream = + await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite)) + { + editor.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, randAccStream); + } // Let Windows know that we're finished changing the file so the // other app can update the remote version of the file. @@ -93,79 +91,46 @@ private async void SaveButton_Click(object sender, RoutedEventArgs e) private void BoldButton_Click(object sender, RoutedEventArgs e) { - ITextSelection selectedText = editor.Document.Selection; - if (selectedText != null) - { - ITextCharacterFormat charFormatting = selectedText.CharacterFormat; - charFormatting.Bold = FormatEffect.Toggle; - selectedText.CharacterFormat = charFormatting; - } + editor.Document.Selection.CharacterFormat.Bold = FormatEffect.Toggle; } private void ItalicButton_Click(object sender, RoutedEventArgs e) { - ITextSelection selectedText = editor.Document.Selection; - if (selectedText != null) - { - ITextCharacterFormat charFormatting = selectedText.CharacterFormat; - charFormatting.Italic = FormatEffect.Toggle; - selectedText.CharacterFormat = charFormatting; - } + editor.Document.Selection.CharacterFormat.Italic = FormatEffect.Toggle; } private void ColorButton_Click(object sender, RoutedEventArgs e) { + // Extract the color of the button that was clicked. Button clickedColor = (Button)sender; + var rectangle = (Windows.UI.Xaml.Shapes.Rectangle)clickedColor.Content; + var color = ((Windows.UI.Xaml.Media.SolidColorBrush)rectangle.Fill).Color; + + editor.Document.Selection.CharacterFormat.ForegroundColor = color; - ITextCharacterFormat charFormatting = editor.Document.Selection.CharacterFormat; - switch (clickedColor.Name) + fontColorButton.Flyout.Hide(); + editor.Focus(Windows.UI.Xaml.FocusState.Keyboard); + } + + private void FindBoxHighlightMatches() + { + FindBoxRemoveHighlights(); + + string textToFind = findBox.Text; + if (textToFind != null) { - case "black": - { - charFormatting.ForegroundColor = Colors.Black; - break; - } - - case "gray": - { - charFormatting.ForegroundColor = Colors.Gray; - break; - } - - case "greenyellow": - { - charFormatting.ForegroundColor = Colors.GreenYellow; - break; - } - - case "green": - { - charFormatting.ForegroundColor = Colors.Green; - break; - } - - case "blue": - { - charFormatting.ForegroundColor = Colors.Blue; - break; - } - - case "red": - { - charFormatting.ForegroundColor = Colors.Red; - break; - } - - default: - { - charFormatting.ForegroundColor = Colors.Black; - break; - } + ITextRange searchRange = editor.Document.GetRange(0, 0); + while (searchRange.FindText(textToFind, TextConstants.MaxUnitCount, FindOptions.None) > 0) + { + searchRange.CharacterFormat.BackgroundColor = Colors.Yellow; + } } - editor.Document.Selection.CharacterFormat = charFormatting; + } - editor.Focus(Windows.UI.Xaml.FocusState.Keyboard); - fontColorButton.Flyout.Hide(); + private void FindBoxRemoveHighlights() + { + ITextRange documentRange = editor.Document.GetRange(0, TextConstants.MaxUnitCount); + documentRange.CharacterFormat.BackgroundColor = Colors.Transparent; } private void Page_SizeChanged(object sender, SizeChangedEventArgs e) diff --git a/SharedContent/xaml/Styles.xaml b/SharedContent/xaml/Styles.xaml index 509e1b642d..50602ae5a5 100644 --- a/SharedContent/xaml/Styles.xaml +++ b/SharedContent/xaml/Styles.xaml @@ -16,165 +16,297 @@ xmlns:local="using:SDKTemplate"> - - - - - - - - + + @@ -341,7 +473,6 @@ -