Ejemplo n.º 1
0
        private static void BuildPlanLines(Connection position, DesignerCanvas d)
        {
            Connection nextposition;

            if (position != null)
            {
                if (!position.Sink.ParentDesignerItem.Activity.Used)
                {
                    Guid actual = position.Sink.ParentDesignerItem.ID;
                    position.Sink.ParentDesignerItem.Activity.Used = true;


                    DialPlanList.Add(position.Sink.ParentDesignerItem.Activity);
                    position.Sink.ParentDesignerItem.Activity.prio = DialPlanList.Count - 1;


                    //si es una actividad sin condicional
                    if (position.Sink.ParentDesignerItem.Activity.MaxConectors == 1)
                    {
                        nextposition = GetNextDefault(d, actual);
                        BuildPlanLines(nextposition, d);
                    }
                    else
                    {
                        nextposition = GetNextNotDefault(d, actual);
                        if (nextposition != null)
                        {
                            BuildPlanLines(nextposition, d);
                            position.Sink.ParentDesignerItem.Activity.AlternativePath = nextposition.Sink.ParentDesignerItem.Activity.prio;
                        }

                        nextposition = GetNextDefault(d, actual);
                        if (nextposition != null)
                        {
                            BuildPlanLines(nextposition, d);
                            position.Sink.ParentDesignerItem.Activity.DefaultPath = nextposition.Sink.ParentDesignerItem.Activity.prio;
                        }
                    }
                }

                //si ya estaba usada la actividad a la que voy y la actual no es condicional o sea no puede saltar sola
                else if (position.Sink.ParentDesignerItem.Activity.Used && position.Source.ParentDesignerItem.Activity.MaxConectors == 1)
                {
                    Goto g = new Goto();
                    g.prio      = DialPlanList.Count;
                    g.extension = "${EXTEN}";
                    g.context   = Context;
                    g.pri       = position.Sink.ParentDesignerItem.Activity.prio;
                    DialPlanList.Add(g);
                }
            }
        }
        private static void BuildPlanLines(Connection position, DesignerCanvas d)
        {

            Connection nextposition;

            if (position != null)
            {
                if (!position.Sink.ParentDesignerItem.Activity.Used)
                {

                    Guid actual = position.Sink.ParentDesignerItem.ID;
                    position.Sink.ParentDesignerItem.Activity.Used = true;


                    DialPlanList.Add(position.Sink.ParentDesignerItem.Activity);
                    position.Sink.ParentDesignerItem.Activity.prio = DialPlanList.Count - 1;


                    //si es una actividad sin condicional
                    if (position.Sink.ParentDesignerItem.Activity.MaxConectors == 1)
                    {

                        nextposition = GetNextDefault(d, actual);
                        BuildPlanLines(nextposition, d);
                    }
                    else
                    {



                        nextposition = GetNextNotDefault(d, actual);
                        if (nextposition != null)
                        {
                            BuildPlanLines(nextposition, d);
                            position.Sink.ParentDesignerItem.Activity.AlternativePath = nextposition.Sink.ParentDesignerItem.Activity.prio;
                        }

                        nextposition = GetNextDefault(d, actual);
                        if (nextposition != null)
                        {
                            BuildPlanLines(nextposition, d);
                            position.Sink.ParentDesignerItem.Activity.DefaultPath = nextposition.Sink.ParentDesignerItem.Activity.prio;
                        }


                    }
                }
                
                //si ya estaba usada la actividad a la que voy y la actual no es condicional o sea no puede saltar sola
                else if (position.Sink.ParentDesignerItem.Activity.Used && position.Source.ParentDesignerItem.Activity.MaxConectors == 1)
                {

                    Goto g = new Goto();
                    g.prio = DialPlanList.Count;
                    g.extension = "${EXTEN}";
                    g.context = Context;
                    g.pri = position.Sink.ParentDesignerItem.Activity.prio;
                    DialPlanList.Add(g);

                }
            }

        }