Ejemplo n.º 1
0
        /// <summary>
        /// 加载网络数据
        /// </summary>
        /// <param name="UTCTime"></param>
        /// <returns></returns>
        public ObservableCollection <NetworkInfo> LoadNetwork(long UTCTime)
        {
            PortInfo.Networks.Clear();
            MySqlDataReader reader = MapBLL.SelectNetworkBLL(UTCTime);
            ObservableCollection <NetworkInfo> Net = new ObservableCollection <NetworkInfo>();

            if (reader != null)
            {
                while (reader.Read())
                {
                    Net.Add(new NetworkInfo()
                    {
                        IP_Address     = reader.GetString("IP_Address"),
                        IP_Port        = reader.GetInt32("IP_Port"),
                        IP_Static      = "断开",
                        IP_StaticColor = new SolidColorBrush(Colors.Red),
                    });
                    PortInfo.Networks.Add(new NetworkInfo()
                    {
                        IP_Address = reader.GetString("IP_Address"),
                        IP_Port    = reader.GetInt32("IP_Port")
                    });
                }
                reader.Close();
            }
            return(Net);
        }
Ejemplo n.º 2
0
        public void PortLoad()
        {
            GetMenutype = Menutype.ProntSetting;
            gridItem.VerticalAlignment      = VerticalAlignment.Top;
            gridItem.HorizontalAlignment    = HorizontalAlignment.Center;
            CountMap.Content                = gridItem;
            gridNetwork.VerticalAlignment   = VerticalAlignment.Top;
            gridNetwork.HorizontalAlignment = HorizontalAlignment.Left;
            networkCount.Content            = gridNetwork;
            MySqlDataReader PortData = mapMessage.ListDevice(MapRegulate.UTCTime);
            int             i        = 0;

            while (PortData.Read())
            {
                AddRows(i, PortData["Com"].ToString(), PortData["Baud"].ToString(), PortData["Agv"].ToString());
                Index = i;
                i++;
            }
            PortData.Close();
            if (gridItem.RowDefinitions.Count.Equals(1) || gridItem.RowDefinitions.Count.Equals(0))
            {
                DeletePort.IsEnabled = false;
            }
            MySqlDataReader reader = mapMessage.SelectNetworkBLL(MapRegulate.UTCTime);

            if (reader != null)
            {
                int id = 0;
                while (reader.Read())
                {
                    AddNetwork(id, reader["IP_Address"].ToString(), reader["IP_Port"].ToString());
                    NetworkIndex = id;
                    id++;
                }
            }
            if (gridNetwork.RowDefinitions.Count.Equals(1) || gridNetwork.RowDefinitions.Count.Equals(0))
            {
                Network_Delete.IsEnabled = false;
            }
        }