コード例 #1
0
ファイル: TagCompile.cs プロジェクト: Rocinante-Poet/AGV
        /// <summary>
        /// 显示所有信标数据
        /// </summary>
        /// <param name="Beacon"></param>
        /// <param name="arr"></param>
        public void TagManagement(DataGrid Beacon, string arr)
        {
            Thread thread = new Thread(() => {
                TagInfoBLL tagInfo   = new TagInfoBLL();
                MySqlDataReader data = tagInfo.RataTable(long.Parse(arr));
                DataTable table      = new DataTable();
                table.Columns.Add(new DataColumn("TagName"));
                table.Columns.Add(new DataColumn("PreTag"));
                table.Columns.Add(new DataColumn("PreLeftTag"));
                table.Columns.Add(new DataColumn("PreRightTag"));
                table.Columns.Add(new DataColumn("NextTag"));
                table.Columns.Add(new DataColumn("NextLeftTag"));
                table.Columns.Add(new DataColumn("NextRightTag"));
                table.Columns.Add(new DataColumn("Speed"));
                table.Columns.Add(new DataColumn("SpeedRev"));
                table.Columns.Add(new DataColumn("StopTime"));
                table.Columns.Add(new DataColumn("Pbs"));
                table.Columns.Add(new DataColumn("PbsRev"));
                table.Columns.Add(new DataColumn("TagTerminal"));
                DataRow dr;
                while (data.Read())
                {
                    dr                 = table.NewRow();
                    dr["TagName"]      = data["TagName"].ToString();
                    dr["PreTag"]       = data["PreTag"].ToString();
                    dr["PreLeftTag"]   = data["PreLeftTag"].ToString();
                    dr["PreRightTag"]  = data["PreRightTag"].ToString();
                    dr["NextTag"]      = data["NextTag"].ToString();
                    dr["NextLeftTag"]  = data["NextLeftTag"].ToString();
                    dr["NextRightTag"] = data["NextRightTag"].ToString();
                    dr["Speed"]        = agvSpeed[Convert.ToInt32(data["Speed"].ToString())];
                    dr["SpeedRev"]     = agvSpeed[Convert.ToInt32(data["SpeedRev"].ToString())];
                    dr["StopTime"]     = data["StopTime"].ToString();
                    dr["Pbs"]          = agvPbs[Convert.ToInt32(data["Pbs"].ToString())];
                    dr["PbsRev"]       = agvPbs[Convert.ToInt32(data["PbsRev"].ToString())];
                    dr["TagTerminal"]  = data["TagTerminal"].ToString();
                    table.Rows.Add(dr);
                }
                data.Close();
                Beacon.Dispatcher.BeginInvoke(new Action(() => {
                    Beacon.ItemsSource         = table.DefaultView;
                    Beacon.AutoGenerateColumns = false;
                }));
            });

            thread.IsBackground = true;
            thread.Start();
        }