public Size CalcCombinedSize(SceneViewModel viewModel)
        {
            Size size = new Size();

            for (int index = 0; index < this.records.Count; ++index)
            {
                if (index > 0)
                {
                    size.Height += CanvasLikeDataViewLayoutBuilder.defaultInnerMargin.Height;
                }
                CanvasLikeDataViewLayoutBuilder.LabelField labelField = this.records[index];
                BaseFrameworkElement frameworkElement = (BaseFrameworkElement)viewModel.GetSceneNode(labelField.Label);
                Rect computedTightBounds1             = ((Base2DElement)viewModel.GetSceneNode(labelField.Field)).GetComputedTightBounds();
                if (frameworkElement != null)
                {
                    Rect computedTightBounds2 = frameworkElement.GetComputedTightBounds();
                    size.Height += Math.Max(computedTightBounds2.Height, computedTightBounds1.Height);
                    size.Width   = Math.Max(size.Width, computedTightBounds2.Width + computedTightBounds1.Width + CanvasLikeDataViewLayoutBuilder.defaultInnerMargin.Width);
                }
                else
                {
                    size.Width  += computedTightBounds1.Width;
                    size.Height += computedTightBounds1.Height;
                }
            }
            return(size);
        }
 public void ApplyActiveUserThemeStyle(SceneViewModel viewModel)
 {
     for (int index = 0; index < this.records.Count; ++index)
     {
         CanvasLikeDataViewLayoutBuilder.LabelField labelField = this.records[index];
         AssetLibrary.ApplyActiveUserThemeStyle(viewModel.GetSceneNode(labelField.Label));
         AssetLibrary.ApplyActiveUserThemeStyle(viewModel.GetSceneNode(labelField.Field));
     }
 }
        public void SelectElements(SceneViewModel viewModel)
        {
            List <SceneElement> list = new List <SceneElement>(this.records.Count * 2);

            for (int index = 0; index < this.records.Count; ++index)
            {
                CanvasLikeDataViewLayoutBuilder.LabelField labelField = this.records[index];
                SceneElement sceneElement1 = (SceneElement)viewModel.GetSceneNode(labelField.Label);
                SceneElement sceneElement2 = (SceneElement)viewModel.GetSceneNode(labelField.Field);
                if (sceneElement1 != null)
                {
                    list.Add(sceneElement1);
                }
                list.Add(sceneElement2);
            }
            if (list.Count < 1)
            {
                return;
            }
            viewModel.ElementSelectionSet.SetSelection((ICollection <SceneElement>)list, (SceneElement)null);
        }
        public void CompleteLayout(SceneViewModel viewModel, Point startPoint)
        {
            ILayoutDesigner layoutDesigner = (ILayoutDesigner)null;
            Point           point          = startPoint;

            for (int index = 0; index < this.records.Count; ++index)
            {
                if (index > 0)
                {
                    point.Y += CanvasLikeDataViewLayoutBuilder.defaultInnerMargin.Height;
                }
                CanvasLikeDataViewLayoutBuilder.LabelField labelField = this.records[index];
                BaseFrameworkElement element1 = (BaseFrameworkElement)viewModel.GetSceneNode(labelField.Label);
                BaseFrameworkElement element2 = (BaseFrameworkElement)viewModel.GetSceneNode(labelField.Field);
                if (layoutDesigner == null)
                {
                    layoutDesigner = viewModel.GetLayoutDesignerForChild((SceneElement)element2, true);
                }
                Rect rect1 = element1 != null?element1.GetComputedTightBounds() : Rect.Empty;

                Rect   computedTightBounds = element2.GetComputedTightBounds();
                Point  location            = point;
                double num = element1 != null?Math.Max(rect1.Height, computedTightBounds.Height) : computedTightBounds.Height;

                if (element1 != null)
                {
                    location.Y += (num - rect1.Height) / 2.0;
                    Rect rect2 = new Rect(location, rect1.Size);
                    CanvasLikeDataViewLayoutBuilder.SetElementRect(layoutDesigner, element1, rect2);
                    location.Y -= (num - rect1.Height) / 2.0;
                    location.X  = rect2.Right + CanvasLikeDataViewLayoutBuilder.defaultInnerMargin.Width;
                }
                location.Y += (num - computedTightBounds.Height) / 2.0;
                Rect rect3 = new Rect(location, computedTightBounds.Size);
                CanvasLikeDataViewLayoutBuilder.SetElementRect(layoutDesigner, element2, rect3);
                double right = rect3.Right;
                double y     = point.Y;
                point.Y += num;
            }
        }