Пример #1
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Dictionary <string, string> Params = new Dictionary <string, string>();
                if (!selfParam.Mode.Equals(JsonInterFace.LteDeviceParameter.DeviceMode))
                {
                    Params.Add("mode", cbxMode.Text.Trim());
                }

                if (!selfParam.SN.Trim().Equals(JsonInterFace.LteDeviceParameter.SN))
                {
                    Params.Add("sn", txtSN.Text.Trim());
                }

                if (!selfParam.IP.Trim().Equals(JsonInterFace.LteDeviceParameter.IpAddr))
                {
                    Params.Add("ipAddr", txtIPAddr.Text.Trim());
                }

                if (!selfParam.Port.Trim().Equals(JsonInterFace.LteDeviceParameter.Port))
                {
                    Params.Add("port", txtPort.Text.Trim());
                }

                if (!selfParam.NetMask.Equals(JsonInterFace.LteDeviceParameter.NetMask))
                {
                    Params.Add("netmask", JsonInterFace.LteDeviceParameter.NetMask);
                }

                if (!selfParam.DeviceName.Trim().Equals(JsonInterFace.LteDeviceParameter.DeviceName))
                {
                    Params.Add("name", txtDeviceName.Text.Trim());
                }

                Params.Add("carrier", "0");

                if (Params.Count <= 0)
                {
                    MessageBox.Show("内容未改变!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information);
                    return;
                }

                if (MessageBox.Show("确定更新设备信息[" + JsonInterFace.LteDeviceParameter.DeviceName + "]?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK)
                {
                    if (NetWorkClient.ControllerServer.Connected)
                    {
                        Parameters.ConfigType = "Manul";
                        NetWorkClient.ControllerServer.Send(JsonInterFace.AddDeviceNameUpdateParametersRequest(JsonInterFace.LteDeviceParameter.DomainFullPathName, selfParam.DeviceName, Params));
                    }
                }
            }
            catch (Exception ex)
            {
                Parameters.PrintfLogsExtended(ex.Message, ex.StackTrace);
            }
        }