Ejemplo n.º 1
0
 private void button_load_Click(object sender, EventArgs e)
 {
     openFileDialog_mpack.InitialDirectory = new FileInfo(Application.ExecutablePath).Directory + "\\Data\\Macros";
     openFileDialog_mpack.FileName         = "test.pcmpack";
     if (openFileDialog_mpack.ShowDialog() == DialogResult.OK)
     {
         try
         {
             main = MacroPack.Load(openFileDialog_mpack.FileName);
         }
         catch
         {
             MessageBox.Show(
                 TB.L.Phrase["Form_MacroPack.ErrorWhileLoading"],
                 TB.L.Phrase["Form_MacroPack.Error"],
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             main = new MacroPack(
                 TB.L.Phrase["Form_MacroPack.NoName"],
                 TB.L.Phrase["Form_MacroPack.NoDiscr"],
                 TB.L.Phrase["Form_MacroPack.NoName"]);
         }
         UpDateGeneralSettings();
         UpDateListbox();
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog2.ShowDialog() == DialogResult.OK)
            {
                Main = MacroPack.Load(openFileDialog2.FileName);

                if (!Main.IsEveryMacroCorrect)
                {
                    MessageBox.Show(
                        TB.L.Phrase["Form_MacroPack.UnableToLoadSomeMacro"],
                        TB.L.Phrase["Connection.Error"],
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                tabControl1.SelectedIndex = 1;
                comboBox_presets.Items.Clear();
                comboBox_presets.Items.AddRange(Main.Samples.ToArray());
                comboBox_bd.Items.Clear();
                comboBox_bd.Items.AddRange(BdRate.GetNamesInt().Select(p => p.ToString()).ToArray());
                comboBox_port.Items.Clear();
                comboBox_port.Items.AddRange(SerialPort.GetPortNames());
                comboBox_bd.SelectedItem   = Main.PortBD.Num.ToString();
                comboBox_port.SelectedItem = Main.PortName.ToString();
                groupBox_presets.Enabled   = false;
                groupBox_macro.Enabled     = false;
                richTextBox_discr.Text     = Main.Discr;
                label_caption.Text         = Main.Caption;
                label_name.Text            = Main.Name;
                CreateButtons();
            }
        }