private StructureViewDragDropHandler.HittestResult Hittest(Point position) { StructureViewDragDropHandler.HittestResult hittestResult = new StructureViewDragDropHandler.HittestResult(); if (this.StructureView.TimelineItemManager != null) { double indentMultiplier = this.StructureView.IndentMultiplier; int num = (int)Math.Floor((position.X - indentMultiplier) / this.StructureView.IndentMultiplier); IList <TimelineItem> list = (IList <TimelineItem>) this.StructureView.TimelineItemManager.ItemList; if (list != null) { for (int index = list.Count - 1; index >= 0; --index) { TimelineItem timelineItem = list[index]; if (timelineItem != null && timelineItem.Depth <= num) { ElementTimelineItem elementTimelineItem = timelineItem as ElementTimelineItem; bool flag = elementTimelineItem != null && elementTimelineItem.Element.IsContainer; hittestResult.allowDropInside = flag || timelineItem.Depth <= num - 1; hittestResult.candidateItem = timelineItem; break; } } } } return(hittestResult); }
internal void ShowSplitAdorner(bool showFeedback, TimelineDragDescriptor descriptor) { if (showFeedback && descriptor != null && (descriptor.TargetItem != null && !descriptor.HideSplitter)) { TimelineItem timelineItem = (TimelineItem)null; bool flag = false; double num1 = 0.0; if (descriptor.AllowBetween) { timelineItem = descriptor.TargetItem; flag = (descriptor.ResultDropEffects & TimelineDropEffects.Before) != TimelineDropEffects.None; num1 = (double)(timelineItem.Depth + descriptor.RelativeDepth); } else if (descriptor.TargetItem.IsExpanded && descriptor.DropInDefaultContent) { ElementTimelineItem elementTimelineItem = descriptor.TargetItem as ElementTimelineItem; if (elementTimelineItem != null) { ISceneNodeCollection <SceneNode> defaultContent = elementTimelineItem.Element.DefaultContent; if (defaultContent != null) { if (defaultContent.Count > 0 && !this.TimelineItemManager.SortByZOrder) { flag = true; num1 = (double)(descriptor.TargetItem.Depth + 1); int index = this.TimelineItemManager.ItemList.IndexOf((TimelineItem)elementTimelineItem); int count = this.TimelineItemManager.ItemList.Count; while (index < count - 1 && (double)this.TimelineItemManager.ItemList[index + 1].Depth >= num1) { ++index; } timelineItem = this.TimelineItemManager.ItemList[index]; } else { timelineItem = descriptor.TargetItem; flag = true; num1 = (double)(timelineItem.Depth + 1); } } } } if (timelineItem != null) { Point point = ((Visual)this.ElementTree.ItemContainerGenerator.ContainerFromItem((object)timelineItem)).TransformToVisual((Visual)this).Transform(new Point(0.0, 0.0)); bool sortByZorder = this.TimelineItemManager.SortByZOrder; double indentMultiplier = this.IndentMultiplier; double left = num1 * this.IndentMultiplier + point.X + indentMultiplier; double num2 = (double)((int)(this.DropSplitAdorner.ActualHeight - 1.0) / 2); double num3 = (double)this.Resources[(object)"RowMinHeight"]; double top = point.Y - num2 + (sortByZorder ^ flag ? num3 : 0.0); this.DropSplitAdorner.Margin = new Thickness(left, top, 0.0, 0.0); this.DropSplitAdorner.Visibility = Visibility.Visible; return; } } this.DropSplitAdorner.Visibility = Visibility.Collapsed; }
private void RemovePartStatus(SceneNode node) { if (node == null || node.ViewModel == null || (node.ViewModel.DesignerContext == null || node.ViewModel.TimelineItemManager == null)) { return; } ElementTimelineItem elementTimelineItem = node.ViewModel.TimelineItemManager.FindTimelineItem(node) as ElementTimelineItem; if (elementTimelineItem == null) { return; } node.Name = (string)null; elementTimelineItem.PartStatus = PartStatus.Unused; elementTimelineItem.Invalidate(); }
private void UpdateElementTimelineItem(SceneElement element, PartInPartsExplorer part) { if (element == null || element.ViewModel == null || (element.ViewModel.DesignerContext == null || element.ViewModel.TimelineItemManager == null)) { return; } ElementTimelineItem elementTimelineItem = element.ViewModel.TimelineItemManager.FindTimelineItem((SceneNode)element) as ElementTimelineItem; if (elementTimelineItem == null) { return; } this.changedObjectTreeElements = true; elementTimelineItem.Invalidate(); elementTimelineItem.PartStatus = part.Status; if (part.Status != PartStatus.WrongType) { return; } elementTimelineItem.WronglyAssignedPartCorrectType = part.TargetType.Name; }