Example #1
0
 void OnSetupColumnsDone()
 {
     if (_ctsOBDTestStart != null)
     {
         _ctsOBDTestStart.Cancel();
     }
     _ctsSetupColumnsDone = UpdateUITask("正在读取车辆信息");
     Invoke((EventHandler) delegate {
         GridViewInfo.DataSource    = _obdTest.GetDataTable(DataTableType.dtInfo);
         GridViewECUInfo.DataSource = _obdTest.GetDataTable(DataTableType.dtECUInfo);
         GridViewIUPR.DataSource    = _obdTest.GetDataTable(DataTableType.dtIUPR);
         if (GridViewInfo.Columns.Count > 1)
         {
             GridViewInfo.Columns[0].Width = 30;
             GridViewInfo.Columns[1].Width = 150;
             SetGridViewColumnsSortMode(GridViewInfo, DataGridViewColumnSortMode.Programmatic);
         }
         if (GridViewECUInfo.Columns.Count > 1)
         {
             GridViewECUInfo.Columns[0].Width = GridViewInfo.Columns[0].Width;
             GridViewECUInfo.Columns[1].Width = GridViewInfo.Columns[1].Width;
             SetGridViewColumnsSortMode(GridViewECUInfo, DataGridViewColumnSortMode.Programmatic);
         }
         if (GridViewIUPR.Columns.Count > 1)
         {
             GridViewIUPR.Columns[0].Width = GridViewInfo.Columns[0].Width;
             GridViewIUPR.Columns[1].Width = GridViewInfo.Columns[0].Width * 8;
             SetGridViewColumnsSortMode(GridViewIUPR, DataGridViewColumnSortMode.Programmatic);
         }
     });
 }
Example #2
0
        private void UpdateDataGridUI(DataGrid dg)
        {
            dg.ItemsSource = null;
            switch (dg.Name)
            {
            case "dgInfo":
                dg.ItemsSource = _obdTest.GetDataTable(DataTableType.dtInfo).DefaultView;
                break;

            case "dgECUInfo":
                dg.ItemsSource = _obdTest.GetDataTable(DataTableType.dtECUInfo).DefaultView;
                break;

            case "dgIUPR":
                dg.ItemsSource = _obdTest.GetDataTable(DataTableType.dtIUPR).DefaultView;
                break;
            }
            if (dg.Columns.Count > 1)
            {
                SetDataGridColumnsStyle(dg);
            }
        }