private void InitializeForm()
        {
            dbMgr = new DBManager();

            comboBoxDeviceAddress.DataSource = Enum.GetValues(typeof(DeviceAddresses));
            if (dbMgr.OpenConfig(configFileName))
            {
                ArrayList deviceCommandList = dbMgr.GetAvailableCommands(comboBoxDeviceAddress.SelectedValue.ToString());
                comboBoxCommand.DataSource = deviceCommandList;
            }

            for (int i = 0; i < 12; i++)
            {
                CustomByteData customBytedata = new CustomByteData();
                //
                // customByteData
                //

                customBytedata.Location           = new System.Drawing.Point(27, 200 + i * 30);
                customBytedata.Name               = "customByteData1";
                customBytedata.Size               = new System.Drawing.Size(500, 37);
                customBytedata.TabIndex           = 6 + i;
                customBytedata.TxtDataDescription = "";
                dataBytes.Add(customBytedata);
                this.Controls.Add(customBytedata);
            }
            try
            {
                comboBoxCommand.SelectedIndex = comboBoxCommand.Items.Count - 1;
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        private void AWGSettings_Load(object sender, System.EventArgs e)
        {
            dbMgr = new DBManager();

            if (dbMgr.OpenConfig(configFilePath))
            {
                // read last configuration
                SetRS232Settings();
            }
        }
Exemplo n.º 3
0
        private void FillCommandBox()
        {
            dbMgr = new DBManager();
            dbMgr.OpenConfig(configFileName);
            ArrayList deviceCommandList = dbMgr.GetAvailableCommands(comboBoxDeviceType.Text);

            comboBoxCommand.DataSource = null;
            comboBoxCommand.DataSource = deviceCommandList;
            // comboBoxCommand.Sorted = true;
        }
Exemplo n.º 4
0
        private void buttonAddToShortcut_Click(object sender, EventArgs e)
        {
            AddToShortcutForm addButtonFrm = new AddToShortcutForm();

            addButtonFrm.ShowDialog();

            if (addButtonFrm.DialogResult == DialogResult.OK)
            {
                int buttonId = addButtonFrm.SelectedButtonIndex + 1;

                string    buttonText = addButtonFrm.ButtonText;
                ArrayList databytes  = new ArrayList();

                databytes = sendDataDisplay1.GetDataByteValues();
                string device  = comboBoxDeviceType.Text;
                string command = comboBoxCommand.Text;
                command = command.Remove(0, 2);
                switch (buttonId)
                {
                case 1:
                {
                    shortcutButton1.Text = buttonText;
                    break;
                }

                case 2:
                {
                    shortcutButton2.Text = buttonText;
                    break;
                }

                case 3:
                {
                    shortcutButton3.Text = buttonText;
                    break;
                }

                case 4:
                {
                    shortcutButton4.Text = buttonText;
                    break;
                }

                case 5:
                {
                    shortcutButton5.Text = buttonText;
                    break;
                }
                }
                v25controller.AddToButton(buttonId.ToString(), buttonText, device, command, databytes);
                dbMgr = new DBManager();
                dbMgr.OpenConfig(configFileName);
            }
        }
Exemplo n.º 5
0
 public void FillInitialPollingQ()
 {
     dbMgr       = new DBManager();
     pollingList = new ArrayList();
     if (dbMgr.OpenConfig(configFileName))
     {
         string[] pollingQ = dbMgr.GetPollingListData();
         for (int i = 0; i < pollingQ.Length; i++)
         {
             string[] pollingCmd = pollingQ[i].Split(new char[] { ',' });
             byte[]   cmd        = new byte[pollingCmd.Length];
             for (int j = 0; j < pollingCmd.Length; j++)
             {
                 cmd[j] = Convert.ToByte(pollingCmd[j]);
             }
             pollingList.Add(cmd);
         }
     }
 }
Exemplo n.º 6
0
        public void RefreshAll(string deviceAddress, string command)
        {
            dbMgr = new DBManager();
            Controls.Clear();
            dataBytes = new ArrayList();

            if (dbMgr.OpenConfig(configFilePath))
            {
                int      Id             = dbMgr.GetDeviceId(deviceAddress, command);
                object[] sendPacketData = dbMgr.ReadSendPacketData(Id);

                for (int i = 0; i < sendPacketData.Length; i++)
                {
                    string dataTagType    = (((object[])sendPacketData[i])[4].ToString());
                    string dataTypeNibble = ByteDataTag.EightBitNibble.ToString();

                    if (dataTagType == ByteDataTag.EightBitSingle.ToString())
                    {
                        UserInputData userInputData1 = new V25Emulator.UserInputData();
                        userInputData1.LabelName = (string)(((object [])sendPacketData[i])[1]);

                        if (i > 0)
                        {
                            if (((object[])sendPacketData[i - 1])[4].ToString() == dataTypeNibble)
                            {
                                userInputData1.Location = new System.Drawing.Point(20, 10 + 30 * (i - 1));
                            }
                            else
                            {
                                userInputData1.Location = new System.Drawing.Point(20, 10 + 30 * i);
                            }
                        }
                        else
                        {
                            userInputData1.Location = new System.Drawing.Point(20, 10 + 30 * i);
                        }
                        userInputData1.Name        = "userInputData1";
                        userInputData1.Size        = new System.Drawing.Size(205, 34);
                        userInputData1.TabIndex    = 0;
                        userInputData1.TextBoxData = "";
                        dataBytes.Add(userInputData1);
                        Controls.Add(userInputData1);
                    }
                    else
                    if (dataTagType == dataTypeNibble && (((object[])sendPacketData[i + 1])[4].ToString()) == dataTypeNibble)
                    {
                        UserInputData userInputData1 = new V25Emulator.UserInputData();
                        userInputData1.LabelName = (string)(((object[])sendPacketData[i])[1]);

                        if (dataBytes.Count >= 1)
                        {
                            userInputData1.Location = new System.Drawing.Point(20, ((UserInputData)dataBytes[dataBytes.Count - 1]).Location.Y + 30);
                        }
                        else
                        {
                            userInputData1.Location = new System.Drawing.Point(20, 10 + 30 * i);
                        }
                        userInputData1.Name        = "userInputData1";
                        userInputData1.Size        = new System.Drawing.Size(205, 34);
                        userInputData1.TabIndex    = 0;
                        userInputData1.TextBoxData = "";
                        dataBytes.Add(userInputData1);
                        Controls.Add(userInputData1);
                        i++;
                    }
                }
            }
        }