public void AddPerfil()
        {
            dynamic form = Activator.CreateInstance(UsbMode.FindType("DisplayButtons.Forms.PerfilEditor")) as Form;

            if (form.ShowDialog() == DialogResult.OK)
            {
                Profile teste = new Profile();
                teste.Name       = form.textBox1.Text;
                teste.Mainfolder = new DynamicDeckFolder();
                //  teste.Currentfolder = teste.Mainfolder;
                if (DevicePersistManager.PersistedDevices.Count == 0)
                {
                    foreach (var device_con in DevicePersistManager.DeckDevicesFromConnection)
                    {
                        device_con.Value.profiles.Add(teste);
                    }
                }
                else
                {
                    foreach (var device in DevicePersistManager.PersistedDevices.ToList())
                    {
                        device.profiles.Add(teste);
                    }
                }
                MainForm.Instance.FillPerfil();
            }
            else
            {
                form.Close();
            }
        }
Пример #2
0
        private void ModernButton11_Click(object sender, EventArgs e)
        {
            var     keyInfo = new KeyInfoAppSettingsGlobal(ApplicationSettingsManager.Settings.keyMainFolder.ModifierKeys, ApplicationSettingsManager.Settings.keyMainFolder.Keys);
            dynamic form    = Activator.CreateInstance(UsbMode.FindType("DisplayButtons.Forms.ActionHelperForms.MagnetiteControlsSelector")) as Form;

            var execAction = new AppSettings() as AppSettings;

            execAction.keyMainFolder = ApplicationSettingsManager.Settings.keyMainFolder;
            form.mode             = 0;
            form.ModifiableAction = execAction;

            if (form.ShowDialog() == DialogResult.OK)
            {
                ApplicationSettingsManager.Settings.keyMainFolder = form.ModifiableAction.keyMainFolder;
            }
            else
            {
                ApplicationSettingsManager.Settings.keyMainFolder = keyInfo;
            }
        }
Пример #3
0
        public int SetUsbMode(UsbMode mode)
        {
            //return SetMode("1S", (int)mode);
            int ret = WritePacket(true, PktType.SI, Encoding.ASCII.GetBytes("1S"), Encoding.ASCII.GetBytes("" + (int)mode));

            if (ret != 0)
            {
                return(ret);
            }
            ret = ReadByte();
            if (ret == EOT)
            {
                return(PacketNotAccepted);           //Packet was accepted by device, go on
            }
            byte[] Recv = null;
            ret = ReadPacket(out Recv, PktType.SI);
            if (ret < 0)
            {
                return(ret);
            }
            if (!CheckEOT(2000))
            {
                return(ReadEOTTimeOut);
            }
            Recv = new List <byte>(Recv).GetRange(0, 3).ToArray();
            if (Recv == null || Recv.Length != 3)
            {
                return(ExecFail);
            }
            if (Recv[2] == '0')
            {
                return(ret > 0 ? 0 : ret);
            }
            else
            {
                return(ExecFail);
            }
            //if (Recv.SequenceEqual(Encoding.ASCII.GetBytes(cmd + mode))) return ret > 0 ? 0 : ret;
            //else return ExecFail;
        }
Пример #4
0
        //type = 0 is trigger
        // type = 1 is action
        public void ToExecuteFormGeneral(int type)
        {
            dynamic form = Activator.CreateInstance(UsbMode.FindType("DisplayButtons.Forms.EventSystem.EventCreateNew")) as Form;

            form.FillComboBox(type);
            if (form.ShowDialog() == DialogResult.OK)
            {
                if (type == 0)
                {
                    form.global_panelControl.SaveConfig();
                    new FactoryForms().SaveButtonTrigger(form.global_panelControl.getClassImplementTrigger);
                }
                if (type == 1)
                {
                    form.global_panelControl.SaveConfig();
                    new FactoryForms().SaveButtonAction(form.global_panelControl.getClassImplementAction);
                }
            }
            else
            {
                form.Close();
            }
        }
Пример #5
0
 /// <summary>
 /// Sets the status of usb mode property that determine if usb mode is disk or bulk.
 /// You can choose between Disk mode, which is used as a removable disk, and Bulk mode, which is capable of high volume data communication, when connected with usb
 /// </summary>
 /// <param name="mode">enum of UsbMode</param>
 public void SetUsbMode(UsbMode mode)
 {
     Request(null, () => mClientV2.ReqSetupUsbMode(mode));
 }