コード例 #1
0
 private void UpdateWin2DCanvas()
 {
     if (unloaded)
     {
         return;
     }
     if (ItemsPanelRoot is GooeyButtonItemsPanel panel)
     {
         if (this.panel == null)
         {
             this.panel = panel;
         }
         if (Win2DCanvas == null)
         {
             Win2DCanvas = new CanvasAnimatedControl();
             Win2DHost.Children.Add(Win2DCanvas);
             Win2DCanvas.IsHitTestVisible = false;
             Win2DCanvas.CreateResources += OnWin2DCreateResources;
             Win2DCanvas.Draw            += OnWin2DDraw;
         }
         var radius = panel.Children.Count == 0 ? 0 : panel.Children.Max(c => c.RenderSize.IsEmpty ? 0 : Math.Max(c.RenderSize.Width, c.RenderSize.Height));
         var size   = (Distance + radius * 4) * 2;
         Win2DCanvas.Width    = size;
         Win2DCanvas.Height   = size;
         property.CenterPoint = new Vector2((float)size / 2);
         Canvas.SetLeft(Win2DCanvas, -size / 2);
         Canvas.SetTop(Win2DCanvas, -size / 2);
     }
 }
コード例 #2
0
 private void OnUnloaded(object sender, RoutedEventArgs e)
 {
     unloaded           = true;
     Win2DCanvas.Draw  -= OnWin2DDraw;
     Win2DCanvas.Paused = true;
     panel = null;
     Win2DCanvas.RemoveFromVisualTree();
     Win2DHost.Children.Remove(Win2DCanvas);
     Win2DCanvas = null;
 }
コード例 #3
0
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     if (ItemsPanelRoot is GooeyButtonItemsPanel panel)
     {
         if (this.panel == null)
         {
             this.panel = panel;
         }
         panel.Distance                 = Distance;
         panel.Expanded                 = Expanded;
         panel.ItemsPosition            = ItemsPosition;
         panel.ItemsAnimationStarted   += OnItemsAnimationStarted;
         panel.ItemsAnimationCompleted += OnItemsAnimationCompleted;
         panel.Unloaded                += OnItemsPanelUnloaded;
     }
     UpdateStoryboards();
     UpdateProperty();
     ResetItemsProperty();
     UpdateWin2DCanvas();
 }