private void Initialize() { Views = new List <UlPanel>(); Views.Add(view1Panel); Views.Add(view2Panel); Views.Add(view3Panel); Views.Add(view4Panel); Views.Add(view5Panel); Views.Add(view6Panel); Views.Add(view7Panel); Views.Add(view8Panel); Views.Add(view9Panel); Views.Add(view10Panel); Views.Add(view11Panel); Views.Add(view12Panel); Views.Add(view13Panel); Views.Add(view14Panel); Views.Add(view15Panel); Views.Add(view16Panel); Views.Add(view17Panel); Views.Add(view18Panel); Views.Add(view19Panel); Views.Add(view20Panel); Views.Add(view21Panel); Views.Add(view22Panel); Views.Add(view23Panel); Views.Add(view24Panel); Views.Add(view25Panel); Views.Add(view26Panel); Views.Add(view27Panel); Views.Add(view28Panel); Views.Add(view29Panel); Views.Add(view30Panel); Views.Add(view31Panel); Views.Add(view32Panel); Views.Add(view33Panel); for (int i = 0; i < Resource.Client.Devices.Controller.Rows.Count; i++) { ControllerRow <float> row = Resource.Client.Devices.Controller.Rows[i]; Views[i].Controls.Add( new CtrlControllerView(row.Name, row.NetworkNo, row.Address)); } }
private void Initialize() { // Load powermeter parameters int i = 1; int index = 0; string section; string key = $"PM{i}"; string param = client.Ini.GetString("PowerMeter", key); PowerMeter.Rows.Clear(); while (string.IsNullOrWhiteSpace(param) == false) { string[] @params = param.Split(new[] { ',' }, StringSplitOptions.None); EWT330Phase phase = (@params[1] == "P1") ? EWT330Phase.P1 : EWT330Phase.P3; PowerMeterRow <float> row = new PowerMeterRow <float>(@params[0], phase); PowerMeter.Rows.Add(row); int j = 1; section = $"{key}.Channel"; key = $"CH{j}"; param = client.Ini.GetString(section, key); while (string.IsNullOrWhiteSpace(param) == false) { //@params = param.Split(new[] { ',' }, StringSplitOptions.None); //index = int.Parse(@params[1]); DeviceValueRow <float> valueRow = new DeviceValueRow <float>(param, index++, 0); row.Values.Add(valueRow); PowerMeter.Values.Add(valueRow); j++; key = $"CH{j}"; param = client.Ini.GetString(section, key); } i++; key = $"PM{i}"; param = client.Ini.GetString("PowerMeter", key); } // Load recorder parameters i = 1; key = $"Rec{i}"; param = client.Ini.GetString("Recorder", key); Recorder.Rows.Clear(); while (string.IsNullOrWhiteSpace(param) == false) { RecorderRow <float> row = new RecorderRow <float>(param); Recorder.Rows.Add(row); int j = 1; section = $"{key}.Channel"; key = $"CH{j}"; param = client.Ini.GetString(section, key); while (string.IsNullOrWhiteSpace(param) == false) { DeviceValueRow <float> valueRow = new DeviceValueRow <float>(param, index++, 0); row.Values.Add(valueRow); Recorder.Values.Add(valueRow); j++; key = $"CH{j}"; param = client.Ini.GetString(section, key); } i++; key = $"Rec{i}"; param = client.Ini.GetString("Recorder", key); } int count = Recorder.Values.Count / 4; for (int k = 0; k < count; k++) { Recorder.ValueList[0].Add(Recorder.Values[k]); Recorder.ValueList[1].Add(Recorder.Values[k + count]); Recorder.ValueList[2].Add(Recorder.Values[k + count * 2]); if ((k + count * 3) < Recorder.Values.Count) { Recorder.ValueList[3].Add(Recorder.Values[k + count * 3]); } } string[] recParams = client.Ini.GetString("Recorder", "Pressure").Split(new[] { ',' }, StringSplitOptions.None); Recorder.PressureIndex = int.Parse(recParams[0]); Recorder.PressureLength = int.Parse(recParams[1]); recParams = client.Ini.GetString("Recorder", "Thermocouple").Split(new[] { ',' }, StringSplitOptions.None); Recorder.ThermocoupleIndex = int.Parse(recParams[0]); Recorder.ThermocoupleLength = int.Parse(recParams[1]); // Load controller parameters i = 1; key = $"Ctrl{i}"; param = client.Ini.GetString("Controller", key); Controller.Rows.Clear(); while (string.IsNullOrWhiteSpace(param) == false) { string[] @params = param.Split(new[] { ',' }, StringSplitOptions.None); int networkNo = int.Parse(@params[1]); int addr = int.Parse(@params[2]); ControllerRow <float> row = new ControllerRow <float>(@params[0], networkNo, addr); Controller.Rows.Add(row); int j = 1; section = $"{key}.Channel"; key = $"CH{j}"; param = client.Ini.GetString(section, key); while (string.IsNullOrWhiteSpace(param) == false) { //@params = param.Split(new[] { ',' }, StringSplitOptions.None); //index = int.Parse(@params[1]); DeviceValueRow <float> valueRow = new DeviceValueRow <float>(param, index++, 0); row.Values.Add(valueRow); Controller.Values.Add(valueRow); j++; key = $"CH{j}"; param = client.Ini.GetString(section, key); } i++; key = $"Ctrl{i}"; param = client.Ini.GetString("Controller", key); } // Load PLC parameters i = 1; index = 0; key = $"Plc{i}"; param = client.Ini.GetString("Plc", key); Plc.Rows.Clear(); while (string.IsNullOrWhiteSpace(param) == false) { PlcRow <UInt16> row = new PlcRow <UInt16>(param); Plc.Rows.Add(row); int j = 1; section = $"{key}.Channel"; key = $"CH{j}"; param = client.Ini.GetString(section, key); while (string.IsNullOrWhiteSpace(param) == false) { DeviceValueRow <UInt16> valueRow = new DeviceValueRow <UInt16>(param, index++, 0); row.Values.Add(valueRow); Plc.Values.Add(valueRow); j++; key = $"CH{j}"; param = client.Ini.GetString(section, key); } i++; key = $"Plc{i}"; param = client.Ini.GetString("Plc", key); } }