Skip to content

Commit 6dbd367

Browse files
authored
Merge pull request #3215 from windows-toolkit/master
Merge Master into dev/7.0.0 branch with new Unit Test CI changes
2 parents 9c95639 + 7df2ca5 commit 6dbd367

28 files changed

+302
-201
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</PropertyGroup>
2121

2222
<PropertyGroup>
23-
<SignAssembly Condition="'$(SignAssembly)' == '' and '$(IsUwpProject)' != 'true'" >true</SignAssembly>
23+
<SignAssembly Condition="'$(SignAssembly)' == '' and '$(IsUwpProject)' != 'true' and '$(IsTestSampleProject)' != 'true'" >true</SignAssembly>
2424
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
2525
</PropertyGroup>
2626

GazeInputTest/App.xaml.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
65
using System;
6+
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
77
using Windows.ApplicationModel;
88
using Windows.ApplicationModel.Activation;
99
using Windows.UI.Xaml;
@@ -15,9 +15,10 @@ namespace GazeInputTest
1515
/// <summary>
1616
/// Provides application-specific behavior to supplement the default Application class.
1717
/// </summary>
18-
sealed partial class App : Application
18+
public sealed partial class App : Application
1919
{
2020
/// <summary>
21+
/// Initializes a new instance of the <see cref="App"/> class.
2122
/// Initializes the singleton application object. This is the first line of authored code
2223
/// executed, and as such is the logical equivalent of main() or WinMain().
2324
/// </summary>
@@ -47,7 +48,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
4748

4849
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
4950
{
50-
//TODO: Load state from previously suspended application
51+
// TODO: Load state from previously suspended application
5152
}
5253

5354
// Place the frame in the current Window
@@ -63,6 +64,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
6364
// parameter
6465
rootFrame.Navigate(typeof(MainPage), e.Arguments);
6566
}
67+
6668
// Ensure the current window is active
6769
Window.Current.Activate();
6870
}
@@ -75,7 +77,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
7577
/// </summary>
7678
/// <param name="sender">The Frame which failed navigation</param>
7779
/// <param name="e">Details about the navigation failure</param>
78-
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
80+
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
7981
{
8082
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
8183
}
@@ -90,7 +92,8 @@ void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
9092
private void OnSuspending(object sender, SuspendingEventArgs e)
9193
{
9294
var deferral = e.SuspendingOperation.GetDeferral();
93-
//TODO: Save application state and stop any background activity
95+
96+
// TODO: Save application state and stop any background activity
9497
deferral.Complete();
9598
}
9699
}

GazeInputTest/GazeInputTest.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@
152152
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
153153
<Version>6.2.9</Version>
154154
</PackageReference>
155+
<PackageReference Include="StyleCop.Analyzers">
156+
<Version>1.0.2</Version>
157+
</PackageReference>
155158
</ItemGroup>
156159
<ItemGroup>
157160
<ProjectReference Include="..\Microsoft.Toolkit.UWP.Input.GazeInteraction\Microsoft.Toolkit.Uwp.Input.GazeInteraction.vcxproj">

GazeInputTest/MainPage.xaml.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
65
using System;
6+
using Microsoft.Toolkit.Uwp.Input.GazeInteraction;
77
using Windows.ApplicationModel.Core;
88
using Windows.UI.Core;
99
using Windows.UI.ViewManagement;
@@ -50,18 +50,18 @@ private void ShowCursor_Toggle(object sender, RoutedEventArgs e)
5050
}
5151
}
5252

53-
int clickCount;
53+
private int _clickCount;
5454

5555
private void OnLegacyInvoked(object sender, RoutedEventArgs e)
5656
{
57-
clickCount++;
58-
HowButton.Content = string.Format("{0}: Legacy click", clickCount);
57+
_clickCount++;
58+
HowButton.Content = string.Format("{0}: Legacy click", _clickCount);
5959
}
6060

6161
private void OnGazeInvoked(object sender, DwellInvokedRoutedEventArgs e)
6262
{
63-
clickCount++;
64-
HowButton.Content = string.Format("{0}: Accessible click", clickCount);
63+
_clickCount++;
64+
HowButton.Content = string.Format("{0}: Accessible click", _clickCount);
6565
e.Handled = true;
6666
}
6767

@@ -71,13 +71,13 @@ private void OnInvokeProgress(object sender, DwellProgressEventArgs e)
7171
{
7272
ProgressShow.Value = 100.0 * e.Progress;
7373
}
74+
7475
ProgressShow.IsIndeterminate = e.State == DwellProgressState.Complete;
7576
e.Handled = true;
7677
}
7778

7879
private async void SpawnClicked(object sender, RoutedEventArgs e)
7980
{
80-
8181
var newView = CoreApplication.CreateNewView();
8282
var newViewId = 0;
8383

Microsoft.Toolkit.Parsers/Markdown/Blocks/HeaderBlock.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
1111
{
1212
/// <summary>
1313
/// Represents a heading.
14+
/// <seealso href="https://spec.commonmark.org/0.29/#atx-headings">Single-Line Header CommonMark Spec</seealso>
15+
/// <seealso href="https://spec.commonmark.org/0.29/#setext-headings">Two-Line Header CommonMark Spec</seealso>
1416
/// </summary>
1517
public class HeaderBlock : MarkdownBlock
1618
{

Microsoft.Toolkit.Parsers/Markdown/MarkdownDocument.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ internal static List<MarkdownBlock> Parse(string markdown, int start, int end, i
233233
realStartOfLine = startOfLine;
234234
endOfLine = startOfLine + 3;
235235
startOfNextLine = Common.FindNextSingleNewLine(markdown, startOfLine, end, out startOfNextLine);
236-
}
237236

238-
paragraphText.Clear();
237+
paragraphText.Clear();
238+
}
239239
}
240240

241241
if (newBlockElement == null && nonSpaceChar == '#' && nonSpacePos == startOfLine)

Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas/Controls/InfiniteCanvasTextBox.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@ protected override void OnApplyTemplate()
3535
_editZone.TextChanged -= EditZone_TextChanged;
3636
_editZone.TextChanged += EditZone_TextChanged;
3737
_editZone.FontSize = FontSize;
38-
_editZone.SelectionHighlightColorWhenNotFocused.Color = Color.FromArgb(
39-
1,
40-
_editZone.SelectionHighlightColor.Color.R,
41-
_editZone.SelectionHighlightColor.Color.G,
42-
_editZone.SelectionHighlightColor.Color.B);
43-
_editZone.SelectionHighlightColorWhenNotFocused.Opacity = .1;
44-
45-
_editZone.SelectionHighlightColor.Color =
46-
Color.FromArgb(
47-
1,
48-
_editZone.SelectionHighlightColor.Color.R,
49-
_editZone.SelectionHighlightColor.Color.G,
50-
_editZone.SelectionHighlightColor.Color.B);
51-
52-
_editZone.SelectionHighlightColor.Opacity = .1;
53-
5438
base.OnApplyTemplate();
5539
}
5640

Microsoft.Toolkit.Uwp.UI.Controls/InfiniteCanvas/InfiniteCanvas.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
</InkToolbarCustomToolButton>
3030
</InkToolbar>
3131

32-
<StackPanel Background="{ThemeResource SystemChromeMediumColor}"
32+
<StackPanel Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}"
3333
Orientation="Horizontal">
3434
<Grid Width="2"
3535
Height="48"
36-
Background="{ThemeResource SystemListMediumColor}" />
36+
Background="{ThemeResource SystemControlBackgroundListMediumBrush}" />
3737
<Button x:Name="EraseAllButton"
3838
Style="{StaticResource CanvasTextBoxButtonStyle}"
3939
ToolTipService.ToolTip="Erase All">
@@ -57,7 +57,7 @@
5757
</Button>
5858
</StackPanel>
5959
<StackPanel x:Name="CanvasTextBoxTools"
60-
Background="{ThemeResource SystemChromeMediumColor}"
60+
Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}"
6161
Orientation="Horizontal"
6262
Visibility="Collapsed">
6363
<Grid Width="2"
@@ -157,14 +157,14 @@
157157
TargetType="ToggleButton">
158158
<Setter Property="Width" Value="48" />
159159
<Setter Property="Height" Value="48" />
160-
<Setter Property="Background" Value="{ThemeResource SystemChromeMediumColor}" />
160+
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumBrush}" />
161161
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
162162
</Style>
163163
<Style x:Key="CanvasTextBoxButtonStyle"
164164
TargetType="Button">
165165
<Setter Property="Width" Value="48" />
166166
<Setter Property="Height" Value="48" />
167-
<Setter Property="Background" Value="{ThemeResource SystemChromeMediumColor}" />
167+
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumBrush}" />
168168
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
169169
</Style>
170170

Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/MarkdownTextBlock.Methods.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ private void RenderMarkdown()
4848
// Disconnect from OnClick handlers.
4949
UnhookListeners();
5050

51+
// Clear everything that exists.
52+
_listeningHyperlinks.Clear();
53+
5154
var markdownRenderedArgs = new MarkdownRenderedEventArgs(null);
5255

5356
// Make sure we have something to parse.
@@ -174,23 +177,38 @@ private void RenderMarkdown()
174177
MarkdownRendered?.Invoke(this, markdownRenderedArgs);
175178
}
176179

177-
private void UnhookListeners()
180+
private void HookListeners()
178181
{
179-
// Clear any hyper link events if we have any
182+
// Re-hook all hyper link events we currently have
180183
foreach (object link in _listeningHyperlinks)
181184
{
182185
if (link is Hyperlink hyperlink)
183186
{
184187
hyperlink.Click -= Hyperlink_Click;
188+
hyperlink.Click += Hyperlink_Click;
185189
}
186190
else if (link is Image image)
187191
{
188192
image.Tapped -= NewImagelink_Tapped;
193+
image.Tapped += NewImagelink_Tapped;
189194
}
190195
}
196+
}
191197

192-
// Clear everything that exists.
193-
_listeningHyperlinks.Clear();
198+
private void UnhookListeners()
199+
{
200+
// Unhook any hyper link events if we have any
201+
foreach (object link in _listeningHyperlinks)
202+
{
203+
if (link is Hyperlink hyperlink)
204+
{
205+
hyperlink.Click -= Hyperlink_Click;
206+
}
207+
else if (link is Image image)
208+
{
209+
image.Tapped -= NewImagelink_Tapped;
210+
}
211+
}
194212
}
195213

196214
/// <summary>

Microsoft.Toolkit.Uwp.UI.Controls/MarkdownTextBlock/MarkdownTextBlock.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ private void ThemeListener_ThemeChanged(Helpers.ThemeListener sender)
4747
private void OnLoaded(object sender, RoutedEventArgs e)
4848
{
4949
RegisterThemeChangedHandler();
50+
HookListeners();
5051

5152
// Register for property callbacks that are owned by our parent class.
5253
_fontSizePropertyToken = RegisterPropertyChangedCallback(FontSizeProperty, OnPropertyChanged);

0 commit comments

Comments
 (0)