Example #1
0
 public static void connectFrom(IOPoint sender)
 {
     if (!Connecting)
     {
         conn = new Connector();
         CrossConnect(conn.InputPoint, sender, true);
         /*
         if (Support.IsLogicGate1(ctl))
         {
             CrossConnect(conn.InputPoint, ((LogicGate1)ctl).OutputPoint, true);
         }
         else if (Support.IsLogicGate2(ctl))
         {
             CrossConnect(conn.InputPoint, ((LogicGate2)ctl).OutputPoint, true);
         }
         else if (Support.IsNibble(ctl))
         {
             Nibble g = (Nibble)ctl;
             switch (type)
             {
                 case "output1": CrossConnect(conn.InputPoint, g.OutputPoint1, true); break;
                 case "output2": CrossConnect(conn.InputPoint, g.OutputPoint2, true); break;
                 case "output3": CrossConnect(conn.InputPoint, g.OutputPoint3, true); break;
                 case "output4": CrossConnect(conn.InputPoint, g.OutputPoint4, true); break;
             }
         }
         */
         Connecting = true;
     }
 }
Example #2
0
        public Connector()
        {
            input = new IOPoint("Input");
            output = new IOPoint("Output");

            input.Parent = this;
            output.Parent = this;

            input.Changed += new IOPoint.ChangedEventHandler(InputChanged);
            output.Changed += new IOPoint.ChangedEventHandler(OutputChanged);
        }
Example #3
0
        public static void connectTo(IOPoint sender)
        {
            if (Connecting)
            {
                /*
                if (Support.IsLogicGate1(ctl))
                {
                    CrossConnect(((LogicGate1)ctl).InputPoint, conn.OutputPoint);
                }
                else if (Support.IsLogicGate2(ctl))
                {
                    switch (type)
                    {
                        case "input1": CrossConnect(((LogicGate2)ctl).InputPoint1, conn.OutputPoint); break;
                        case "input2": CrossConnect(((LogicGate2)ctl).InputPoint2, conn.OutputPoint); break;
                    }
                }
                else if (Support.IsNibble(ctl))
                {
                    switch (type)
                    {
                        case "input1": CrossConnect(((Nibble)ctl).InputPoint1, conn.OutputPoint); break;
                        case "input2": CrossConnect(((Nibble)ctl).InputPoint2, conn.OutputPoint); break;
                        case "input3": CrossConnect(((Nibble)ctl).InputPoint3, conn.OutputPoint); break;
                        case "input4": CrossConnect(((Nibble)ctl).InputPoint4, conn.OutputPoint); break;
                    }
                    ((Nibble)ctl).CheckConnections();
                }
                */

                CrossConnect(conn.OutputPoint, sender);
                foreach (IOPoint iop in conn.InputPoint.Connected)
                {
                    iop.Connecting = false;
                }

                connections.Add(conn);
                conn.Input = conn.InputPoint.Connected[0].IO;
                conn = null;
                Connecting = false;
            }
        }
Example #4
0
 private void getConnected(IOPoint iop, ref SerializedLogicGate slg)
 {
     SerializedLogicGate.Outputs outputlist = new SerializedLogicGate.Outputs();
     foreach (IOPoint iop2 in iop.Connected)
     {
         Connector c = (Connector)iop2.Parent;
         Debug.Print(((Control)c.OutputPoint.Connected[0].Parent).Name);
         outputlist.ConnectedTo.Add(((Control)c.OutputPoint.Connected[0].Parent).Name + "." + c.OutputPoint.Connected[0].Name);
     }
     slg.outputs.Add(outputlist);
 }
Example #5
0
 public static void removeConnections(IOPoint iop)
 {
     foreach (IOPoint iop2 in iop.Connected)
     {
         try
         {
             Connector c = (Connector)iop2.Parent;
             if (!c.InputPoint.Connected[0].Equals(iop))
             {
                 c.InputPoint.Connected[0].Remove(c.InputPoint);
             }
             if (!c.OutputPoint.Connected[0].Equals(iop))
             {
                 c.OutputPoint.Connected[0].Remove(c.OutputPoint);
             }
             connections.Remove(c);
         }
         catch
         {
             // Ignore error
         }
     }
     iop.Clear();
 }
Example #6
0
 public static void CrossConnect(IOPoint input, IOPoint output, Boolean connecting)
 {
     input.Connected.Add(output);
     output.Connected.Add(input);
     output.Connecting = connecting;
 }
Example #7
0
 public static void CrossConnect(IOPoint input, IOPoint output)
 {
     CrossConnect(input, output, false);
 }
Example #8
0
 public void Remove(IOPoint iop)
 {
     Connected.Remove(iop);
     if (Connected.Count == 0) IO = false;
 }