Advertisement
Guest User

C#

a guest
Sep 14th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public partial class MainWindow : Window
  2. {
  3.  
  4. public MainWindow()
  5. {
  6. InitializeComponent();
  7. }
  8. public static DataGrid grid { get; set; }
  9.  
  10. public void dataGrid_Loaded(object sender, RoutedEventArgs e)
  11. {
  12.  
  13. Thread thread = new Thread(SCMClient.connect);
  14. thread.IsBackground = true;
  15. thread.Start();
  16. create_columns();
  17. SCMClient.record_list.Add(new Record("Support-99", "ROBOTS", 0, 0.0, "", "OK", 0.0, 0, 0, 0.0, ""));
  18. grid = sender as DataGrid;
  19. grid.ItemsSource = SCMClient.record_list;
  20. grid.Items.Refresh();
  21.  
  22.  
  23.  
  24. }
  25.  
  26.  
  27.  
  28. public void create_columns()
  29. {
  30. var col1 = new DataGridTextColumn();
  31. col1.Header = "Station";
  32. col1.Binding = new Binding("Station");
  33. dataGrid.Columns.Add(col1);
  34.  
  35. var col2 = new DataGridTextColumn();
  36. col2.Header = "UserName";
  37. col2.Binding = new Binding("UserName");
  38. dataGrid.Columns.Add(col2);
  39.  
  40. var col3 = new DataGridTextColumn();
  41. col3.Header = "EvtTime";
  42. col3.Binding = new Binding("EvtTime");
  43. dataGrid.Columns.Add(col3);
  44.  
  45. var col4 = new DataGridTextColumn();
  46. col4.Header = "LocCode";
  47. col4.Binding = new Binding("LocCode");
  48. dataGrid.Columns.Add(col4);
  49.  
  50. }
  51.  
  52. public void refresh_grid()
  53. {
  54.  
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement