Esempio n. 1
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);
 }
Esempio n. 2
0
 private void PopulateComPortsComboBox(bool showAll = false)
 {
     ComPortName.BeginUpdate();
     comPortDescriptors?.Clear();
     comPortDescriptors        = EnumerateComPorts(showAll).ToList();
     ComPortName.DataSource    = comPortDescriptors;
     ComPortName.DisplayMember = "Caption";
     ComPortName.ValueMember   = "PortName";
     ComPortName.EndUpdate();
     ComPortName.Invalidate();
 }
Esempio 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();
        }
Esempio n. 4
0
        /// <summary>
        /// Verifies if a valid ComPortName has been set and if the number of outputs per channel is >=0.
        /// </summary>
        /// <returns>
        ///   <c>true</c> if the verification is OK, otherwise <c>false</c>
        /// </returns>
        protected override bool VerifySettings()
        {
            if (ComPortName.IsNullOrWhiteSpace())
            {
                Log.Warning("The ComPortName has not been specified");
                return(false);
            }

            if (!SerialPort.GetPortNames().Any(PN => PN == ComPortName))
            {
                Log.Warning("The specified Com-Port {0} was not found. Available com-ports: {1}".Build(ComPortName, string.Join(", ", SerialPort.GetPortNames())));
                return(false);
            }

            if (NumberOfLedsPerStrip.Any(Nr => Nr < 0))
            {
                Log.Warning("At least one ledstrip has a invalid number of leds specified (<0).");
                return(false);
            }
            return(true);
        }