Merge branch 'master' into rel/3.0.0-preview

This commit is contained in:
Nikola Metulev 2018-05-17 00:09:44 -07:00
Родитель 6ea1be6396 6148c6349d
Коммит ae78f1060e
9 изменённых файлов: 157 добавлений и 91 удалений

Просмотреть файл

@ -12,7 +12,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Toolkit.Extensions;
using Microsoft.Toolkit.Parsers.Markdown.Blocks;
using Microsoft.Toolkit.Parsers.Markdown.Enums;
using Microsoft.Toolkit.Parsers.Markdown.Helpers;
@ -93,6 +95,7 @@ namespace Microsoft.Toolkit.Parsers.Markdown
var paragraphText = new StringBuilder();
// These are needed to parse underline-style header blocks.
int previousRealtStartOfLine = start;
int previousStartOfLine = start;
int previousEndOfLine = start;
@ -150,15 +153,40 @@ namespace Microsoft.Toolkit.Parsers.Markdown
}
else
{
// There were less block quote characters than expected.
// But it doesn't matter if this is not the start of a new paragraph.
if (!lineStartsNewParagraph || nonSpaceChar == '\0')
int lastIndentation = 0;
string lastline = null;
// Determines how many Quote levels were in the last line.
if (realStartOfLine > 0)
{
lastline = markdown.Substring(previousRealtStartOfLine, previousEndOfLine - previousRealtStartOfLine);
lastIndentation = lastline.Count(c => c == '>');
}
var currentEndOfLine = Common.FindNextSingleNewLine(markdown, nonSpacePos, end, out _);
var currentline = markdown.Substring(realStartOfLine, currentEndOfLine - realStartOfLine);
var currentIndentation = currentline.Count(c => c == '>');
var firstChar = markdown[realStartOfLine];
// This is a quote that doesn't start with a Quote marker, but carries on from the last line.
if (lastIndentation == 1)
{
if (nonSpaceChar != '\0' && firstChar != '>')
{
break;
}
}
// Collapse down a level of quotes if the current indentation is greater than the last indentation.
// Only if the last indentation is greater than 1, and the current indentation is greater than 0
if (lastIndentation > 1 && currentIndentation > 0 && currentIndentation < lastIndentation)
{
break;
}
// This must be the end of the blockquote. End the current paragraph, if any.
actualEnd = previousEndOfLine;
actualEnd = realStartOfLine;
if (paragraphText.Length > 0)
{
blocks.Add(ParagraphBlock.Parse(paragraphText.ToString()));
@ -317,6 +345,7 @@ namespace Microsoft.Toolkit.Parsers.Markdown
}
// Repeat.
previousRealtStartOfLine = realStartOfLine;
previousStartOfLine = startOfLine;
previousEndOfLine = endOfLine;
startOfLine = startOfNextLine;

Просмотреть файл

@ -396,27 +396,55 @@ which renders in:
You'll probably do a lot of quoting of other redditors. In those cases, you'll want to use block quotes. Simple begin each line you want quoted with a right angle bracket (>). Multiple angle brackets can be used for nested quotes. To cause a new paragraph to be quoted, begin that paragraph with another angle bracket. So the following:
>Here's a quote.
>Another paragraph in the same quote.
>>A nested quote.
>Quote1
>Back to a single quote.
>Quote2.1
>>Quote2.Nest1.1
>>
>>Quote2.Nest1.2
>
>Quote2.3
And finally some unquoted text.
>Quote3.1
>Quote3.2
>Quote4.1
>
>Quote4.2
>Quote5.1
Quote5.2
>Quote6
Plain text.
Is displayed as:
>Here's a quote.
>Another paragraph in the same quote.
>>A nested quote.
>Quote1
>Back to a single quote.
>Quote2.1
>>Quote2.Nest1.1
>>
>>Quote2.Nest1.2
>
>Quote2.3
And finally some unquoted text.
>Quote3.1
>Quote3.2
>Quote4.1
>
>Quote4.2
>Quote5.1
Quote5.2
>Quote6
Plain text.
*****

Просмотреть файл

@ -9,9 +9,35 @@
mc:Ignorable="d">
<Grid>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBox PlaceholderText="Enter String" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="InputTextBox" MinWidth="300" />
<TextBlock x:Name="IsValid" Padding="0,5"/>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10">
<TextBox PlaceholderText="Enter String" HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="InputTextBox" MinWidth="300" TextChanged="OnTextChanged" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Right" Padding="5,0" Grid.Column="0" Grid.Row="0">IsValidEmail</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" x:Name="IsValidEmailResult" Foreground="Blue" />
<TextBlock HorizontalAlignment="Right" Padding="5,0" Grid.Column="0" Grid.Row="1">IsValidNumber</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" x:Name="IsValidNumberResult" Foreground="Blue" />
<TextBlock HorizontalAlignment="Right" Padding="5,0" Grid.Column="0" Grid.Row="2">IsValidDecimal</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="2" x:Name="IsValidDecimalResult" Foreground="Blue" />
<TextBlock HorizontalAlignment="Right" Padding="5,0" Grid.Column="0" Grid.Row="3">IsValidString</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="3" x:Name="IsValidStringResult" Foreground="Blue" />
<TextBlock HorizontalAlignment="Right" Padding="5,0" Grid.Column="0" Grid.Row="4">IsValidPhoneNumber</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="4" x:Name="IsValidPhoneNumberResult" Foreground="Blue" />
</Grid>
</StackPanel>
</Grid>
</Page>

Просмотреть файл

@ -11,8 +11,8 @@
// ******************************************************************
using Microsoft.Toolkit.Extensions;
using Windows.UI.Text;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -24,34 +24,30 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public StringExtensionsPage()
{
this.InitializeComponent();
ValidateCurrentText();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
private void OnTextChanged(object sender, TextChangedEventArgs e)
{
Shell.Current.RegisterNewCommand("Is Valid Email?", (s, a) =>
{
IsValid.Text = string.Format("IsValid: {0}", InputTextBox.Text.IsEmail());
});
ValidateCurrentText();
}
Shell.Current.RegisterNewCommand("Is Valid Number?", (s, a) =>
{
IsValid.Text = string.Format("IsValid: {0}", InputTextBox.Text.IsNumeric());
});
private void ValidateCurrentText()
{
IsValidEmailResult.Text = InputTextBox.Text.IsEmail().ToString();
IsValidEmailResult.FontWeight = InputTextBox.Text.IsEmail() ? FontWeights.Bold : FontWeights.Normal;
Shell.Current.RegisterNewCommand("Is Valid Decimal?", (s, a) =>
{
IsValid.Text = string.Format("IsValid: {0}", InputTextBox.Text.IsDecimal());
});
IsValidNumberResult.Text = InputTextBox.Text.IsNumeric().ToString();
IsValidNumberResult.FontWeight = InputTextBox.Text.IsNumeric() ? FontWeights.Bold : FontWeights.Normal;
Shell.Current.RegisterNewCommand("Is Valid String?", (s, a) =>
{
IsValid.Text = string.Format("IsValid: {0}", InputTextBox.Text.IsCharacterString());
});
IsValidDecimalResult.Text = InputTextBox.Text.IsDecimal().ToString();
IsValidDecimalResult.FontWeight = InputTextBox.Text.IsDecimal() ? FontWeights.Bold : FontWeights.Normal;
Shell.Current.RegisterNewCommand("Is Valid PhoneNumber?", (s, a) =>
{
IsValid.Text = string.Format("IsValid: {0}", InputTextBox.Text.IsPhoneNumber());
});
IsValidStringResult.Text = InputTextBox.Text.IsCharacterString().ToString();
IsValidPhoneNumberResult.FontWeight = InputTextBox.Text.IsCharacterString() ? FontWeights.Bold : FontWeights.Normal;
IsValidPhoneNumberResult.Text = InputTextBox.Text.IsPhoneNumber().ToString();
IsValidPhoneNumberResult.FontWeight = InputTextBox.Text.IsPhoneNumber() ? FontWeights.Bold : FontWeights.Normal;
}
}
}

Просмотреть файл

@ -21,14 +21,6 @@
NineGrid="{TemplateBinding NineGrid}"
Opacity="0.0"
Stretch="{TemplateBinding Stretch}" />
<ProgressRing Name="Progress"
Margin="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
Foreground="{TemplateBinding Foreground}"
IsActive="False"
Visibility="Collapsed" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Failed">
@ -47,16 +39,6 @@
</VisualState>
<VisualState x:Name="Loading">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Progress"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Visible" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Progress"
Storyboard.TargetProperty="IsActive">
<DiscreteObjectKeyFrame KeyTime="0"
Value="True" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Image"
Storyboard.TargetProperty="Opacity">
<DiscreteObjectKeyFrame KeyTime="0"

Просмотреть файл

@ -343,7 +343,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
}
/// <summary>
/// Gets or sets the tick spacing, in units.
/// Gets or sets the tick spacing, in units. Values of zero or less will be ignored when drawing.
/// </summary>
public int TickSpacing
{
@ -619,29 +619,32 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
radialGauge._root.Children.RemoveAll();
radialGauge._compositor = radialGauge._root.Compositor;
// Ticks.
SpriteVisual tick;
for (double i = radialGauge.Minimum; i <= radialGauge.Maximum; i += radialGauge.TickSpacing)
if (radialGauge.TickSpacing > 0)
{
tick = radialGauge._compositor.CreateSpriteVisual();
tick.Size = new Vector2((float)radialGauge.TickWidth, (float)radialGauge.TickLength);
tick.Brush = radialGauge._compositor.CreateColorBrush(radialGauge.TickBrush.Color);
tick.Offset = new Vector3(100 - ((float)radialGauge.TickWidth / 2), 0.0f, 0);
tick.CenterPoint = new Vector3((float)radialGauge.TickWidth / 2, 100.0f, 0);
tick.RotationAngleInDegrees = (float)radialGauge.ValueToAngle(i);
radialGauge._root.Children.InsertAtTop(tick);
}
// Ticks.
SpriteVisual tick;
for (double i = radialGauge.Minimum; i <= radialGauge.Maximum; i += radialGauge.TickSpacing)
{
tick = radialGauge._compositor.CreateSpriteVisual();
tick.Size = new Vector2((float)radialGauge.TickWidth, (float)radialGauge.TickLength);
tick.Brush = radialGauge._compositor.CreateColorBrush(radialGauge.TickBrush.Color);
tick.Offset = new Vector3(100 - ((float)radialGauge.TickWidth / 2), 0.0f, 0);
tick.CenterPoint = new Vector3((float)radialGauge.TickWidth / 2, 100.0f, 0);
tick.RotationAngleInDegrees = (float)radialGauge.ValueToAngle(i);
radialGauge._root.Children.InsertAtTop(tick);
}
// Scale Ticks.
for (double i = radialGauge.Minimum; i <= radialGauge.Maximum; i += radialGauge.TickSpacing)
{
tick = radialGauge._compositor.CreateSpriteVisual();
tick.Size = new Vector2((float)radialGauge.ScaleTickWidth, (float)radialGauge.ScaleWidth);
tick.Brush = radialGauge._compositor.CreateColorBrush(radialGauge.ScaleTickBrush.Color);
tick.Offset = new Vector3(100 - ((float)radialGauge.ScaleTickWidth / 2), (float)radialGauge.ScalePadding, 0);
tick.CenterPoint = new Vector3((float)radialGauge.ScaleTickWidth / 2, 100 - (float)radialGauge.ScalePadding, 0);
tick.RotationAngleInDegrees = (float)radialGauge.ValueToAngle(i);
radialGauge._root.Children.InsertAtTop(tick);
// Scale Ticks.
for (double i = radialGauge.Minimum; i <= radialGauge.Maximum; i += radialGauge.TickSpacing)
{
tick = radialGauge._compositor.CreateSpriteVisual();
tick.Size = new Vector2((float)radialGauge.ScaleTickWidth, (float)radialGauge.ScaleWidth);
tick.Brush = radialGauge._compositor.CreateColorBrush(radialGauge.ScaleTickBrush.Color);
tick.Offset = new Vector3(100 - ((float)radialGauge.ScaleTickWidth / 2), (float)radialGauge.ScalePadding, 0);
tick.CenterPoint = new Vector3((float)radialGauge.ScaleTickWidth / 2, 100 - (float)radialGauge.ScalePadding, 0);
tick.RotationAngleInDegrees = (float)radialGauge.ValueToAngle(i);
radialGauge._root.Children.InsertAtTop(tick);
}
}
// Needle.

Просмотреть файл

@ -246,8 +246,6 @@ Version 3.0 of the Windows Community Toolkit adds another related property calle
> [!NOTE]
The `ItemClick` and `OptionsItemClick` events will continue to work but the EventArgs will be null when `UseNavigationViewWhenPossible` is set to true. There is a new event called `ItemInvoked` that should be used instead. This new event will include information about the clicked item and whether it is an item or options item. This event also works if UseNavigationViewWhenPossible is set to false.
*****
> [!NOTE]
The PaneBackground will not have any effect when `UseNavigationViewWhenPossible` is set to null. To change the pane background of the NavigationView, modify the two theme resources by overwriting them in your App.xaml. See the [NavigationVew documentation](https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/navigationview#customizing-backgrounds) for more details.

Просмотреть файл

@ -46,6 +46,10 @@ On Windows 10.0.16299.0 or higher, `CornerRadius` is supported on ImageEx. Use
## Default Template
ImageEx control supports use of Progress Indicator. This can be enabled by adding ImageEx template from previous release of the control.
- [ImageEx Control with Progress Indicator XAML File](https://github.com/Microsoft/WindowsCommunityToolkit/blob/rel/2.2.0/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageEx.xaml) is the XAML template used in v2.2.0.0 of toolkit.
- [ImageEx Control XAML File](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/ImageEx.xaml) is the XAML template used in the toolkit for the default styling.
- [RoundImageEx Control XAML File](https://github.com/Microsoft/UWPCommunityToolkit/blob/master/Microsoft.Toolkit.Uwp.UI.Controls/ImageEx/RoundImageEx.xaml) is the XAML template used in the toolkit for the default styling of the Control that has Corner Rounding.

Просмотреть файл

@ -71,13 +71,13 @@ Once you search you should see a list similar to the one below (versions may be
* [Scale](https://docs.microsoft.com/windows/uwpcommunitytoolkit/animations/Scale/)
### Brushes
* [BackdropBlurBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/BackdropBlurBrush/)
* [BackdropGammaTransferBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/BackdropGammaTransferBrush/)
* [BackdropInvertBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/BackdropInvertBrush/)
* [BackdropSaturationBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/BackdropSaturationBrush/)
* [BackdropSepiaBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/BackdropSepiaBrush/)
* [ImageBlendBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/ImageBlendBrush/)
* [RadialGradientBrush](http://docs.uwpcommunitytoolkit.com/en/master/brushes/RadialGradientBrush/)
* [BackdropBlurBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/BackdropBlurBrush/)
* [BackdropGammaTransferBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/BackdropGammaTransferBrush/)
* [BackdropInvertBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/BackdropInvertBrush/)
* [BackdropSaturationBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/BackdropSaturationBrush/)
* [BackdropSepiaBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/BackdropSepiaBrush/)
* [ImageBlendBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/ImageBlendBrush/)
* [RadialGradientBrush](https://docs.microsoft.com/windows/uwpcommunitytoolkit/brushes/RadialGradientBrush/)
### Controls
* [AdaptiveGridView](https://docs.microsoft.com/windows/uwpcommunitytoolkit/controls/AdaptiveGridView/)
@ -120,7 +120,7 @@ Once you search you should see a list similar to the one below (versions may be
* [ListViewExtensions](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/ListViewBase/)
* [LogicalTree](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/LogicalTree/)
* [MouseCursor](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/MouseCursor/)
* [NavigationView Styles](https://docs.uwpcommunitytoolkit.com/windows/uwpcommunitytoolkit/extensions/NavigationView/)
* [NavigationView Styles](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/NavigationView/)
* [ScrollViewerExtensions](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/ScrollViewerExtensions/)
* [SurfaceDialTextbox](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/SurfaceDialTextboxHelper/)
* [TextBoxMask](https://docs.microsoft.com/windows/uwpcommunitytoolkit/extensions/TextBoxMask/)