Skip to content

Commit

Permalink
Merge branch 'main' into niels9001/toolkit8
Browse files Browse the repository at this point in the history
  • Loading branch information
karkarl authored Aug 30, 2023
2 parents b464c2a + 1810ed0 commit a46e715
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 6 additions & 6 deletions UITests/Tests/TextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,26 @@ public void SendKeys()
{
textBoxElement1.Clear();
Assert.AreEqual(string.Empty, textBoxElement1.Text);
textBoxElement1.SendKeys("abcde12345!@#$%");
Assert.AreEqual("abcde12345!@#$%", textBoxElement1.Text);
textBoxElement1.SendKeys("abc");
Assert.AreEqual("abc", textBoxElement1.Text);

// Use Ctrl + A to select all text and backspace to clear the box
textBoxElement1.SendKeys(Keys.Control + "a" + Keys.Control + Keys.Backspace);
Assert.AreEqual(string.Empty, textBoxElement1.Text);

textBoxElement2.Clear();
Assert.AreEqual(string.Empty, textBoxElement2.Text);
textBoxElement2.SendKeys("fghij67890^&*()");
Assert.AreEqual("fghij67890^&*()", textBoxElement2.Text);
textBoxElement2.SendKeys("efg");
Assert.AreEqual("efg", textBoxElement2.Text);
}

[TestMethod]
public void Text()
{
textBoxElement1.Clear();
Assert.AreEqual(string.Empty, textBoxElement1.Text);
textBoxElement1.SendKeys("abcde12345!@#$%");
Assert.AreEqual("abcde12345!@#$%", textBoxElement1.Text);
textBoxElement1.SendKeys("abc");
Assert.AreEqual("abc", textBoxElement1.Text);
}
}
}
6 changes: 3 additions & 3 deletions WinUIGallery/ControlPages/MediaPlayerElementPage.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Page x:Class="AppUIBasics.ControlPages.MediaPlayerElementPage"
<Page x:Class="AppUIBasics.ControlPages.MediaPlayerElementPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:AppUIBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<StackPanel>
<local:ControlExample x:Name="Example1" HeaderText="A MediaPlayerElement with transport controls.">
<local:ControlExample.Example>
<MediaPlayerElement Source="ms-appx:///Assets/SampleMedia/ladybug.wmv" MaxWidth="400" AutoPlay="False"
<MediaPlayerElement x:Name="Player1" Source="ms-appx:///Assets/SampleMedia/ladybug.wmv" MaxWidth="400" AutoPlay="False"
AreTransportControlsEnabled="True" />
</local:ControlExample.Example>
<local:ControlExample.Xaml>
Expand All @@ -20,7 +20,7 @@
</local:ControlExample>
<local:ControlExample x:Name="Example2" HeaderText="A MediaPlayerElement that autoplays the video.">
<local:ControlExample.Example>
<MediaPlayerElement Source="ms-appx:///Assets/SampleMedia/fishes.wmv" MaxWidth="400" AutoPlay="True" />
<MediaPlayerElement x:Name="Player2" Source="ms-appx:///Assets/SampleMedia/fishes.wmv" MaxWidth="400" AutoPlay="True" />
</local:ControlExample.Example>
<local:ControlExample.Xaml>
<x:String xml:space="preserve">
Expand Down
17 changes: 16 additions & 1 deletion WinUIGallery/ControlPages/MediaPlayerElementPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -21,5 +21,20 @@ public MediaPlayerElementPage()
{
this.InitializeComponent();
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Needed if this page is getting cached due to the navigation stack.
Player2.MediaPlayer.Play();
}

protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
// Pause media playback since we are no longer visible to the user
Player1.MediaPlayer.Pause();
Player2.MediaPlayer.Pause();
}
}
}

0 comments on commit a46e715

Please sign in to comment.