/// <summary> /// Create adornemnt for the case when order is dragged from orders and find views. /// </summary> /// <param name="ordersAndStops">Stops and orders.</param> /// <returns>Adornment.</returns> private static IAdornment _CreateOrdersViewAdornment(IList <object> ordersAndStops) { IAdornment adornment; if (ordersAndStops.Count == 1) // Single order case. { Order order = AdornHelpers.GetOrder(ordersAndStops[0]); Debug.Assert(order != null); adornment = new SheetAdornment(order); } else // Multiple orders case. { adornment = new MultiSheetAdornment(ordersAndStops); } return(adornment); }
/// <summary> /// Creates adorment canvas. /// </summary> /// <param name="order">Order.</param> /// <returns>Canvas.</returns> private Canvas _CreateAdornmentCanvas(object orderOrStop) { // Create canvas. Canvas adornCanvas = new Canvas(); // Create order element and add it to canvas. FrameworkElement element = CreateOrderElement(orderOrStop); adornCanvas.Children.Add(element); // Get order. Order order = AdornHelpers.GetOrder(orderOrStop); // Create time window 1 label and add it to canvas. TextBox tw = new TextBox(); Style style = (Style)Application.Current.FindResource(TIME_WINDOWS_TEXT_BOX_STYLE); Debug.Assert(style != null); tw.Style = style; tw.Text = _GetTimeWindowsText(order); adornCanvas.Children.Add(tw); adornCanvas.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); // Move label. Canvas.SetTop(tw, element.DesiredSize.Height + SPACE_SIZE); Canvas.SetLeft(tw, element.DesiredSize.Width + SPACE_SIZE); // Set canvas height and width. adornCanvas.Height = element.DesiredSize.Height + SPACE_SIZE + tw.DesiredSize.Height; adornCanvas.Width = element.DesiredSize.Width + SPACE_SIZE + tw.DesiredSize.Width; return(adornCanvas); }