Пример #1
0
        private void GetGatewayConfig(object sender, RoutedEventArgs e)
        {
            if (login == null || String.IsNullOrEmpty(login.SessionID))
            {
                MessageBox.Show("Please login first");
                return;
            }
            UseHTTPS();
            gatewayConfig = api.GetGatewayConfig(login.SessionID, gatewayID.Text);
            if ((AEResultCodes)gatewayConfig.Code == AEResultCodes.OK)
            {
                SiteHardwareList.Items.Clear();
                AddMessage(string.Format("*** GetGatewayConfig returned {0}", gatewayConfig.ServerTime.ToString()));
                for (int i = 0; i < gatewayConfig.devices.Count(); i++)
                {
                    DeviceConfig dc = gatewayConfig.devices[i];
                    AddMessage(string.Format("{0}: {1},{2},{3},{4},{5} {6} registers", i, dc.HID, dc.Description, dc.SerialNumber, dc.ComType, dc.DeviceType, dc.Registers.Count()));


                    for (int j = 0; j < dc.Registers.Count(); j++)
                    {
                        string regData = String.Format("{0} [{1}] - {2}", dc.Registers[j].RegName, dc.Registers[j].RegNum, dc.Registers[j].DataType);
                        AddMessage(regData);
                    }

                    TextBlock hwText = new TextBlock();
                    hwText.Text       = dc.HID;
                    hwText.MouseDown += new MouseButtonEventHandler(hwText_MouseDown);
                    hwText.Tag        = dc;
                    SiteHardwareList.Items.Add(hwText);
                }
            }
            else
            {
                AddMessage(string.Format("*** GetGatewayConfig returned {0}", gatewayConfig.ResultCodeString()));
            }
        }