Skip to content

Commit e83db79

Browse files
authored
Merge branch 'master' into aleader/notifications-10240
2 parents 2ba288f + 1ebc426 commit e83db79

File tree

17 files changed

+205
-198
lines changed

17 files changed

+205
-198
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 -->
22

3+
<!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 -->
4+
5+
36
## Fixes #
47
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->
58

Microsoft.Toolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static unsafe int ConvertLength<TFrom, TTo>(int length)
4242
}
4343
else if (sizeof(TFrom) == 1)
4444
{
45-
return length / sizeof(TTo);
45+
return (int)((uint)length / (uint)sizeof(TTo));
4646
}
4747
else
4848
{

Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Diagnostics;
88
using System.Linq;
9+
using System.Threading;
910
using System.Threading.Tasks;
1011
using Windows.Devices.Input.Preview;
1112
using Windows.Foundation;
@@ -298,20 +299,9 @@ internal int CursorRadius
298299
/// </summary>
299300
public bool IsAlwaysActivated { get; set; }
300301

301-
private static GazePointer _instance = null;
302+
private static ThreadLocal<GazePointer> _instance = new ThreadLocal<GazePointer>(() => new GazePointer());
302303

303-
internal static GazePointer Instance
304-
{
305-
get
306-
{
307-
if (_instance == null)
308-
{
309-
_instance = new GazePointer();
310-
}
311-
312-
return _instance;
313-
}
314-
}
304+
internal static GazePointer Instance => _instance.Value;
315305

316306
internal void AddRoot(int proxyId)
317307
{

Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public sealed partial class XamlCodeEditor : UserControl
2121
public static readonly DependencyProperty TextProperty =
2222
DependencyProperty.Register(nameof(Text), typeof(string), typeof(XamlCodeEditor), new PropertyMetadata(string.Empty));
2323

24+
private ThemeListener _themeListener = new ThemeListener();
25+
2426
public XamlCodeEditor()
2527
{
2628
this.InitializeComponent();
@@ -40,7 +42,7 @@ public async void ReportError(XamlExceptionRange error)
4042
// Highlight Error Line
4143
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
4244
range,
43-
new IModelDecorationOptions() { IsWholeLine = true, ClassName = _errorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
45+
new IModelDecorationOptions() { IsWholeLine = true, ClassName = ErrorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
4446

4547
// Show Glyph Icon
4648
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
@@ -121,10 +123,12 @@ public string Text
121123

122124
public DateTime TimeSampleEditedLast { get; private set; } = DateTime.MinValue;
123125

124-
private CssLineStyle _errorStyle = new CssLineStyle()
126+
private CssLineStyle ErrorStyle
125127
{
126-
BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6))
127-
};
128+
get => _themeListener.CurrentTheme.Equals(ApplicationTheme.Light) ?
129+
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) } :
130+
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0x66, 0x00, 0x00)) };
131+
}
128132

129133
private CssGlyphStyle _errorIconStyle = new CssGlyphStyle()
130134
{

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/DispatcherQueueHelper/DispatcherQueueHelperPage.xaml.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Threading.Tasks;
6-
using Microsoft.Toolkit.Uwp.Helpers;
6+
using Microsoft.Toolkit.Uwp.Extensions;
77
using Windows.System;
88
using Windows.UI.Xaml;
9-
using Microsoft.Toolkit.Uwp.Extensions;
109

1110
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
1211
{

Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Linq;
88
using System.Numerics;
99
using System.Threading.Tasks;
10+
using Microsoft.Toolkit.Uwp.Extensions;
1011
using Microsoft.Toolkit.Uwp.Helpers;
1112
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
1213
using Microsoft.Toolkit.Uwp.UI.Animations;
@@ -147,7 +148,7 @@ private void NavView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
147148
ShowSamplePicker(category.Samples, true);
148149

149150
// Then Focus on Picker
150-
DispatcherHelper.ExecuteOnUIThreadAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
151+
dispatcherQueue.EnqueueAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
151152
}
152153
}
153154
else if (args.IsSettingsInvoked)

Microsoft.Toolkit.Uwp.SampleApp/Shell.Search.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Linq;
6+
using Microsoft.Toolkit.Uwp.Extensions;
67
using Microsoft.Toolkit.Uwp.Helpers;
78
using Microsoft.Toolkit.Uwp.UI.Extensions;
89
using Windows.UI.Xaml;
@@ -76,7 +77,7 @@ private void SearchBox_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEve
7677
if (e.Key == Windows.System.VirtualKey.Down && SamplePickerGrid.Visibility == Windows.UI.Xaml.Visibility.Visible)
7778
{
7879
// If we try and navigate down out of the textbox (and there's search results), go to the search results.
79-
DispatcherHelper.ExecuteOnUIThreadAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
80+
dispatcherQueue.EnqueueAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
8081
}
8182
}
8283

Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
88
using Microsoft.Toolkit.Uwp.UI.Extensions;
99
using Windows.System;
10-
using Windows.UI.Xaml;
1110
using Windows.UI.Xaml.Controls;
1211
using Windows.UI.Xaml.Media.Animation;
1312
using Windows.UI.Xaml.Navigation;
@@ -16,6 +15,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
1615
{
1716
public sealed partial class Shell
1817
{
18+
private readonly DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread();
19+
1920
public static Shell Current { get; private set; }
2021

2122
public Shell()

Microsoft.Toolkit.Uwp.UI.Animations/Expressions/CompositionExtensions.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ public static void SetMotion(this InteractionTrackerInertiaMotion modifier, Expr
221221
modifier.Motion = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
222222
}
223223

224+
/// <summary>
225+
/// Use the value of specified ExpressionNode to determine if this composition conditional value modifier should be chosen.
226+
/// </summary>
227+
/// <param name="modifier">The modifier.</param>
228+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
229+
public static void SetCondition(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
230+
{
231+
modifier.Condition = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
232+
}
233+
234+
/// <summary>
235+
/// Use the value of specified ExpressionNode as the value for this composition conditional value
236+
/// </summary>
237+
/// <param name="modifier">The modifier.</param>
238+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
239+
public static void SetValue(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
240+
{
241+
modifier.Value = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
242+
}
243+
224244
/// <summary>
225245
/// Creates the expression animation from node.
226246
/// </summary>

0 commit comments

Comments
 (0)