/// <summary>
 /// Assigns the pipeline that is being passed,based on the location.
 /// </summary>
 /// <param name="location">The location of the mouse click.</param>
 /// <param name="pipe">The pipeline that will be assigned.</param>
 public override void SetPipeline(Point location, Pipeline pipe)
 {
     if (ComponentBox.Contains(location))
     {
         this.IncomePipeline = pipe;
     }
 }
 /// <summary>
 /// Assigns the pipeline that is being passed,based on the location.
 /// </summary>
 /// <param name="location">The location of the mouse click.</param>
 /// <param name="pipe">The pipeline that will be assigned.</param>
 public override void SetPipeline(Point location, Pipeline pipe)
 {
     if (ComponentBox.Contains(location))
     {
         this.OutcomePipeline = pipe;
         this.OutcomePipeline.ChangeCurrentFlow(Flow);
     }
 }
 /// <summary>
 /// Checks if the pipeline where the mouse click has been made is not connected(null).
 /// </summary>
 /// <param name="location">The location of the mouse click.</param>
 /// <returns>True if the pipeline is null.Otherwise false.</returns>
 public override bool IsLocationEmpty(Point location)
 {
     if (ComponentBox.Contains(location))
     {
         return(this.OutcomePipeline == null);
     }
     return(false);
 }
 /// <summary>
 /// Gets a concrete point that is used for connecting pipelines based on where the mouse click has been made.
 /// </summary>
 /// <param name="location">The location of the mouse click.</param>
 /// <returns>A concrete prefixed point.</returns>
 public override Point?GetPipelineLocation(Point mouseClick)
 {
     if (ComponentBox.Contains(mouseClick))
     {
         return(pipelineLocation);
     }
     return(null);
 }
        private void ComponentBox_MouseUp(object sender, MouseEventArgs e)
        {
            var contextMenu = new ContextMenu();

            if (e.Button == MouseButtons.Right)
            {
                int index = ComponentBox.IndexFromPoint(e.Location);
                if (index < 0)
                {
                    return;
                }
                var item = (ComponentBox.Items[index] as ComponentCell).Component;
                if (item is Camera)
                {
                    contextMenu.MenuItems.Add(new MenuItem("Set as active", (s, ea) => GameApp.renderSystem.ActiveCamera = (Camera)item));
                }
                contextMenu.Show(ComponentBox, e.Location);
            }
        }
Example #6
0
        private void InitializeComponents()
        {
            pendingLines   = new Stack <LineConnectorBase>();
            lineCollection = new LineConnectorCollection();

            componentBox      = new ComponentBox();
            componentBoxPopup = new Popup()
            {
                AllowsTransparency = true,
                Child          = componentBox,
                PopupAnimation = PopupAnimation.None,
                Placement      = PlacementMode.Custom,
                StaysOpen      = false,
                CustomPopupPlacementCallback = new CustomPopupPlacementCallback(ComponentBoxPlaceCallback)
            };

            componentBoxPopup.Closed  += ComponentBoxPopup_Closed;
            componentBox.ItemSelected += ComponentBox_ItemSelected;

            // Line Update Timer
            CompositionTarget.Rendering += CompositionTarget_Rendering;
        }