private void OK_Button_Click(object sender, EventArgs e) { if (command_History.Command_History_List.Count() > 3000) { command_History.Command_History_List.Clear(); Serial_Input_TextBox.Clear(); } command_History.Command_History_List.Add(new Message_Maker(Text_Message_TextBox.Text, MainForm.Enter_Effect_Index, MainForm.Leave_Effect_Index, MainForm.Text_Color_Index, MainForm.Text_Color_Index, MainForm.Page_Number_Index, MainForm.Display_Number_Index, MainForm.Line_Number_Display_Index)); // MessageBox.Show(command_History.Command_History_List[command_History.Command_History_List.Count - 1].Enter_Effect_Index.ToString()); try { ThreadOfMessage.RunWorkerAsync(); // Démarre un thread } catch { ThreadOfMessage.CancelAsync(); Serial_Input_TextBox.Text += "Annulation du Tread precedent et demarrage d'un nouveau thread" + "\r\n"; ThreadOfMessage.RunWorkerAsync(); } }
private void Import_to_XML_Button_Click(object sender, EventArgs e) { try { Serial_Input_TextBox.Clear(); Serial_Input_TextBox.Text += "Clear TextBox : OK" + "\r\n"; StreamReader reader = new StreamReader("Historique.xml"); Command_History_Class command_History = (Command_History_Class) new XmlSerializer(typeof(Command_History_Class)).Deserialize(reader); reader.Close(); Serial_Input_TextBox.Text += "Import : OK" + "\r\n"; for (int i = 0; i <= (command_History.Command_History_List.Count - 1); i++) { //MessageBox.Show(i.ToString()); Serial_Input_TextBox.Text += command_History.Command_History_List[i].Message_Send_String + "\r\n"; } } catch { Serial_Input_TextBox.Text += "Error with Import XML!" + "\r\n"; } }