public Form1() { InitializeComponent(); serialPort1 = new SerialPort(); this.KeyPreview = true; controle = new ControleRobot(this); com = new Communication(); com.ShowDialog(); }
ControleRobot controle; //window blank for connexion shortcut public MainWindow() { InitializeComponent(); this.KeyPreview = true; controle = new ControleRobot(this); com = new Communication(); //window principal can ask com, mais pas l'inverse com.ShowDialog(); //appel à l'ouverture de la window com StreamReader sr = new StreamReader("data.csv"); String line; // Read and display lines from the file until the end of // the file is reached. bool confirm = true; //inisialisation de la dataGrillView de livre while ((line = sr.ReadLine()) != null) { String[] split; split = line.Split(';'); if (confirm) { for (int x = 0; x < split.Length; x++) { DataColumn colone = new DataColumn(); if (split[x].Contains('$')) { colone.DataType = System.Type.GetType("System.Int32"); } colone.ColumnName = split[x]; table.Columns.Add(colone); } confirm = false; } else { DataRow row = table.NewRow(); for (int x = 0; x < split.Length; x++) { row[x] = split[x]; } table.Rows.Add(row); } } data.DataSource = table; Connect(); }