Exemplo n.º 1
0
        private void Form_SerialMonitor_Load(object sender, System.EventArgs e)
        {
            foreach (var item in Enum.GetValues(typeof(CommandType)))
            {
                var    name  = Enum.GetName(typeof(CommandType), item);
                UInt32 itemI = (UInt32)item;
                comboBox_command.Items.Add(string.Format("{0} - 0x{1}", name, itemI.ToString("X").Trim()));
            }

            foreach (var item in Enum.GetValues(typeof(CWA.DTP.Plotter.CommandType)))
            {
                var    name  = Enum.GetName(typeof(CWA.DTP.Plotter.CommandType), item);
                UInt32 itemI = (UInt32)item;
                comboBox_command.Items.Add(string.Format("{0} - 0x{1}", name, itemI.ToString("X").Trim()));
            }


            comboBox_command.SelectedIndex = 1;
            comboBox_sender.Items.AddRange(Enum.GetNames(typeof(SenderType)));
            comboBox_sender.SelectedIndex = 0;
            comboBox_conv.Items.AddRange(new string[] {
                "UInt16 To Bytes",
                "Int16 To Bytes",
                "UInt32 To Bytes",
                "Int32 To Bytes",
                "UInt64 To Bytes",
                "Int64 To Bytes",
                "Float To Bytes",
                "Double To Bytes",
                "String To Bytes",
            });
            comboBox_port.Items.Clear();
            comboBox_port.Items.AddRange(SerialPort.GetPortNames());
            comboBox_bd.Items.AddRange(BdRate.GetNamesStrings());
        }
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
 /// <summary>
 /// Создает новый экземпляр класса <see cref="MacroPack"/>.
 /// </summary>
 /// <param name="name">Имя пака.</param>
 /// <param name="discr">Описание пака.</param>
 /// <param name="caption">Отображаемое имя.</param>
 public MacroPack(string name, string discr, string caption)
 {
     Name     = name;
     Discr    = discr;
     Caption  = caption;
     Elems    = new List <MacroPackElem>();
     PortName = new ComPortName(GlobalOptions.Mainport);
     Samples  = new List <string>();
     PortBD   = new BdRate(GlobalOptions.Mainbd);
 }
Exemplo n.º 4
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();
        }