Exemple #1
0
 public void OpenOrCloseChannel(DeviceChannelModel model)
 {
     foreach (var item in DeviceChannelList)
     {
         foreach (var childitem in item.Value)
         {
             if (childitem.Id == model.Id)
             {
                 childitem.IsOpen = model.IsOpen;
             }
         }
     }
 }
Exemple #2
0
        private List <DeviceChannelModel> AddChannel(int index)
        {
            List <DeviceChannelModel> list = new List <DeviceChannelModel>();

            switch (index)
            {
            case 0:
                DeviceChannelModel channel0 = new DeviceChannelModel
                {
                    Id         = 1,
                    Name       = "通道1",
                    RegAddress = 0x30,
                    DiskPath   = "Bar1",
                    DeviceNo   = index
                };
                DeviceChannelModel channel1 = new DeviceChannelModel
                {
                    Id         = 2,
                    Name       = "通道2",
                    RegAddress = 0x34,
                    DiskPath   = "Bar2",
                    DeviceNo   = index,
                };
                DeviceChannelModel channel2 = new DeviceChannelModel
                {
                    Id         = 3,
                    Name       = "通道3",
                    RegAddress = 0x38,
                    DiskPath   = "Bar3",
                    DeviceNo   = index
                };
                list.Add(channel0);
                list.Add(channel1);
                list.Add(channel2);
                break;

            case 1:
                DeviceChannelModel channel3 = new DeviceChannelModel
                {
                    Id         = 4,
                    Name       = "通道4",
                    RegAddress = 0x40,
                    DiskPath   = "Bar4",
                    DeviceNo   = index
                };
                DeviceChannelModel channel4 = new DeviceChannelModel
                {
                    Id         = 5,
                    Name       = "通道5",
                    RegAddress = 0x44,
                    DiskPath   = "Bar5",
                    DeviceNo   = index
                };
                DeviceChannelModel channel5 = new DeviceChannelModel
                {
                    Id         = 6,
                    Name       = "通道6",
                    RegAddress = 0x48,
                    DiskPath   = "Bar6",
                    DeviceNo   = index
                };
                list.Add(channel3);
                list.Add(channel4);
                list.Add(channel5);
                break;

            default:
                break;
            }
            return(list);
        }