//Zapis panelu sterowania wraz z zaprogramowanymi komendami private void bSave_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; saveFileDialog1.DefaultExt = "txt"; saveFileDialog1.AddExtension = true; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { StreamWriter writer = new StreamWriter(saveFileDialog1.OpenFile()); if (writer != null) { StringBuilder sb = new StringBuilder(); foreach (PanelGUI kb in PanelGUI.Elements) { switch (kb.Element) { case 'B': ButtonGUI bGUI = (ButtonGUI)kb; sb.AppendLine("B~" + bGUI.Button.Text + "~" + bGUI.Key + "~" + bGUI.CommandDown + "~" + bGUI.CommandUp + "~" + bGUI.Location.X + "," + bGUI.Location.Y); break; } } writer.Write(sb.ToString()); writer.Close(); } } }
public Form2(Form1 main, ButtonGUI _editedButton) { InitializeComponent(); this.comboBox1.Items.AddRange(BlueBotCompiler.GetFunctions()); this.comboBox2.Items.AddRange(BlueBotCompiler.GetVariables()); editedKey = _editedButton; this.kbEdited.Text = editedKey.Button.Text; this.rtbCommandDown.Text = editedKey.CommandDown; this.rtbCommandUp.Text = editedKey.CommandUp; changeKey = false; changeSign = false; isActiveUp = false; }