Exemplo 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();
     }
 }
Exemplo 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();
            }
        }
Exemplo n.º 3
0
        private void Dialog_MacroPackEdit_Load(object sender, EventArgs e)
        {
            IconExtractor ie = new IconExtractor("Lib\\IconSet.dll");
            ImageList     il = new ImageList();

            il.Images.Add(ie.GetIcon((int)FileAssociation.IconIndex.Icon_Macros).ToBitmap());
            listBox_macroses.ImageList = il;
            comboBox_bdrate.Items.AddRange(BdRate.GetNamesStrings());
            comboBox_portname.Items.AddRange(ComPortName.GetNamesStrings());
            comboBox_macro_keybind.Items.AddRange(Enum.GetNames(typeof(Key)));
            for (int i = 30; i <= 256; i++)
            {
                comboBox_macro_charbind.Items.Add((char)i);
            }
            main = new MacroPack(
                TB.L.Phrase["Form_MacroPack.NoName"],
                TB.L.Phrase["Form_MacroPack.NoDiscr"],
                TB.L.Phrase["Form_MacroPack.NoName"]);
            UpDateGeneralSettings();
        }