Skip to content

Commit

Permalink
update demo to use windows ui; increase target sdk version to 17763.
Browse files Browse the repository at this point in the history
  • Loading branch information
escape-llc committed Oct 12, 2019
1 parent a0db23b commit 58c137a
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 87 deletions.
31 changes: 7 additions & 24 deletions YetAnotherChartComponent/YaccTests/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">

<Identity Name="e4341dc3-61e5-4964-9304-880563ca8dbd"
Publisher="CN=johng"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="e4341dc3-61e5-4964-9304-880563ca8dbd" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="e4341dc3-61e5-4964-9304-880563ca8dbd" Publisher="CN=eScape Technology LLC" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="e4341dc3-61e5-4964-9304-880563ca8dbd" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>YaccTests</DisplayName>
<PublisherDisplayName>johng</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="vstest.executionengine.universal.App"
Executable="$targetnametoken$.exe"
EntryPoint="YaccTests.App">
<uap:VisualElements
DisplayName="YaccTests"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="YaccTests"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<Application Id="vstest.executionengine.universal.App" Executable="$targetnametoken$.exe" EntryPoint="YaccTests.App">
<uap:VisualElements DisplayName="YaccTests" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="YaccTests" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
Expand Down
13 changes: 7 additions & 6 deletions YetAnotherChartComponent/YaccTests/YaccTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>YaccTests_TemporaryKey.pfx</PackageCertificateKeyFile>
<UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion>
<PackageCertificateThumbprint>F21A92276700EDA5A10903E0F674EC458690FF66</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -127,17 +128,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.1.5</Version>
<Version>6.2.9</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.3.2</Version>
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>1.3.2</Version>
<Version>2.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>16.3.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk">
<Version>15.7.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\YetAnotherChartComponent\YetAnotherChartComponent.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,24 +244,6 @@ private void CommonInit() {
#endregion
#region helpers
/// <summary>
/// Layout pass size changed.
/// Just-in-time re-position of label element at exactly the right spot after it's done with (asynchronous) measure/arrange.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Element_SizeChanged(object sender, SizeChangedEventArgs e) {
#if false
var vm = fe.DataContext as DataTemplateShim;
_trace.Verbose($"{Name} sizeChanged ps:{e.PreviousSize} ns:{e.NewSize} text:{vm?.Text}");
#endif
var fe = sender as FrameworkElement;
var state = AxisLabels.SingleOrDefault((sis) => sis.element == fe);
if (state != null) {
var loc = state.UpdateLocation();
_trace.Verbose($"{Name} sizeChanged loc:{loc} yv:{state.value} ns:{e.NewSize}");
}
}
/// <summary>
/// Rebuild the axis geometry based on current extents.
/// </summary>
void RebuildAxisGeometry() {
Expand Down Expand Up @@ -344,6 +326,26 @@ void ElementPipeline(SelectorContext sc, ItemState ist, Recycler<FrameworkElemen
#endregion
#region extensions
#endregion
#region evhs
/// <summary>
/// Layout pass size changed.
/// Just-in-time re-position of label element at exactly the right spot after it's done with (asynchronous) measure/arrange.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Element_SizeChanged(object sender, SizeChangedEventArgs e) {
#if false
var vm = fe.DataContext as DataTemplateShim;
_trace.Verbose($"{Name} sizeChanged ps:{e.PreviousSize} ns:{e.NewSize} text:{vm?.Text}");
#endif
var fe = sender as FrameworkElement;
var state = AxisLabels.SingleOrDefault((sis) => sis.element == fe);
if (state != null) {
var loc = state.UpdateLocation();
_trace.Verbose($"{Name} sizeChanged[{state.index}] loc:{loc} yv:{state.value} ns:{e.NewSize}");
}
}
#endregion
#region IRequireEnterLeave
/// <summary>
/// Add elements and attach bindings.
Expand Down Expand Up @@ -536,8 +538,8 @@ void IRequireDataSourceUpdates.Add(IChartRenderContext icrc, int startAt, IList
}
// re-sequence remaining items
for (int ix = startAt + reproc.Count; ix < AxisLabels.Count; ix++) {
AxisLabels[ix].index = ix + items.Count;
AxisLabels[ix].value = ix + items.Count;
AxisLabels[ix].index = ix;
AxisLabels[ix].value = ix;
}
// render new items
// run the element pipeline on the added items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ void DoTickLabels(IChartRenderContext icrc) {
// TODO may want to include the LabelStyle's padding if defined
var padding = AxisLineThickness + 2 * AxisMargin;
var tbr = new Recycler<FrameworkElement, ItemState>(TickLabels.Select(tl => tl.tb), (ist) => {
var tb = CreateElement(ist);
tb.Width = icrc.Area.Width - padding;
if (tb is TextBlock tbb) {
var fe = CreateElement(ist);
fe.Width = icrc.Area.Width - padding;
if (fe is TextBlock tbb) {
tbb.Padding = Side == Side.Right ? new Thickness(padding, 0, 0, 0) : new Thickness(0, 0, padding, 0);
}
return tb;
return fe;
});
var itemstate = new List<ItemState>();
// materialize the ticks
Expand Down
15 changes: 14 additions & 1 deletion YetAnotherChartComponent/YetAnotherChartComponent/Chart/Chart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ public Chart() :base() {
Axes = new List<IChartAxis>();
DeferredEnter = new List<ChartComponent>();
LayoutUpdated += new EventHandler<object>(Chart_LayoutUpdated);
SizeChanged += Chart_SizeChanged;
DataContextChanged += Chart_DataContextChanged;
CurrentLayout = new LayoutState();
Layers = new List<IChartLayer>();
Expand Down Expand Up @@ -255,6 +256,17 @@ private void Chart_DataContextChanged(FrameworkElement sender, DataContextChange
}
args.Handled = true;
}
private void Chart_SizeChanged(object sender, SizeChangedEventArgs e) {
#if false
_trace.Verbose($"SizeChanged prev({e.PreviousSize.Width}x{e.PreviousSize.Height}) new({e.NewSize.Width}x{e.NewSize.Height})");
if (e.NewSize.Width == 0 || e.NewSize.Height == 0) return;
if (CurrentLayout.IsSizeChanged(e.NewSize)) {
var ls = new LayoutState() { Dimensions = e.NewSize, Layout = CurrentLayout.Layout };
RenderComponents(ls);
CurrentLayout = ls;
}
#endif
}
/// <summary>
/// Reconfigure components in response to layout change.
/// Happens After OnApplyTemplate.
Expand All @@ -264,11 +276,12 @@ private void Chart_DataContextChanged(FrameworkElement sender, DataContextChange
private void Chart_LayoutUpdated(object sender, object e) {
// This is (NaN,NaN) if we haven't been sized yet
var sz = new Size(ActualWidth, ActualHeight);
_trace.Verbose($"LayoutUpdated ({sz.Width}x{sz.Height})");
//_trace.Verbose($"LayoutUpdated ({sz.Width}x{sz.Height})");
if (!double.IsNaN(sz.Width) && !double.IsNaN(sz.Height)) {
// we are sized; see if dimensions actually changed
if (sz.Width == 0 || sz.Height == 0) return;
if (CurrentLayout.IsSizeChanged(sz)) {
_trace.Verbose($"LayoutUpdated.trigger ({sz.Width}x{sz.Height})");
var ls = new LayoutState() { Dimensions = sz, Layout = CurrentLayout.Layout };
RenderComponents(ls);
CurrentLayout = ls;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>eScapeLLC.UWP.Charts</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.16299.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -148,10 +148,12 @@
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.1.5</Version>
<Version>6.2.9</Version>
</PackageReference>
<PackageReference Include="NuGet.CommandLine">
<Version>4.6.2</Version>
<Version>5.2.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions YetAnotherChartComponent/eScape.Yacc.Demo/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
<ResourceDictionary Source="Resources.xaml"/>
</ResourceDictionary.MergedDictionaries>
<ResourceDictionary.ThemeDictionaries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"AxisCommon": "Error",
"CandlestickSeries": "Error",
"CategoryAxis": "Error",
"Chart": "Error",
"Chart": "Verbose",
"ColumnSeries": "Error",
"DataSeries": "Error",
"DataSource": "Error",
Expand Down
28 changes: 15 additions & 13 deletions YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
x:Class="Yacc.Demo.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:wtk="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Expand All @@ -18,24 +19,25 @@
</RelativePanel>
</DataTemplate>
<DataTemplate x:Key="NavItem">
<RelativePanel HorizontalAlignment="Stretch">
<FontIcon x:Name="icon" Glyph="{Binding Glyph}" FontFamily="Arial" FontWeight="Bold" FontSize="32" Width="48" MaxWidth="48" VerticalAlignment="Center"
RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True"/>
<TextBlock x:Name="title" Text="{Binding Title}" FontSize="14"
RelativePanel.RightOf="icon" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignTopWithPanel="True"/>
<TextBlock Text="{Binding Description}" FontSize="12" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"
RelativePanel.RightOf="icon" RelativePanel.AlignLeftWith="title" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="title"/>
</RelativePanel>
<controls:NavigationViewItem Tag="{Binding Title}">
<controls:NavigationViewItem.Icon>
<FontIcon Glyph="{Binding Glyph}" FontFamily="Arial"/>
</controls:NavigationViewItem.Icon>
<StackPanel HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Title}" FontSize="14" FontWeight="Bold" />
<TextBlock Text="{Binding Description}" FontSize="12" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" HorizontalAlignment="Stretch" />
</StackPanel>
</controls:NavigationViewItem>
</DataTemplate>
</Page.Resources>
<controls:HamburgerMenu ItemsSource="{Binding PageList}" ItemTemplate="{StaticResource NavItem}" ItemInvoked="HamburgerMenu_ItemInvoked">
<controls:NavigationView MenuItemsSource="{Binding PageList}" MenuItemTemplate="{StaticResource NavItem}" ItemInvoked="NavigationView_ItemInvoked" IsPaneOpen="False" IsBackButtonVisible="Collapsed" IsSettingsVisible="False">
<RelativePanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Frame x:Name="MainFrame" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="Gray" BorderThickness="1"
RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignTopWithPanel="True">
<Frame.ContentTransitions>
<TransitionCollection>
<NavigationThemeTransition/>
<ContentThemeTransition/>
<!-- do not use ContentThemeTransition it conflicts with chart layout and causes flicker -->
</TransitionCollection>
</Frame.ContentTransitions>
</Frame>
Expand All @@ -44,7 +46,7 @@
<TextBlock Visibility="{Binding IsImplicitSupported}" Margin="4,0,8,0" Text="Implicit &#x2714;" FontStyle="Italic" Foreground="DarkGray" />
<TextBlock Visibility="{Binding IsRemote}" Margin="4,0,8,0" Text="RDP &#x2714;" FontStyle="Italic" Foreground="DarkGray" />
</StackPanel>
<controls:InAppNotification x:Name="Notification" ContentTemplate="{StaticResource PageItem}" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True"/>
<wtk:InAppNotification x:Name="Notification" ContentTemplate="{StaticResource PageItem}" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True"/>
</RelativePanel>
</controls:HamburgerMenu>
</controls:NavigationView>
</Page>
5 changes: 2 additions & 3 deletions YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ protected override void OnNavigatedTo(NavigationEventArgs e) {
var vm = new MainPageVM(Dispatcher);
DataContext = vm;
}

private void HamburgerMenu_ItemInvoked(object sender, Microsoft.Toolkit.Uwp.UI.Controls.HamburgerMenuItemInvokedEventArgs e) {
if(e.InvokedItem is PageItem pi) {
private void NavigationView_ItemInvoked(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewItemInvokedEventArgs args) {
if (args.InvokedItemContainer.DataContext is PageItem pi) {
Notification.Content = pi;
Notification.Show();
// for now just send in PI
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
<Identity Name="eScapeTechnologyLLC.YetAnotherChartComponentDemo" Publisher="CN=3D68122A-CFAD-4771-A47D-34317340F18F" Version="1.0.3.0" />
<Identity Name="eScapeTechnologyLLC.YetAnotherChartComponentDemo" Publisher="CN=eScape Technology LLC" Version="1.0.3.0" />
<mp:PhoneIdentity PhoneProductId="05458329-ab86-4eaa-9da0-a2dce73cb2ed" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Yet Another Chart Component Demo</DisplayName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Yacc.Demo.Pages {
public sealed partial class Chart1 : BasicPage {
public override string PageTitle => "Demo Chart";
public int CurrentChildCount { get; private set; }
public int CurrentChildCount { get; set; }
Timer cctimer;

public Chart1() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace Yacc.Demo.Pages {
public sealed partial class Chart3 : BasicPage {
public override string PageTitle => "Recycling";
public int CurrentChildCount { get; private set; }
public int CurrentChildCount { get; set; }
Timer cctimer;
public Chart3() {
this.InitializeComponent();
Expand Down
6 changes: 3 additions & 3 deletions YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart6.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
<EntranceThemeTransition/>
<AddDeleteThemeTransition/>
<ReorderThemeTransition/>
<ContentThemeTransition/>
</TransitionCollection>
</Page.Resources>
<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<RelativePanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Transitions="{StaticResource DefaultTransitions}">
<CommandBar x:Name="toolbar"
RelativePanel.AlignTopWithPanel="True">
<CommandBar.PrimaryCommands>
<AppBarToggleButton IsChecked="True" x:Name="cb_legend" Label="Toggle" Content="Legend"/>
</CommandBar.PrimaryCommands>
</CommandBar>
<yacc:Chart x:Name="chart" Style="{StaticResource Chart}" ChartError="Chart_ChartError" Transitions="{StaticResource DefaultTransitions}"
<yacc:Chart x:Name="chart" Style="{StaticResource Chart}" ChartError="Chart_ChartError"
RelativePanel.Below="toolbar" RelativePanel.AlignBottomWithPanel="True"
RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True">
<yacc:Chart.DataSources>
Expand Down
Loading

0 comments on commit 58c137a

Please sign in to comment.