Пример #1
0
 public void InsertDevices(IConstructDevice conv)
 {
     try
     {
         conv.DeviceInfos.ForEach(deviceInfo => InsertDevice(deviceInfo, conv));
     }
     catch (Exception ex)
     {
         Core.Environment.Log.Write(ex);
     }
 }
Пример #2
0
        public Device(DeviceInfo info, BaseTrack conv) : base(info)
        {
            deviceInfo = info;
            conveyor   = conv;

            SectionName       = conv.SectionName;
            OnSectionChanged += Device_OnSectionChanged;

            if (conv is IConstructDevice)
            {
                parent = (IConstructDevice)conv;
                ((IConstructDevice)conv).OnSizeUpdated += Device_OnSizeUpdated;
            }
        }
Пример #3
0
        public ConstructDevice(string convName)
        {
            //To add a new device just create a new Tuple as below and that is all you need to do.
            DeviceType = new Tuple <string, string, string>
                             ("Experior.Catalog.Dematic.Case.Devices.CasePhotocell",
                             "Experior.Catalog.Dematic.Case.Devices.CasePhotocellInfo",
                             "photoeye");

            DeviceTypes.Add("Add Photocell", DeviceType);

            DeviceType = new Tuple <string, string, string>
                             ("Experior.Catalog.Dematic.Case.Devices.CommunicationPoint",
                             "Experior.Catalog.Dematic.Case.Devices.CommunicationPointInfo",
                             "commpoint");
            DeviceTypes.Add("Add Comm Point", DeviceType);

            DeviceType = new Tuple <string, string, string>
                             ("Experior.Catalog.Dematic.Case.Devices.LoadEater",
                             "Experior.Catalog.Dematic.Case.Devices.LoadEaterInfo",
                             "PacMan.png");
            DeviceTypes.Add("Add Load Eater", DeviceType);

            DeviceType = new Tuple <string, string, string>
                             ("Experior.Catalog.Dematic.Case.Devices.LoadFeeder",
                             "Experior.Catalog.Dematic.Case.Devices.LoadFeederInfo",
                             "Feeder.png");
            DeviceTypes.Add("Add Load Feeder", DeviceType);


            subMnu = new System.Windows.Forms.ToolStripMenuItem[DeviceTypes.Count];
            int menuCount = 0;

            foreach (string key in DeviceTypes.Keys)
            {
                Tuple <string, string, string> tuple = DeviceTypes[key];
                subMnu[menuCount]         = new System.Windows.Forms.ToolStripMenuItem(key, Common.Icons.Get(tuple.Item3));
                subMnu[menuCount].Click  += new EventHandler(AddDevice);
                subMnu[menuCount].Enabled = true;
                menuCount++;
            }

            //If you are adding a device before the assembly has been created the conveyor will not have been created
            //conveyor is needed only when a user adds a device from a right click event
            //Linefull photoeyes are created as default during construction and not by a user
            if (Assembly.Items.ContainsKey(convName))
            {
                conveyor = Assembly.Items[convName] as IConstructDevice;
            }
        }
Пример #4
0
        public Device InsertDevice(DeviceInfo deviceInfo, IConstructDevice conv)
        {
            Device device = null;

            try
            {
                deviceInfo.SetCustomInfoFields(conv as Assembly, null, ref deviceInfo);

                Type type = Type.GetType(deviceInfo.type);
                device = (Device)Activator.CreateInstance(type, new object[] { deviceInfo, conv });
                conv.addAssembly(device, new Vector3(0, 0, 0));
                device.DeviceDistance   = deviceInfo.distance;
                device.OnDeviceDeleted += device_OnDeviceDeleted;
            }
            catch (Exception ex)
            {
                Log.Write(ex.Message);
            }
            return(device);
        }
Пример #5
0
 public void insertDevice(IConstructDevice ap)
 {
     throw new NotImplementedException();
 }