/// <summary>
        /// 添加服务器IP
        /// </summary>
        /// <param name="fuwuqi_Ip"></param>
        public void Add_ip(Fuwuqi_ip fuwuqi_Ip)
        {
            foreach (var item in Shuju.Fuwuqi_Ips)
            {
                if (item.Ip == fuwuqi_Ip.Ip && item.Daunkou == fuwuqi_Ip.Daunkou)
                {
                    return;
                }
            }

            Shuju.Fuwuqi_Ips.Add(fuwuqi_Ip);
            Baocun_jiben();
        }
        /// <summary>
        /// 添加新的控制中心
        /// </summary>
        /// <param name="fuwuqi_Ip"></param>
        public void Add_kongzhi(Fuwuqi_ip fuwuqi_Ip)
        {
            //检查
            foreach (var ips in App.Peizhi_.Shuju.Fuwuqi_Ips)
            {
                if (ips.Daunkou == fuwuqi_Ip.Daunkou && ips.Ip == fuwuqi_Ip.Ip)
                {
                    return;
                }
            }

            //尝试连接
            Lianjie(fuwuqi_Ip);
        }
        /// <summary>
        /// 连接控制中心
        /// </summary>
        /// <param name="ip">ip地址</param>
        /// <param name="duankou">端口</param>
        public void Lianjie(Fuwuqi_ip fuwuqi_Ip)
        {
            //发送当前设备数据

            //绑定IP
            IPEndPoint ip = new IPEndPoint(IPAddress.Parse(fuwuqi_Ip.Ip), fuwuqi_Ip.Daunkou);
            //连接服务器
            Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            //格式化当前设备数据
            string str = Shebei_dangqian.Shuju_json();

            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(str);


            server.SendTo(bytes, ip);
            server.Close();
        }
        public void Remove_ip(Fuwuqi_ip fuwuqi_Ip)
        {
            try
            {
                foreach (var item in Shuju.Fuwuqi_Ips)
                {
                    if (item.Ip == fuwuqi_Ip.Ip && item.Daunkou == fuwuqi_Ip.Daunkou)
                    {
                        Shuju.Fuwuqi_Ips.Remove(item);
                        break;
                    }
                }

                Baocun_jiben();
            }
            catch (Exception exc)
            {
            }
        }
        /// <summary>
        /// 分析从控制中心获取的数据
        /// </summary>
        /// <param name="json_str"></param>
        public void Fengxi_shuju(string json_str, Fuwuqi_ip fuwuqi_Ip)
        {
            try
            {
                Shuju_chuang shuju_Chuang = null;
                Kongzhi      kongzhi      = null;

                using (TextReader str = new StringReader(json_str))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    shuju_Chuang = (Shuju_chuang)serializer.Deserialize(str, typeof(Shuju_chuang));
                }
                if (shuju_Chuang != null)
                {
                    //查找是否存在控制中心
                    foreach (var item in Kongzhis)
                    {
                        if (item.Shuju.Weiyi_shibie == shuju_Chuang.Kongzhi.Weiyi_shibie)
                        {
                            kongzhi = item;
                        }
                    }
                    if (kongzhi == null)
                    {
                        kongzhi = new Kongzhi();
                        kongzhi.chushihua(shuju_Chuang.Kongzhi, fuwuqi_Ip);
                        Kongzhis.Add(kongzhi);
                    }

                    //调用控制中心更新
                    kongzhi.Gengxin(shuju_Chuang);
                }
            }
            catch (Exception exc)
            {
            }
        }
 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="shuju_Kongzhi"></param>
 public void chushihua(Shuju_kongzhi shuju_Kongzhi, Fuwuqi_ip fuwuqi_Ip)
 {
     Shuju      = shuju_Kongzhi;
     Fuwuqi_Ip_ = fuwuqi_Ip;
 }