Ejemplo n.º 1
0
        //private static void OnProcessCmdKeyEvent(object sender, ProcessCmdKeyEventArgs args)
        //{
        //    Action act;

        //    if (canvasController.Canvas.Focused && keyActions.TryGetValue(args.KeyData, out act))
        //    {
        //        act();
        //        args.Handled = true;
        //    }
        //}

        private static void ElementSelected(object controller, ElementEventArgs args)
        {
            elementProperties = null;

            if (args.Element != null)
            {
                GraphicElement el = args.Element;
                elementProperties = el.CreateProperties();

                string code;
                el.Json.TryGetValue("Code", out code);

                if (el.GetType().Name == "PythonFileBox" || el.GetType().Name == "HtmlFileBox")
                {
                    pythonCodeEditorService.SetText(code ?? String.Empty);
                }
                else
                {
                    csCodeEditorService.SetText(code ?? String.Empty);
                }
            }
            else
            {
                pythonCodeEditorService.SetText(String.Empty);
                csCodeEditorService.SetText(String.Empty);
            }

            propGrid.SelectedObject = elementProperties;
            canvasController.Canvas.Focus();
        }
        /// <summary>
        /// Find the next shape connected to el.
        /// </summary>
        /// <param name="el"></param>
        /// <returns>The next connected shape or null if no connection exists.</returns>
        protected GraphicElement NextElementInWorkflow(GraphicElement el)
        {
            GraphicElement ret = null;

            // The starting shape has one connection where the StartConnectedShape should be the el
            // and the EndConnectedShape is the next shape in the workflow.

            // A middle workflow element has two connections, again where the StartConnectedShape should be the el
            // and the EndConnectedShape is the next shape in the workflow.

            // The final workflow step has one connector, where the EndConnectedShape is the el.

            // 12/20/16, because of a current bug with connectors, where shapes incorrectly retain
            // connections to other shapes that they aren't actually connected to, we try to
            // compensate for this.

            foreach (Connection connection in el.Connections)
            {
                GraphicElement gr = connection.ToElement;       // a shape's Connections should always be a Connector

                if (gr is Connector)
                {
                    Connector connector = (Connector)gr;

                    if (connector.StartConnectedShape == el)
                    {
                        ret = connector.EndConnectedShape;
                        break;
                    }
                }
                else
                {
                    Trace.WriteLine("*** EXPECTED CONNECTOR FOR " + el.GetType().Name + " ID=" + el.Id.ToString() + " Text=" + el.Text + " ***");
                }
            }

            /*
             * if (el.Connections.Count == 1)
             * {
             *  if (((Connector)((Connection)el.Connections[0]).ToElement).EndConnectedShape != el)
             *  {
             *      ret = ((Connector)((Connection)el.Connections[0]).ToElement).EndConnectedShape;
             *  }
             * }
             * else if (el.Connections.Count == 2)
             * {
             *  if (((Connector)((Connection)el.Connections[0]).ToElement).StartConnectedShape == el)
             *  {
             *      ret = ((Connector)((Connection)el.Connections[0]).ToElement).EndConnectedShape;
             *  }
             *  else if (((Connector)((Connection)el.Connections[1]).ToElement).StartConnectedShape == el)
             *  {
             *      ret = ((Connector)((Connection)el.Connections[1]).ToElement).EndConnectedShape;
             *  }
             * }
             */

            return(ret);
        }
Ejemplo n.º 3
0
        protected void ShowAnchors()
        {
            BaseController controller = serviceManager.Get <IFlowSharpCanvasService>().ActiveController;
            GraphicElement el         = controller.GetRootShapeAt(CurrentMousePosition);

            Trace.WriteLine("*** ShowAnchors " + el.GetType().Name);
            el.ShowAnchors = true;
            controller.Redraw(el);
            HoverShape = el;
            controller.SetAnchorCursor(el);
        }
Ejemplo n.º 4
0
        private static void OnMouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                GraphicElement el = canvasController.GetRootShapeAt(e.Location);

                if (el != null)
                {
                    if (el.GetType().Name == "SemanticInstance")
                    {
                    }
                }
            }
        }