From 58c137a8d1415ea2a5e1445794dce899304e36e0 Mon Sep 17 00:00:00 2001 From: eScape LLC Date: Sat, 12 Oct 2019 18:26:49 -0400 Subject: [PATCH] update demo to use windows ui; increase target sdk version to 17763. --- .../YaccTests/Package.appxmanifest | 31 ++++---------- .../YaccTests/YaccTests.csproj | 13 +++--- .../Axis/CategoryAxis.cs | 42 ++++++++++--------- .../Axis/ValueAxis.cs | 8 ++-- .../YetAnotherChartComponent/Chart/Chart.cs | 15 ++++++- .../YetAnotherChartComponent.csproj | 8 ++-- .../eScape.Yacc.Demo/App.xaml | 1 + .../Assets/AppConfiguration.json | 2 +- .../eScape.Yacc.Demo/MainPage.xaml | 28 +++++++------ .../eScape.Yacc.Demo/MainPage.xaml.cs | 5 +-- .../eScape.Yacc.Demo/Package.appxmanifest | 2 +- .../eScape.Yacc.Demo/Pages/Chart1.xaml.cs | 2 +- .../eScape.Yacc.Demo/Pages/Chart3.xaml.cs | 2 +- .../eScape.Yacc.Demo/Pages/Chart6.xaml | 6 +-- .../eScape.Yacc.Demo/eScape.Yacc.Demo.csproj | 15 ++++--- 15 files changed, 93 insertions(+), 87 deletions(-) diff --git a/YetAnotherChartComponent/YaccTests/Package.appxmanifest b/YetAnotherChartComponent/YaccTests/Package.appxmanifest index a78a8e6..4756801 100644 --- a/YetAnotherChartComponent/YaccTests/Package.appxmanifest +++ b/YetAnotherChartComponent/YaccTests/Package.appxmanifest @@ -1,40 +1,23 @@  - - - - - - + + + YaccTests johng Assets\StoreLogo.png - - - - - + + + + diff --git a/YetAnotherChartComponent/YaccTests/YaccTests.csproj b/YetAnotherChartComponent/YaccTests/YaccTests.csproj index 14dec2d..64cedb3 100644 --- a/YetAnotherChartComponent/YaccTests/YaccTests.csproj +++ b/YetAnotherChartComponent/YaccTests/YaccTests.csproj @@ -18,6 +18,7 @@ {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} YaccTests_TemporaryKey.pfx $(VisualStudioVersion) + F21A92276700EDA5A10903E0F674EC458690FF66 true @@ -127,17 +128,17 @@ - 6.1.5 + 6.2.9 - 1.3.2 + 2.0.0 - 1.3.2 + 2.0.0 + + + 16.3.0 - - 15.7.2 - diff --git a/YetAnotherChartComponent/YetAnotherChartComponent/Axis/CategoryAxis.cs b/YetAnotherChartComponent/YetAnotherChartComponent/Axis/CategoryAxis.cs index 8701f3d..645d2d0 100644 --- a/YetAnotherChartComponent/YetAnotherChartComponent/Axis/CategoryAxis.cs +++ b/YetAnotherChartComponent/YetAnotherChartComponent/Axis/CategoryAxis.cs @@ -244,24 +244,6 @@ private void CommonInit() { #endregion #region helpers /// - /// 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. - /// - /// - /// - 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}"); - } - } - /// /// Rebuild the axis geometry based on current extents. /// void RebuildAxisGeometry() { @@ -344,6 +326,26 @@ void ElementPipeline(SelectorContext sc, ItemState ist, Recycler + /// 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. + /// + /// + /// + 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 /// /// Add elements and attach bindings. @@ -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 diff --git a/YetAnotherChartComponent/YetAnotherChartComponent/Axis/ValueAxis.cs b/YetAnotherChartComponent/YetAnotherChartComponent/Axis/ValueAxis.cs index 6a6ac78..3715694 100644 --- a/YetAnotherChartComponent/YetAnotherChartComponent/Axis/ValueAxis.cs +++ b/YetAnotherChartComponent/YetAnotherChartComponent/Axis/ValueAxis.cs @@ -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(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(); // materialize the ticks diff --git a/YetAnotherChartComponent/YetAnotherChartComponent/Chart/Chart.cs b/YetAnotherChartComponent/YetAnotherChartComponent/Chart/Chart.cs index 2df8506..c791b12 100644 --- a/YetAnotherChartComponent/YetAnotherChartComponent/Chart/Chart.cs +++ b/YetAnotherChartComponent/YetAnotherChartComponent/Chart/Chart.cs @@ -218,6 +218,7 @@ public Chart() :base() { Axes = new List(); DeferredEnter = new List(); LayoutUpdated += new EventHandler(Chart_LayoutUpdated); + SizeChanged += Chart_SizeChanged; DataContextChanged += Chart_DataContextChanged; CurrentLayout = new LayoutState(); Layers = new List(); @@ -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 + } /// /// Reconfigure components in response to layout change. /// Happens After OnApplyTemplate. @@ -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; diff --git a/YetAnotherChartComponent/YetAnotherChartComponent/YetAnotherChartComponent.csproj b/YetAnotherChartComponent/YetAnotherChartComponent/YetAnotherChartComponent.csproj index 1721263..4b4ff6a 100644 --- a/YetAnotherChartComponent/YetAnotherChartComponent/YetAnotherChartComponent.csproj +++ b/YetAnotherChartComponent/YetAnotherChartComponent/YetAnotherChartComponent.csproj @@ -11,7 +11,7 @@ eScapeLLC.UWP.Charts en-US UAP - 10.0.16299.0 + 10.0.17763.0 10.0.10586.0 14 512 @@ -148,10 +148,12 @@ 1.0.0 - 6.1.5 + 6.2.9 - 4.6.2 + 5.2.0 + runtime; build; native; contentfiles; analyzers + all diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/App.xaml b/YetAnotherChartComponent/eScape.Yacc.Demo/App.xaml index 9b55f70..c883ffb 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/App.xaml +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/App.xaml @@ -6,6 +6,7 @@ + diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/Assets/AppConfiguration.json b/YetAnotherChartComponent/eScape.Yacc.Demo/Assets/AppConfiguration.json index b8d2ab5..c078ca7 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/Assets/AppConfiguration.json +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/Assets/AppConfiguration.json @@ -3,7 +3,7 @@ "AxisCommon": "Error", "CandlestickSeries": "Error", "CategoryAxis": "Error", - "Chart": "Error", + "Chart": "Verbose", "ColumnSeries": "Error", "DataSeries": "Error", "DataSource": "Error", diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml b/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml index f0141e1..02cd1f3 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml @@ -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"> @@ -18,24 +19,25 @@ - - - - - + + + + + + + + + - + - + @@ -44,7 +46,7 @@ - + - + diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml.cs b/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml.cs index 527fd91..bbb9577 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml.cs +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/MainPage.xaml.cs @@ -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 diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/Package.appxmanifest b/YetAnotherChartComponent/eScape.Yacc.Demo/Package.appxmanifest index 81750d7..fb23f8a 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/Package.appxmanifest +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/Package.appxmanifest @@ -1,6 +1,6 @@  - + Yet Another Chart Component Demo diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart1.xaml.cs b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart1.xaml.cs index fc55271..4e33c01 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart1.xaml.cs +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart1.xaml.cs @@ -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() { diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart3.xaml.cs b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart3.xaml.cs index 032066d..01f67cc 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart3.xaml.cs +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart3.xaml.cs @@ -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(); diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart6.xaml b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart6.xaml index c19941f..9c2deaf 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart6.xaml +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/Pages/Chart6.xaml @@ -22,17 +22,17 @@ - - + - diff --git a/YetAnotherChartComponent/eScape.Yacc.Demo/eScape.Yacc.Demo.csproj b/YetAnotherChartComponent/eScape.Yacc.Demo/eScape.Yacc.Demo.csproj index 907942a..65790c0 100644 --- a/YetAnotherChartComponent/eScape.Yacc.Demo/eScape.Yacc.Demo.csproj +++ b/YetAnotherChartComponent/eScape.Yacc.Demo/eScape.Yacc.Demo.csproj @@ -11,14 +11,14 @@ eScape.Yacc.Demo en-US UAP - 10.0.17134.0 + 10.0.17763.0 10.0.14393.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} true - eScape.Yacc.Demo_StoreKey.pfx - BE79BC44FBAD349CEFD720A7FCA91C3378334EF8 + eScape.Yacc.Demo_TemporaryKey.pfx + 79B442A1FCA0471D87CD05BE21218A918A6B0AE3 True Always x86|x64|arm @@ -134,7 +134,6 @@ PreserveNewest - @@ -179,6 +178,7 @@ + @@ -235,14 +235,17 @@ 1.0.0 - 6.1.5 + 6.2.9 - 3.0.0 + 4.0.0 3.0.0 + + 2.1.190606001 +