void StageControl_SizeChanged(object sender, SizeChangedEventArgs e) { if (StageVm == null) { return; } Dispatcher.BeginInvoke( DispatcherPriority.Normal, new Action(() => { Width = ActualHeight * StageVm.WidthToHeight(); InvalidateVisual(); })); }
async void OnRenderTimerElapsed(object sender, ElapsedEventArgs e) { await Dispatcher.InvokeAsync(() => { InvalidateVisual(); if (ticks == TicsPerStep) { ticks = 0; StopTimer(); StageVm.RaiseAnimationFinished(); } else { ticks++; } }); }
protected override void OnRender(DrawingContext dc) { if (StageVm == null) { return; } Width = ActualHeight * StageVm.WidthToHeight(); dc.DrawRectangle(StageVm.StageVmStyle.BackgroundBrush, null, new Rect(0.0, 0.0, ActualWidth, ActualHeight)); dc.DrawKeyLines(StageVm.StageVmStyle, ActualWidth, ActualHeight); foreach (var kvm in StageVm.KeyPairVms) { dc.DrawSwitch(StageVm.StageVmStyle, StageVm.Order, kvm, ActualWidth, ActualHeight); } dc.DrawSortableValuesAnimate(StageVm.SortableVm, ActualWidth, ActualHeight); }
protected override void OnRender(DrawingContext dc) { if (StageVm == null) { return; } dc.DrawRectangle(StageVm.StageVmStyle.BackgroundBrush, null, new Rect(0.0, 0.0, ActualWidth, ActualHeight)); dc.DrawKeyLines(StageVm, ActualWidth, ActualHeight); foreach (var kvm in StageVm.KeyPairVms) { dc.DrawSwitch(StageVm, kvm, ActualWidth, ActualHeight); } if ((RenderTimer != null) && (RenderTimer.Enabled)) { StageVm.DrawSortableValuesAnimate(ticks / TicsPerStep, dc, ActualWidth, ActualHeight); } else { StageVm.DrawSortableValues(dc, ActualWidth, ActualHeight); } }