Beispiel #1
0
        private TargetHelper()
        {
            Targets     = new ObservableCollection <Target>();
            TargetIndex = new Dictionary <string, int>();

            ICollectorStore _store = new CollectorStoreImple(ConfigManager.Configuration["Configurations:ConnectionString"]);

            var list = _store.GetTargetListAsync().Result;
            int idx  = 0;

            foreach (var item in list)
            {
                Target tag = new Target();
                tag.PlcID    = item.PlcId;
                tag.Address  = item.Address;
                tag.TagName  = item.Name;
                tag.VarType  = GetVarType(item.VarType);
                tag.Value    = "";
                tag.ReadTime = "";

                Targets.Add(tag);
                TargetIndex.Add(item.Address, idx);

                idx += 1;
            }
        }
Beispiel #2
0
        private PlcHelper()
        {
            Plcs     = new ObservableCollection <Plc>();
            PlcIndex = new Dictionary <long, int>();

            ICollectorStore _store = new CollectorStoreImple(ConfigManager.Configuration["Configurations:ConnectionString"]);
            var             list   = _store.GetPlcListAsync().Result;

            var idx = 0;

            foreach (var entity in list)
            {
                Plc item = new Plc();
                item.Id      = entity.Id;
                item.CpuType = entity.CpuType;
                item.Name    = entity.Name;
                item.Ip      = entity.Ip;
                item.Port    = entity.Port;
                item.Rack    = entity.Rack;
                item.Slot    = entity.Slot;
                item.Status  = "";

                Plcs.Add(item);
                PlcIndex.Add(item.Id, idx);
                idx += 1;
            }
        }