Skip to content

Commit

Permalink
Merge branch 'master' into aleader/notifications-10240
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuavio authored Dec 10, 2020
2 parents 2ba288f + 1ebc426 commit e83db79
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 198 deletions.
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!-- 🚨 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 🚨 -->

<!-- 📝 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! 🎉 -->


## Fixes #
<!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static unsafe int ConvertLength<TFrom, TTo>(int length)
}
else if (sizeof(TFrom) == 1)
{
return length / sizeof(TTo);
return (int)((uint)length / (uint)sizeof(TTo));
}
else
{
Expand Down
16 changes: 3 additions & 13 deletions Microsoft.Toolkit.Uwp.Input.GazeInteraction/GazePointer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Windows.Devices.Input.Preview;
using Windows.Foundation;
Expand Down Expand Up @@ -298,20 +299,9 @@ internal int CursorRadius
/// </summary>
public bool IsAlwaysActivated { get; set; }

private static GazePointer _instance = null;
private static ThreadLocal<GazePointer> _instance = new ThreadLocal<GazePointer>(() => new GazePointer());

internal static GazePointer Instance
{
get
{
if (_instance == null)
{
_instance = new GazePointer();
}

return _instance;
}
}
internal static GazePointer Instance => _instance.Value;

internal void AddRoot(int proxyId)
{
Expand Down
12 changes: 8 additions & 4 deletions Microsoft.Toolkit.Uwp.SampleApp/Controls/XamlCodeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public sealed partial class XamlCodeEditor : UserControl
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(nameof(Text), typeof(string), typeof(XamlCodeEditor), new PropertyMetadata(string.Empty));

private ThemeListener _themeListener = new ThemeListener();

public XamlCodeEditor()
{
this.InitializeComponent();
Expand All @@ -40,7 +42,7 @@ public async void ReportError(XamlExceptionRange error)
// Highlight Error Line
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
range,
new IModelDecorationOptions() { IsWholeLine = true, ClassName = _errorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));
new IModelDecorationOptions() { IsWholeLine = true, ClassName = ErrorStyle, HoverMessage = new string[] { error.Message }.ToMarkdownString() }));

// Show Glyph Icon
XamlCodeRenderer.Decorations.Add(new IModelDeltaDecoration(
Expand Down Expand Up @@ -121,10 +123,12 @@ public string Text

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

private CssLineStyle _errorStyle = new CssLineStyle()
private CssLineStyle ErrorStyle
{
BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6))
};
get => _themeListener.CurrentTheme.Equals(ApplicationTheme.Light) ?
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0xFF, 0xD6, 0xD6)) } :
new CssLineStyle() { BackgroundColor = new SolidColorBrush(Color.FromArgb(0x00, 0x66, 0x00, 0x00)) };
}

private CssGlyphStyle _errorIconStyle = new CssGlyphStyle()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
// See the LICENSE file in the project root for more information.

using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.Toolkit.Uwp.Extensions;
using Windows.System;
using Windows.UI.Xaml;
using Microsoft.Toolkit.Uwp.Extensions;

namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
Expand Down
3 changes: 2 additions & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Shell.SamplePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.Extensions;
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
using Microsoft.Toolkit.Uwp.UI.Animations;
Expand Down Expand Up @@ -147,7 +148,7 @@ private void NavView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sende
ShowSamplePicker(category.Samples, true);

// Then Focus on Picker
DispatcherHelper.ExecuteOnUIThreadAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
dispatcherQueue.EnqueueAsync(() => SamplePickerGridView.Focus(FocusState.Keyboard));
}
}
else if (args.IsSettingsInvoked)
Expand Down
3 changes: 2 additions & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Shell.Search.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

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

Expand Down
3 changes: 2 additions & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
Expand All @@ -16,6 +15,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
{
public sealed partial class Shell
{
private readonly DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread();

public static Shell Current { get; private set; }

public Shell()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,26 @@ public static void SetMotion(this InteractionTrackerInertiaMotion modifier, Expr
modifier.Motion = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
}

/// <summary>
/// Use the value of specified ExpressionNode to determine if this composition conditional value modifier should be chosen.
/// </summary>
/// <param name="modifier">The modifier.</param>
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
public static void SetCondition(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
{
modifier.Condition = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
}

/// <summary>
/// Use the value of specified ExpressionNode as the value for this composition conditional value
/// </summary>
/// <param name="modifier">The modifier.</param>
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
public static void SetValue(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
{
modifier.Value = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
}

/// <summary>
/// Creates the expression animation from node.
/// </summary>
Expand Down
Loading

0 comments on commit e83db79

Please sign in to comment.