Skip to content

Commit 9b9385b

Browse files
Merge branch 'master' into petea/issues/3589
2 parents e293fe2 + 97fd126 commit 9b9385b

File tree

14 files changed

+137
-112
lines changed

14 files changed

+137
-112
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.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()

0 commit comments

Comments
 (0)