public FlowComponentXML(FlowComponent fc)
 {
     this.left = (fc as Control).Left;
     this.top  = (fc as Control).Top;
     this.data = (ExecutionUnitDataBinding)fc.GetDataBinding();
     if (fc is FlowStart)
     {
         this.type = 1;
     }
     if (fc is FlowStop)
     {
         this.type = 2;
     }
     if (fc is FlowProcessing)
     {
         this.type = 3;
     }
     if (fc is FlowDecision)
     {
         this.type = 4;
     }
     if (this.type == 4)
     {
         //avem doi copii
         if (fc.GetDefaultNextControl() != null)
         {
             next1 = new FlowComponentXML(fc.GetDefaultNextControl());
         }
         if ((fc as FlowDecision).GetNegationNextControl() != null)
         {
             next2 = new FlowComponentXML((fc as FlowDecision).GetNegationNextControl() as FlowComponent);
         }
     }
     else
     {
         //avem un singur copil
         if (fc.GetDefaultNextControl() != null)
         {
             next1 = new FlowComponentXML(fc.GetDefaultNextControl());
         }
     }
 }
        private object RebuildUI(FlowComponentXML fcx)
        {
            //throw new NotImplementedException();
            //FlowComponentXML current = fdx.FlowTree;
            //while (
            FlowComponent fc = null;

            if (fcx.type == 1)
            {
                fc             = new FlowStart();
                this.StartNode = fc;
            }
            else if (fcx.type == 2)
            {
                fc = new FlowStop();
            }
            else if (fcx.type == 3)
            {
                fc = new FlowProcessing();
            }
            else if (fcx.type == 4)
            {
                fc = new FlowDecision();
            }
            fc.SetComponentContainer(this);
            this.flowComponents.Add(fc as Control);
            this.pnlMain.Controls.Add(fc as Control);
            fc.SetDataBinding(fcx.data);
            fc.SetName(fcx.data.Name);
            (fc as Control).Left = fcx.left;
            (fc as Control).Top  = fcx.top;
            if (fcx.next1 != null)
            {
                fc.SetDefaultNextControl(RebuildUI(fcx.next1) as Control);
            }
            if (fcx.next2 != null)
            {
                (fc as FlowDecision).SetNegationNextControl(RebuildUI(fcx.next2) as Control);
            }
            return(fc);
        }
 public FlowDiagramXML(FlowDiagram fd)
 {
     FlowTree = new FlowComponentXML(fd.StartNode);
 }