Skip to content

Commit

Permalink
Windows 10 RTM Release - July 2016 Update 2
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnewthing committed Jul 21, 2016
1 parent a60115e commit 4fde342
Show file tree
Hide file tree
Showing 27 changed files with 232 additions and 449 deletions.
3 changes: 1 addition & 2 deletions Samples/ContactCards/cpp/SampleConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,5 @@ Rect MainPage::GetElementRect(FrameworkElement^ element)
{
Windows::UI::Xaml::Media::GeneralTransform^ buttonTransform = element->TransformToVisual(nullptr);
Point point = buttonTransform->TransformPoint(Point());
return Rect(point, Size(element->ActualWidth, element->ActualHeight));

return Rect(point, Size(static_cast<float>(element->ActualWidth), static_cast<float>(element->ActualHeight)));
}
51 changes: 29 additions & 22 deletions Samples/ContactCards/cpp/Scenario2_DelayMini.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,29 +119,36 @@ void Scenario2_DelayMini::ShowContactCard_Click(Platform::Object^ sender, Routed

ContactCardDelayedDataLoader^ dataLoader = ContactManager::ShowDelayLoadedContactCard(contact, rect, placement, options);

// Simulate downloading more data from the network for the contact.
this->rootPage->NotifyUser("Simulating download...", NotifyType::StatusMessage);

DownloadContactDataAsync(contact).then([this, dataLoader](Contact^ fullContact)
if (dataLoader != nullptr)
{
String^ message;
if (fullContact != nullptr)
{
// Update the contact card with the full set of contact data.
dataLoader->SetData(fullContact);
message = "Contact has been updated with downloaded data.";
}
else
{
message = "No further information available.";
}
// Simulate downloading more data from the network for the contact.
this->rootPage->NotifyUser("Simulating download...", NotifyType::StatusMessage);

Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, message]()
DownloadContactDataAsync(contact).then([this, dataLoader](Contact^ fullContact)
{
this->rootPage->NotifyUser(message, NotifyType::StatusMessage);
}));

// Dispose the object to indicate that the delay-loading operation has completed.
delete dataLoader;
});
String^ message;
if (fullContact != nullptr)
{
// Update the contact card with the full set of contact data.
dataLoader->SetData(fullContact);
message = "Contact has been updated with downloaded data.";
}
else
{
message = "No further information available.";
}

Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, message]()
{
this->rootPage->NotifyUser(message, NotifyType::StatusMessage);
}));

// Dispose the object to indicate that the delay-loading operation has completed.
delete dataLoader;
});
}
else
{
this->rootPage->NotifyUser("ShowDelayLoadedContactCard is not supported by this device.", NotifyType::ErrorMessage);
}
}
26 changes: 16 additions & 10 deletions Samples/ContactCards/cs/Scenario2_DelayMini.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,27 @@ private async void ShowContactCard_Click(object sender, RoutedEventArgs e)

using (ContactCardDelayedDataLoader dataLoader = ContactManager.ShowDelayLoadedContactCard(contact, rect, placement, options))
{
// Simulate downloading more data from the network for the contact.
this.rootPage.NotifyUser("Simulating download...", NotifyType.StatusMessage);

Contact fullContact = await DownloadContactDataAsync(contact);
if (fullContact != null)
if (dataLoader != null)
{
// Update the contact card with the full set of contact data.
dataLoader.SetData(fullContact);
this.rootPage.NotifyUser("Contact has been updated with downloaded data.", NotifyType.StatusMessage);
// Simulate downloading more data from the network for the contact.
this.rootPage.NotifyUser("Simulating download...", NotifyType.StatusMessage);

Contact fullContact = await DownloadContactDataAsync(contact);
if (fullContact != null)
{
// Update the contact card with the full set of contact data.
dataLoader.SetData(fullContact);
this.rootPage.NotifyUser("Contact has been updated with downloaded data.", NotifyType.StatusMessage);
}
else
{
this.rootPage.NotifyUser("No further information available.", NotifyType.StatusMessage);
}
}
else
{
this.rootPage.NotifyUser("No further information available.", NotifyType.StatusMessage);
this.rootPage.NotifyUser("ShowDelayLoadedContactCard is not supported by this device.", NotifyType.ErrorMessage);
}

// The "using" statement will dispose the dataLoader for us.
}
}
Expand Down
36 changes: 20 additions & 16 deletions Samples/ContactCards/js/js/scenario2-delayMini.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
// Create contact object with small set of initial data to display.
var contact = new Contact();
contact.firstName = "Kim";
contact.LlstName = "Abercrombie";
contact.lastName = "Abercrombie";

var email = new ContactEmail();
email.address = "kim@contoso.com";
Expand Down Expand Up @@ -104,21 +104,25 @@

var dataLoader = ContactManager.showDelayLoadedContactCard(contact, rect, placement, options);

// Simulate downloading more data from the network for the contact.
WinJS.log && WinJS.log("Simulating download...", "sample", "status");

downloadContactDataAsync(contact).then(function (fullContact) {
if (fullContact) {
// Update the contact card with the full set of contact data.
dataLoader.setData(fullContact);
WinJS.log && WinJS.log("Contact has been updated with downloaded data.", "sample", "status");
} else {
WinJS.log && WinJS.log("No further information available.", "sample", "status");
}

// Close the object to indicate that the delay-loading operation has completed.
dataLoader.close();
});
if (dataLoader) {
// Simulate downloading more data from the network for the contact.
WinJS.log && WinJS.log("Simulating download...", "sample", "status");

downloadContactDataAsync(contact).then(function (fullContact) {
if (fullContact) {
// Update the contact card with the full set of contact data.
dataLoader.setData(fullContact);
WinJS.log && WinJS.log("Contact has been updated with downloaded data.", "sample", "status");
} else {
WinJS.log && WinJS.log("No further information available.", "sample", "status");
}

// Close the object to indicate that the delay-loading operation has completed.
dataLoader.close();
});
} else {
WinJS.log && WinJS.log("ShowDelayLoadedContactCard is not supported by this device.", "sample", "error");
}
}

})();
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
1
00:00:8,037 --> 00:00:9,494
magoaste-te?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
1
00:00:8,037 --> 00:00:9,494
Är du skadad?

Expand Down
2 changes: 1 addition & 1 deletion Samples/VideoPlayback/cs/CustomMediaTransportControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;

namespace VideoPlayback
namespace SDKTemplate
{
public sealed class CustomMediaTransportControls : MediaTransportControls
{
Expand Down
33 changes: 0 additions & 33 deletions Samples/VideoPlayback/cs/Models/MediaModel.cs

This file was deleted.

11 changes: 10 additions & 1 deletion Samples/VideoPlayback/cs/SampleConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System;
using System.Collections.Generic;
using Windows.UI.Xaml.Controls;
using VideoPlayback;

namespace SDKTemplate
{
Expand All @@ -30,6 +29,16 @@ public partial class MainPage : Page
new Scenario() { Title= "Selecting audio tracks", ClassType=typeof(Scenario6)},
new Scenario() { Title= "Playing video lists", ClassType=typeof(Scenario7)}
};

// These are videos we use in many of our scenarios.
public Uri CaptionedMediaUri { get; } =
new Uri("https://mediaplatstorage1.blob.core.windows.net/windows-universal-samples-media/elephantsdream-clip-h264_sd-aac_eng-aac_spa-aac_eng_commentary-srt_eng-srt_por-srt_swe.mkv");
public Uri UncaptionedMediaUri { get; } =
new Uri("https://mediaplatstorage1.blob.core.windows.net/windows-universal-samples-media/elephantsdream-clip-h264_sd-aac_eng-aac_spa-aac_eng_commentary.mp4");
public Uri MultiTrackVideoMediaUri { get; } =
new Uri("https://mediaplatstorage1.blob.core.windows.net/windows-universal-samples-media/multivideo-with-captions.mkv");
public Uri SintelMediaUri { get; } =
new Uri("https://mediaplatstorage1.blob.core.windows.net/windows-universal-samples-media/sintel_trailer-480p.mp4");
}

public class Scenario
Expand Down
11 changes: 3 additions & 8 deletions Samples/VideoPlayback/cs/Scenario1_PlayingVideos.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
//*********************************************************
-->
<Page
x:Class="VideoPlayback.Scenario1"
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:VideoPlayback"
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">
Expand All @@ -39,14 +39,9 @@
<TextBlock TextWrapping="Wrap" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left"></TextBlock>
<Button x:Name="pickFileButton" Content="Pick video" Margin="0,0,0,10" Click="pickFileButton_Click"/>
</StackPanel>
<MediaElement x:Name="mediaElement" AutoPlay="False" Margin="5" HorizontalAlignment="Stretch" AreTransportControlsEnabled="True"></MediaElement>
<MediaElement x:Name="mediaElement" Source="{x:Bind rootPage.CaptionedMediaUri}" AutoPlay="False" Margin="5" HorizontalAlignment="Stretch" AreTransportControlsEnabled="True"/>
</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>
14 changes: 2 additions & 12 deletions Samples/VideoPlayback/cs/Scenario1_PlayingVideos.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,27 @@
//
//*********************************************************

using SDKTemplate;
using System;
using Windows.Media.Core;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace VideoPlayback
namespace SDKTemplate
{
/// <summary>
/// Demonstrates basic video playback using MediaElement.
/// </summary>
public sealed partial class Scenario1 : Page
{
private MainPage rootPage;
private MainPage rootPage = MainPage.Current;

public Scenario1()
{
this.InitializeComponent();
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;

// Load example video on startup
mediaElement.Source = new Uri("https://mediaplatstorage1.blob.core.windows.net/windows-universal-samples-media/elephantsdream-clip-h264_sd-aac_eng-aac_spa-aac_eng_commentary-srt_eng-srt_por-srt_swe.mkv");
}

/// <summary>
/// Handles the pick file button click event to load a video.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
//*********************************************************
-->
<Page
x:Class="VideoPlayback.Scenario2"
x:Class="SDKTemplate.Scenario2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VideoPlayback"
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">
Expand Down Expand Up @@ -49,7 +49,7 @@

<ScrollViewer Grid.Row="1" VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto">
<MediaElement Name="mediaElement" AreTransportControlsEnabled="True" HorizontalAlignment="Stretch" AutoPlay="True" Margin="0,10,0,0"
Source="http://go.microsoft.com/fwlink/p/?LinkID=272585">
Source="{x:Bind rootPage.CaptionedMediaUri}">
<MediaElement.TransportControls>
<local:CustomMediaTransportControls x:Name="customMTC"
IsFastForwardButtonVisible="True"
Expand All @@ -58,16 +58,12 @@
IsFastRewindEnabled="True"
IsPlaybackRateButtonVisible="True"
IsPlaybackRateEnabled="True"
IsCompact="False">
IsCompact="False"
Liked="CustomMTC_Liked">
</local:CustomMediaTransportControls>
</MediaElement.TransportControls>
</MediaElement>
</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>
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
//
//*********************************************************

using SDKTemplate;
using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace VideoPlayback
namespace SDKTemplate
{
/// <summary>
/// This scenario demonstrates how to customize the media transport controls.
Expand All @@ -24,20 +22,12 @@ namespace VideoPlayback
/// </remarks>
public sealed partial class Scenario2 : Page
{
private MainPage rootPage;
private MainPage rootPage = MainPage.Current;
private int likes = 0;

public Scenario2()
{
this.InitializeComponent();

// Subscribe to the clicked event for the custom like button
this.customMTC.Liked += CustomMTC_Liked;
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
rootPage = MainPage.Current;
}

private void CustomMTC_Liked(object sender, EventArgs e)
Expand Down
Loading

0 comments on commit 4fde342

Please sign in to comment.