public static void RestoreForm(Form form, string tablename, bool restore_size)
        {
            ArrayList temp = new ArrayList();                           // list of all first level controls

            //int VUskip = 0;
            ControlList(form, ref temp);

            ArrayList checkbox_list      = new ArrayList();
            ArrayList combobox_list      = new ArrayList();
            ArrayList numericupdown_list = new ArrayList();
            ArrayList radiobutton_list   = new ArrayList();
            ArrayList textbox_list       = new ArrayList();
            ArrayList trackbar_list      = new ArrayList();
            ArrayList colorbutton_list   = new ArrayList();

            //ArrayList controls = new ArrayList();	// list of controls to restore
            foreach (Control c in temp)
            {
                if (c.GetType() == typeof(CheckBoxTS))                  // the control is a CheckBoxTS
                {
                    checkbox_list.Add(c);
                }
                else if (c.GetType() == typeof(ComboBoxTS))             // the control is a ComboBox
                {
                    combobox_list.Add(c);
                }
                else if (c.GetType() == typeof(NumericUpDownTS))// the control is a NumericUpDown
                {
                    numericupdown_list.Add(c);
                }
                else if (c.GetType() == typeof(RadioButtonTS))  // the control is a RadioButton
                {
                    radiobutton_list.Add(c);
                }
                else if (c.GetType() == typeof(TextBoxTS))              // the control is a TextBox
                {
                    textbox_list.Add(c);
                }
                else if (c.GetType() == typeof(TrackBarTS))             // the control is a TrackBar (slider)
                {
                    trackbar_list.Add(c);
                }
                else if (c.GetType() == typeof(ColorButton))
                {
                    colorbutton_list.Add(c);
                }
            }



            temp.Clear();                        // now that we have the controls we want, delete first list

            ArrayList a = DB.GetVars(tablename); // Get the saved list of controls

            a.Sort();

            // restore saved values to the controls
            foreach (string s in a)                                     // string is in the format "name,value"
            {
                string[] vals = s.Split('/');
                if (vals.Length > 2)
                {
                    for (int i = 2; i < vals.Length; i++)
                    {
                        vals[1] += "/" + vals[i];
                    }
                }

                string name = vals[0];
                string val  = vals[1];

                switch (name)
                {
                case "Top":
                    form.StartPosition = FormStartPosition.Manual;
                    int top = int.Parse(val);

                    /*if(top < 0) top = 0;
                     * if(top > Screen.PrimaryScreen.Bounds.Height-form.Height && Screen.AllScreens.Length == 1)
                     *      top = Screen.PrimaryScreen.Bounds.Height-form.Height;*/
                    form.Top = top;
                    break;

                case "Left":
                    form.StartPosition = FormStartPosition.Manual;
                    int left = int.Parse(val);

                    /*if(left < 0) left = 0;
                     * if(left > Screen.PrimaryScreen.Bounds.Width-form.Width && Screen.AllScreens.Length == 1)
                     *      left = Screen.PrimaryScreen.Bounds.Width-form.Width;*/
                    form.Left = left;
                    break;

                case "Width":
                    if (restore_size)
                    {
                        int width = int.Parse(val);

                        /*if(width + form.Left > Screen.PrimaryScreen.Bounds.Width && Screen.AllScreens.Length == 1)
                         *      form.Left -= (width+form.Left-Screen.PrimaryScreen.Bounds.Width);*/
                        form.Width = width;
                    }
                    break;

                case "Height":
                    if (restore_size)
                    {
                        int height = int.Parse(val);

                        /*if(height + form.Top > Screen.PrimaryScreen.Bounds.Height && Screen.AllScreens.Length == 1)
                         *      form.Top -= (height+form.Top-Screen.PrimaryScreen.Bounds.Height);*/
                        form.Height = height;
                    }
                    break;
                }

                if (s.StartsWith("chk"))                                // control is a CheckBoxTS
                {
                    for (int i = 0; i < checkbox_list.Count; i++)
                    {                                    // look through each control to find the matching name
                        CheckBoxTS c = (CheckBoxTS)checkbox_list[i];
                        if (c.Name.Equals(name))         // name found
                        {
                            c.Checked = bool.Parse(val); // restore value
                            i         = checkbox_list.Count + 1;
                        }
                        if (i == checkbox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("combo"))                 // control is a ComboBox
                {
                    for (int i = 0; i < combobox_list.Count; i++)
                    {                            // look through each control to find the matching name
                        ComboBoxTS c = (ComboBoxTS)combobox_list[i];
                        if (c.Name.Equals(name)) // name found
                        {
                            c.Text = val;        // restore value
                            i      = combobox_list.Count + 1;
                            if (c.Text != val)
                            {
                                Debug.WriteLine("Warning: " + form.Name + "." + name + " did not set to " + val);
                            }
                        }
                        if (i == combobox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("ud"))
                {
                    for (int i = 0; i < numericupdown_list.Count; i++)
                    {                            // look through each control to find the matching name
                        NumericUpDownTS c = (NumericUpDownTS)numericupdown_list[i];
                        if (c.Name.Equals(name)) // name found
                        {
                            decimal num = decimal.Parse(val);

                            if (num > c.Maximum)
                            {
                                num = c.Maximum;                                                        // check endpoints
                            }
                            else if (num < c.Minimum)
                            {
                                num = c.Minimum;
                            }
                            c.Value = num;                                              // restore value
                            i       = numericupdown_list.Count + 1;
                        }
                        if (i == numericupdown_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("rad"))
                {                       // look through each control to find the matching name
                    for (int i = 0; i < radiobutton_list.Count; i++)
                    {
                        RadioButtonTS c = (RadioButtonTS)radiobutton_list[i];
                        if (c.Name.Equals(name))                                // name found
                        {
                            if (!val.ToLower().Equals("true") && !val.ToLower().Equals("false"))
                            {
                                val = "True";
                            }
                            c.Checked = bool.Parse(val);                                // restore value
                            i         = radiobutton_list.Count + 1;
                        }
                        if (i == radiobutton_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("txt"))
                {                       // look through each control to find the matching name
                    for (int i = 0; i < textbox_list.Count; i++)
                    {
                        TextBoxTS c = (TextBoxTS)textbox_list[i];
                        if (c.Name.Equals(name))                        // name found
                        {
                            c.Text = val;                               // restore value
                            i      = textbox_list.Count + 1;
                        }
                        if (i == textbox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("tb"))
                {
                    // look through each control to find the matching name
                    for (int i = 0; i < trackbar_list.Count; i++)
                    {
                        TrackBarTS c = (TrackBarTS)trackbar_list[i];
                        if (c.Name.Equals(name))                                // name found
                        {
                            int num = int.Parse(val);
                            if (num > c.Maximum)
                            {
                                num = c.Maximum;
                            }
                            if (num < c.Minimum)
                            {
                                num = c.Minimum;
                            }
                            c.Value = num;
                            i       = trackbar_list.Count + 1;
                        }
                        if (i == trackbar_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("clrbtn"))
                {
                    string[] colors = val.Split('.');
                    if (colors.Length == 4)
                    {
                        int R, G, B, A;
                        R = Int32.Parse(colors[0]);
                        G = Int32.Parse(colors[1]);
                        B = Int32.Parse(colors[2]);
                        A = Int32.Parse(colors[3]);

                        for (int i = 0; i < colorbutton_list.Count; i++)
                        {
                            ColorButton c = (ColorButton)colorbutton_list[i];
                            if (c.Name.Equals(name))                                    // name found
                            {
                                c.Color = Color.FromArgb(A, R, G, B);
                                i       = colorbutton_list.Count + 1;
                            }
                            if (i == colorbutton_list.Count)
                            {
                                MessageBox.Show("Control not found: " + name);
                            }
                        }
                    }
                }
            }

            ForceFormOnScreen(form);
        }
Beispiel #2
0
        public void RestoreSettings()
        {
            ArrayList temp = new ArrayList();                           // list of all first level controls

            ControlList(this, ref temp);

            ArrayList checkbox_list      = new ArrayList();
            ArrayList combobox_list      = new ArrayList();
            ArrayList numericupdown_list = new ArrayList();
            ArrayList radiobutton_list   = new ArrayList();
            ArrayList textbox_list       = new ArrayList();
            ArrayList trackbar_list      = new ArrayList();
            ArrayList colorbutton_list   = new ArrayList();

            //ArrayList controls = new ArrayList();	// list of controls to restore
            foreach (Control c in temp)
            {
                if (c.GetType() == typeof(CheckBoxTS))                                  // the control is a CheckBoxTS
                {
                    checkbox_list.Add(c);
                }
                else if (c.GetType() == typeof(ComboBoxTS))                             // the control is a ComboBox
                {
                    combobox_list.Add(c);
                }
                else if (c.GetType() == typeof(NumericUpDownTS))                // the control is a NumericUpDown
                {
                    numericupdown_list.Add(c);
                }
                else if (c.GetType() == typeof(RadioButtonTS))                  // the control is a RadioButton
                {
                    radiobutton_list.Add(c);
                }
                else if (c.GetType() == typeof(TextBoxTS))                              // the control is a TextBox
                {
                    textbox_list.Add(c);
                }
                else if (c.GetType() == typeof(TrackBarTS))                             // the control is a TrackBar (slider)
                {
                    trackbar_list.Add(c);
                }
                else if (c.GetType() == typeof(ColorButton))
                {
                    colorbutton_list.Add(c);
                }
            }
            temp.Clear();                       // now that we have the controls we want, delete first list

            ArrayList a = DB.GetVars("EQForm"); // Get the saved list of controls

            a.Sort();

            // restore saved values to the controls
            foreach (string s in a)                                     // string is in the format "name,value"
            {
                string[] vals = s.Split('/');
                if (vals.Length > 2)
                {
                    for (int i = 2; i < vals.Length; i++)
                    {
                        vals[1] += "/" + vals[i];
                    }
                }

                string name = vals[0];
                string val  = vals[1];

                if (s.StartsWith("chk"))                                // control is a CheckBoxTS
                {
                    for (int i = 0; i < checkbox_list.Count; i++)
                    {                                    // look through each control to find the matching name
                        CheckBoxTS c = (CheckBoxTS)checkbox_list[i];
                        if (c.Name.Equals(name))         // name found
                        {
                            c.Checked = bool.Parse(val); // restore value
                            i         = checkbox_list.Count + 1;
                        }
                        if (i == checkbox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("combo"))                 // control is a ComboBox
                {
                    for (int i = 0; i < combobox_list.Count; i++)
                    {                            // look through each control to find the matching name
                        ComboBoxTS c = (ComboBoxTS)combobox_list[i];
                        if (c.Name.Equals(name)) // name found
                        {
                            c.Text = val;        // restore value
                            i      = combobox_list.Count + 1;
                        }
                        if (i == combobox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("ud"))
                {
                    for (int i = 0; i < numericupdown_list.Count; i++)
                    {                            // look through each control to find the matching name
                        NumericUpDownTS c = (NumericUpDownTS)numericupdown_list[i];
                        if (c.Name.Equals(name)) // name found
                        {
                            decimal num = decimal.Parse(val);

                            if (num > c.Maximum)
                            {
                                num = c.Maximum;                                                        // check endpoints
                            }
                            else if (num < c.Minimum)
                            {
                                num = c.Minimum;
                            }
                            c.Value = num;                                              // restore value
                            i       = numericupdown_list.Count + 1;
                        }
                        if (i == numericupdown_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("rad"))
                {                       // look through each control to find the matching name
                    for (int i = 0; i < radiobutton_list.Count; i++)
                    {
                        RadioButtonTS c = (RadioButtonTS)radiobutton_list[i];
                        if (c.Name.Equals(name))                                // name found
                        {
                            if (!val.ToLower().Equals("true") && !val.ToLower().Equals("false"))
                            {
                                val = "True";
                            }
                            c.Checked = bool.Parse(val);                                // restore value
                            i         = radiobutton_list.Count + 1;
                        }
                        if (i == radiobutton_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("txt"))
                {                       // look through each control to find the matching name
                    for (int i = 0; i < textbox_list.Count; i++)
                    {
                        TextBoxTS c = (TextBoxTS)textbox_list[i];
                        if (c.Name.Equals(name))                        // name found
                        {
                            c.Text = val;                               // restore value
                            i      = textbox_list.Count + 1;
                        }
                        if (i == textbox_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("tb"))
                {
                    // look through each control to find the matching name
                    for (int i = 0; i < trackbar_list.Count; i++)
                    {
                        TrackBarTS c = (TrackBarTS)trackbar_list[i];
                        if (c.Name.Equals(name))                                // name found
                        {
                            c.Value = Int32.Parse(val);
                            i       = trackbar_list.Count + 1;
                        }
                        if (i == trackbar_list.Count)
                        {
                            MessageBox.Show("Control not found: " + name);
                        }
                    }
                }
                else if (s.StartsWith("clrbtn"))
                {
                    string[] colors = val.Split('.');
                    if (colors.Length == 4)
                    {
                        int R, G, B, A;
                        R = Int32.Parse(colors[0]);
                        G = Int32.Parse(colors[1]);
                        B = Int32.Parse(colors[2]);
                        A = Int32.Parse(colors[3]);

                        for (int i = 0; i < colorbutton_list.Count; i++)
                        {
                            ColorButton c = (ColorButton)colorbutton_list[i];
                            if (c.Name.Equals(name))                                    // name found
                            {
                                c.Color = Color.FromArgb(A, R, G, B);
                                i       = colorbutton_list.Count + 1;
                            }
                            if (i == colorbutton_list.Count)
                            {
                                MessageBox.Show("Control not found: " + name);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HIDAntForm));
     this.toolTip1          = new System.Windows.Forms.ToolTip(this.components);
     this.radModeSimple     = new System.Windows.Forms.RadioButtonTS();
     this.radModeExpert     = new System.Windows.Forms.RadioButtonTS();
     this.chkLock           = new System.Windows.Forms.CheckBoxTS();
     this.comboRXAnt        = new System.Windows.Forms.ComboBoxTS();
     this.comboTXAnt        = new System.Windows.Forms.ComboBoxTS();
     this.udTX1Delay        = new System.Windows.Forms.NumericUpDownTS();
     this.chkTX1DelayEnable = new System.Windows.Forms.CheckBoxTS();
     this.chkPTTOutEnable   = new System.Windows.Forms.CheckBoxTS();
     this.txtStatus         = new System.Windows.Forms.TextBoxTS();
     this.grpMode           = new System.Windows.Forms.GroupBoxTS();
     this.lblBand           = new System.Windows.Forms.LabelTS();
     this.comboBand         = new System.Windows.Forms.ComboBoxTS();
     this.grpAntenna        = new System.Windows.Forms.GroupBoxTS();
     this.lblTX             = new System.Windows.Forms.LabelTS();
     this.lblRX1            = new System.Windows.Forms.LabelTS();
     this.grpFlexWirePTTOut = new System.Windows.Forms.GroupBoxTS();
     this.textBoxTS1        = new System.Windows.Forms.TextBoxTS();
     ((System.ComponentModel.ISupportInitialize)(this.udTX1Delay)).BeginInit();
     this.grpMode.SuspendLayout();
     this.grpAntenna.SuspendLayout();
     this.grpFlexWirePTTOut.SuspendLayout();
     this.SuspendLayout();
     //
     // radModeSimple
     //
     this.radModeSimple.Checked  = true;
     this.radModeSimple.Image    = null;
     this.radModeSimple.Location = new System.Drawing.Point(16, 24);
     this.radModeSimple.Name     = "radModeSimple";
     this.radModeSimple.Size     = new System.Drawing.Size(64, 24);
     this.radModeSimple.TabIndex = 16;
     this.radModeSimple.TabStop  = true;
     this.radModeSimple.Text     = "Simple";
     this.toolTip1.SetToolTip(this.radModeSimple, "One setting for all bands");
     this.radModeSimple.CheckedChanged += new System.EventHandler(this.radModeSimple_CheckedChanged);
     //
     // radModeExpert
     //
     this.radModeExpert.Image    = null;
     this.radModeExpert.Location = new System.Drawing.Point(96, 24);
     this.radModeExpert.Name     = "radModeExpert";
     this.radModeExpert.Size     = new System.Drawing.Size(56, 24);
     this.radModeExpert.TabIndex = 20;
     this.radModeExpert.Text     = "Expert";
     this.toolTip1.SetToolTip(this.radModeExpert, "More settings for each individual band");
     this.radModeExpert.CheckedChanged += new System.EventHandler(this.radModeExpert_CheckedChanged);
     //
     // chkLock
     //
     this.chkLock.Checked    = true;
     this.chkLock.CheckState = System.Windows.Forms.CheckState.Checked;
     this.chkLock.Image      = null;
     this.chkLock.Location   = new System.Drawing.Point(192, 38);
     this.chkLock.Name       = "chkLock";
     this.chkLock.Size       = new System.Drawing.Size(64, 24);
     this.chkLock.TabIndex   = 16;
     this.chkLock.Text       = "Lock";
     this.toolTip1.SetToolTip(this.chkLock, "Check this box to lock RX1 and TX antenna selections.");
     this.chkLock.CheckedChanged += new System.EventHandler(this.chkLock_CheckedChanged);
     //
     // comboRXAnt
     //
     this.comboRXAnt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboRXAnt.DropDownWidth = 64;
     this.comboRXAnt.Items.AddRange(new object[] {
         "PA",
         "XVTX/COM",
         "XVRX"
     });
     this.comboRXAnt.Location = new System.Drawing.Point(8, 40);
     this.comboRXAnt.Name     = "comboRXAnt";
     this.comboRXAnt.Size     = new System.Drawing.Size(80, 21);
     this.comboRXAnt.TabIndex = 10;
     this.toolTip1.SetToolTip(this.comboRXAnt, "Selects the Main Receiver Antenna");
     this.comboRXAnt.SelectedIndexChanged += new System.EventHandler(this.comboRXAnt_SelectedIndexChanged);
     //
     // comboTXAnt
     //
     this.comboTXAnt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboTXAnt.DropDownWidth = 64;
     this.comboTXAnt.Items.AddRange(new object[] {
         "PA",
         "XVTX/COM"
     });
     this.comboTXAnt.Location = new System.Drawing.Point(93, 40);
     this.comboTXAnt.Name     = "comboTXAnt";
     this.comboTXAnt.Size     = new System.Drawing.Size(80, 21);
     this.comboTXAnt.TabIndex = 12;
     this.toolTip1.SetToolTip(this.comboTXAnt, "Selects the Transmitter Antenna");
     this.comboTXAnt.SelectedIndexChanged += new System.EventHandler(this.comboTXAnt_SelectedIndexChanged);
     //
     // udTX1Delay
     //
     this.udTX1Delay.Enabled   = false;
     this.udTX1Delay.Increment = new decimal(new int[] {
         1,
         0,
         0,
         0
     });
     this.udTX1Delay.Location = new System.Drawing.Point(184, 23);
     this.udTX1Delay.Maximum  = new decimal(new int[] {
         9999,
         0,
         0,
         0
     });
     this.udTX1Delay.Minimum = new decimal(new int[] {
         1,
         0,
         0,
         0
     });
     this.udTX1Delay.Name     = "udTX1Delay";
     this.udTX1Delay.Size     = new System.Drawing.Size(56, 20);
     this.udTX1Delay.TabIndex = 4;
     this.toolTip1.SetToolTip(this.udTX1Delay, resources.GetString("udTX1Delay.ToolTip"));
     this.udTX1Delay.Value = new decimal(new int[] {
         1,
         0,
         0,
         0
     });
     this.udTX1Delay.ValueChanged += new System.EventHandler(this.udTX1Delay_ValueChanged);
     //
     // chkTX1DelayEnable
     //
     this.chkTX1DelayEnable.Image    = null;
     this.chkTX1DelayEnable.Location = new System.Drawing.Point(101, 16);
     this.chkTX1DelayEnable.Name     = "chkTX1DelayEnable";
     this.chkTX1DelayEnable.Size     = new System.Drawing.Size(77, 32);
     this.chkTX1DelayEnable.TabIndex = 3;
     this.chkTX1DelayEnable.Text     = "Delay (ms)";
     this.toolTip1.SetToolTip(this.chkTX1DelayEnable, "When checked, Pin 3 on the FlexWire Connector will delay before switching on TR t" +
                              "ransitions by the amount selected in milliseconds.");
     this.chkTX1DelayEnable.CheckedChanged += new System.EventHandler(this.chkTX1DelayEnable_CheckedChanged);
     //
     // chkPTTOutEnable
     //
     this.chkPTTOutEnable.Checked    = true;
     this.chkPTTOutEnable.CheckState = System.Windows.Forms.CheckState.Checked;
     this.chkPTTOutEnable.Image      = null;
     this.chkPTTOutEnable.Location   = new System.Drawing.Point(16, 16);
     this.chkPTTOutEnable.Name       = "chkPTTOutEnable";
     this.chkPTTOutEnable.Size       = new System.Drawing.Size(79, 32);
     this.chkPTTOutEnable.TabIndex   = 0;
     this.chkPTTOutEnable.Text       = "Enable";
     this.toolTip1.SetToolTip(this.chkPTTOutEnable, "When checked, Pin 3 on the FlexWire Connector will switch with TR transitions.  T" +
                              "his can be used to switch an external linear, transverter, preselector, etc.");
     this.chkPTTOutEnable.CheckedChanged += new System.EventHandler(this.chkRCATX1_CheckedChanged);
     //
     // txtStatus
     //
     this.txtStatus.Location = new System.Drawing.Point(4, 255);
     this.txtStatus.Name     = "txtStatus";
     this.txtStatus.ReadOnly = true;
     this.txtStatus.Size     = new System.Drawing.Size(264, 20);
     this.txtStatus.TabIndex = 23;
     this.txtStatus.Text     = "Simple Mode: Settings are applied to all bands";
     //
     // grpMode
     //
     this.grpMode.Controls.Add(this.radModeSimple);
     this.grpMode.Controls.Add(this.radModeExpert);
     this.grpMode.Controls.Add(this.lblBand);
     this.grpMode.Controls.Add(this.comboBand);
     this.grpMode.Location = new System.Drawing.Point(8, 8);
     this.grpMode.Name     = "grpMode";
     this.grpMode.Size     = new System.Drawing.Size(264, 56);
     this.grpMode.TabIndex = 21;
     this.grpMode.TabStop  = false;
     this.grpMode.Text     = "Mode";
     //
     // lblBand
     //
     this.lblBand.Image     = null;
     this.lblBand.Location  = new System.Drawing.Point(160, 24);
     this.lblBand.Name      = "lblBand";
     this.lblBand.Size      = new System.Drawing.Size(40, 24);
     this.lblBand.TabIndex  = 19;
     this.lblBand.Text      = "Band:";
     this.lblBand.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
     this.lblBand.Visible   = false;
     //
     // comboBand
     //
     this.comboBand.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     this.comboBand.DropDownWidth = 56;
     this.comboBand.Items.AddRange(new object[] {
         "GEN",
         "160m",
         "80m",
         "60m",
         "40m",
         "30m",
         "20m",
         "17m",
         "15m",
         "12m",
         "10m",
         "6m",
         "2m",
         "WWV",
         "VHF0",
         "VHF1",
         "VHF2",
         "VHF3",
         "VHF4",
         "VHF5",
         "VHF6",
         "VHF7",
         "VHF8",
         "VHF9",
         "VHF10",
         "VHF11",
         "VHF12",
         "VHF13"
     });
     this.comboBand.Location              = new System.Drawing.Point(200, 24);
     this.comboBand.Name                  = "comboBand";
     this.comboBand.Size                  = new System.Drawing.Size(56, 21);
     this.comboBand.TabIndex              = 18;
     this.comboBand.Visible               = false;
     this.comboBand.SelectedIndexChanged += new System.EventHandler(this.comboBand_SelectedIndexChanged);
     //
     // grpAntenna
     //
     this.grpAntenna.Controls.Add(this.chkLock);
     this.grpAntenna.Controls.Add(this.comboRXAnt);
     this.grpAntenna.Controls.Add(this.comboTXAnt);
     this.grpAntenna.Controls.Add(this.lblTX);
     this.grpAntenna.Controls.Add(this.lblRX1);
     this.grpAntenna.Location = new System.Drawing.Point(8, 72);
     this.grpAntenna.Name     = "grpAntenna";
     this.grpAntenna.Size     = new System.Drawing.Size(264, 77);
     this.grpAntenna.TabIndex = 20;
     this.grpAntenna.TabStop  = false;
     this.grpAntenna.Text     = "Antenna";
     //
     // lblTX
     //
     this.lblTX.Image    = null;
     this.lblTX.Location = new System.Drawing.Point(93, 24);
     this.lblTX.Name     = "lblTX";
     this.lblTX.Size     = new System.Drawing.Size(64, 16);
     this.lblTX.TabIndex = 13;
     this.lblTX.Text     = "Transmit:";
     //
     // lblRX1
     //
     this.lblRX1.Image    = null;
     this.lblRX1.Location = new System.Drawing.Point(8, 24);
     this.lblRX1.Name     = "lblRX1";
     this.lblRX1.Size     = new System.Drawing.Size(72, 16);
     this.lblRX1.TabIndex = 11;
     this.lblRX1.Text     = "Receive:";
     //
     // grpFlexWirePTTOut
     //
     this.grpFlexWirePTTOut.Controls.Add(this.textBoxTS1);
     this.grpFlexWirePTTOut.Controls.Add(this.udTX1Delay);
     this.grpFlexWirePTTOut.Controls.Add(this.chkTX1DelayEnable);
     this.grpFlexWirePTTOut.Controls.Add(this.chkPTTOutEnable);
     this.grpFlexWirePTTOut.Location = new System.Drawing.Point(8, 155);
     this.grpFlexWirePTTOut.Name     = "grpFlexWirePTTOut";
     this.grpFlexWirePTTOut.Size     = new System.Drawing.Size(264, 94);
     this.grpFlexWirePTTOut.TabIndex = 21;
     this.grpFlexWirePTTOut.TabStop  = false;
     this.grpFlexWirePTTOut.Text     = "FlexWire PTT Out";
     this.grpFlexWirePTTOut.Visible  = false;
     //
     // textBoxTS1
     //
     this.textBoxTS1.Location = new System.Drawing.Point(16, 54);
     this.textBoxTS1.Name     = "textBoxTS1";
     this.textBoxTS1.ReadOnly = true;
     this.textBoxTS1.Size     = new System.Drawing.Size(228, 20);
     this.textBoxTS1.TabIndex = 25;
     this.textBoxTS1.Text     = "Hit F1 for Help on TR Delay";
     this.textBoxTS1.Click   += new System.EventHandler(this.textBoxTS1_Click);
     //
     // HIDAntForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(280, 287);
     this.Controls.Add(this.txtStatus);
     this.Controls.Add(this.grpMode);
     this.Controls.Add(this.grpAntenna);
     this.Controls.Add(this.grpFlexWirePTTOut);
     this.Icon       = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.KeyPreview = true;
     this.Name       = "HIDAntForm";
     this.Text       = "FLEX-1500 Antenna Selection";
     this.Closing   += new System.ComponentModel.CancelEventHandler(this.HIDAntForm_Closing);
     this.KeyDown   += new System.Windows.Forms.KeyEventHandler(this.HIDAntForm_KeyDown);
     ((System.ComponentModel.ISupportInitialize)(this.udTX1Delay)).EndInit();
     this.grpMode.ResumeLayout(false);
     this.grpAntenna.ResumeLayout(false);
     this.grpFlexWirePTTOut.ResumeLayout(false);
     this.grpFlexWirePTTOut.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Beispiel #4
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VFOSettingsPopup));
     this.buttonClose    = new System.Windows.Forms.ButtonTS();
     this.labelTS1       = new System.Windows.Forms.LabelTS();
     this.buttonPlus     = new System.Windows.Forms.ButtonTS();
     this.buttonMinus    = new System.Windows.Forms.ButtonTS();
     this.txtBoxTuneStep = new System.Windows.Forms.TextBoxTS();
     this.SuspendLayout();
     //
     // buttonClose
     //
     this.buttonClose.Font     = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.buttonClose.Image    = null;
     this.buttonClose.Location = new System.Drawing.Point(238, 74);
     this.buttonClose.Name     = "buttonClose";
     this.buttonClose.Size     = new System.Drawing.Size(75, 32);
     this.buttonClose.TabIndex = 4;
     this.buttonClose.Text     = "Close";
     this.buttonClose.UseVisualStyleBackColor = true;
     this.buttonClose.Click += new System.EventHandler(this.ButtonClose_Click);
     //
     // labelTS1
     //
     this.labelTS1.AutoSize  = true;
     this.labelTS1.ForeColor = System.Drawing.SystemColors.ControlLight;
     this.labelTS1.Image     = null;
     this.labelTS1.Location  = new System.Drawing.Point(12, 30);
     this.labelTS1.Name      = "labelTS1";
     this.labelTS1.Size      = new System.Drawing.Size(57, 13);
     this.labelTS1.TabIndex  = 3;
     this.labelTS1.Text      = "Tune Step";
     //
     // buttonPlus
     //
     this.buttonPlus.Font     = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.buttonPlus.Image    = null;
     this.buttonPlus.Location = new System.Drawing.Point(261, 24);
     this.buttonPlus.Name     = "buttonPlus";
     this.buttonPlus.Size     = new System.Drawing.Size(52, 32);
     this.buttonPlus.TabIndex = 2;
     this.buttonPlus.Text     = "+";
     this.buttonPlus.UseVisualStyleBackColor = true;
     this.buttonPlus.Click += new System.EventHandler(this.ButtonPlus_Click);
     //
     // buttonMinus
     //
     this.buttonMinus.Font     = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.buttonMinus.Image    = null;
     this.buttonMinus.Location = new System.Drawing.Point(75, 24);
     this.buttonMinus.Name     = "buttonMinus";
     this.buttonMinus.Size     = new System.Drawing.Size(52, 32);
     this.buttonMinus.TabIndex = 1;
     this.buttonMinus.Text     = "-";
     this.buttonMinus.UseVisualStyleBackColor = true;
     this.buttonMinus.Click += new System.EventHandler(this.ButtonMinus_Click);
     //
     // txtBoxTuneStep
     //
     this.txtBoxTuneStep.Font       = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.txtBoxTuneStep.Location   = new System.Drawing.Point(133, 27);
     this.txtBoxTuneStep.Name       = "txtBoxTuneStep";
     this.txtBoxTuneStep.Size       = new System.Drawing.Size(122, 26);
     this.txtBoxTuneStep.TabIndex   = 0;
     this.txtBoxTuneStep.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TextBoxTuneStep_MouseDown);
     //
     // VFOSettingsPopup
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor           = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(80)))), ((int)(((byte)(80)))));
     this.ClientSize          = new System.Drawing.Size(334, 127);
     this.Controls.Add(this.buttonClose);
     this.Controls.Add(this.labelTS1);
     this.Controls.Add(this.buttonPlus);
     this.Controls.Add(this.buttonMinus);
     this.Controls.Add(this.txtBoxTuneStep);
     this.Icon         = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.Name         = "VFOSettingsPopup";
     this.Text         = "VFO Settings";
     this.TopMost      = true;
     this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.VFOSettingsPopup_FormClosing);
     this.Load        += new System.EventHandler(this.VFOSettingsPopup_Load);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Beispiel #5
0
        public void GetOptions()  // changes yt7pwr
        {
            try
            {
                // get list of live controls
                ArrayList temp = new ArrayList();                               // list of all first level controls
                ControlList(this, ref temp);
                ArrayList checkbox_list      = new ArrayList();
                ArrayList numericupdown_list = new ArrayList();
                ArrayList textbox_list       = new ArrayList();

                //ArrayList controls = new ArrayList();	                // list of controls to restore
                foreach (Control c in temp)
                {
                    if (c.GetType() == typeof(CheckBoxTS))                          // the control is a CheckBoxTS
                    {
                        checkbox_list.Add(c);
                    }
                    else if (c.GetType() == typeof(NumericUpDownTS))    // the control is a NumericUpDown
                    {
                        numericupdown_list.Add(c);
                    }
                    else if (c.GetType() == typeof(TextBoxTS))              // the control is a TextBox
                    {
                        textbox_list.Add(c);
                    }
                }

                temp.Clear();   // now that we have the controls we want, delete first list

                ArrayList a;
                a = DB.GetVars("XTRVsettings");                                             // Get the saved list of controls
                a.Sort();
                int num_controls = checkbox_list.Count +
                                   numericupdown_list.Count +
                                   textbox_list.Count;

                // restore saved values to the controls
                foreach (string s in a)                                             // string is in the format "name,value"
                {
                    string[] vals = s.Split('/');
                    if (vals.Length > 2)
                    {
                        for (int i = 2; i < vals.Length; i++)
                        {
                            vals[1] += "/" + vals[i];
                        }
                    }

                    string name = vals[0];
                    string val  = vals[1];

                    if (s.StartsWith("chk"))                                    // control is a CheckBoxTS
                    {
                        for (int i = 0; i < checkbox_list.Count; i++)
                        {                                    // look through each control to find the matching name
                            CheckBoxTS c = (CheckBoxTS)checkbox_list[i];
                            if (c.Name.Equals(name))         // name found
                            {
                                c.Checked = bool.Parse(val); // restore value
                                i         = checkbox_list.Count + 1;
                            }
                            if (i == checkbox_list.Count)
                            {
                                MessageBox.Show("Control not found: " + name);
                            }
                        }
                    }
                    else if (s.StartsWith("ud"))
                    {
                        for (int i = 0; i < numericupdown_list.Count; i++)
                        {                            // look through each control to find the matching name
                            NumericUpDownTS c = (NumericUpDownTS)numericupdown_list[i];
                            if (c.Name.Equals(name)) // name found
                            {
                                decimal num = decimal.Parse(val);

                                if (num > c.Maximum)
                                {
                                    num = c.Maximum;                    // check endpoints
                                }
                                else if (num < c.Minimum)
                                {
                                    num = c.Minimum;
                                }
                                c.Value = num;                                  // restore value
                                i       = numericupdown_list.Count + 1;
                            }
                            if (i == numericupdown_list.Count)
                            {
                                MessageBox.Show("Control not found: " + name);
                            }
                        }
                    }
                    else if (s.StartsWith("txt"))
                    {   // look through each control to find the matching name
                        for (int i = 0; i < textbox_list.Count; i++)
                        {
                            TextBoxTS c = (TextBoxTS)textbox_list[i];
                            if (c.Name.Equals(name))                    // name found
                            {
                                c.Text = val;                           // restore value
                                i      = textbox_list.Count + 1;
                            }
                            if (i == textbox_list.Count)
                            {
                                MessageBox.Show("Control not found: " + name);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in XTRV GetOption function!\n" + ex.ToString());
            }
        }
Beispiel #6
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.btnExit    = new System.Windows.Forms.Button();
     this.txtInput   = new System.Windows.Forms.TextBoxTS();
     this.txtResult  = new System.Windows.Forms.TextBoxTS();
     this.label1     = new System.Windows.Forms.LabelTS();
     this.label2     = new System.Windows.Forms.LabelTS();
     this.dataGrid1  = new System.Windows.Forms.DataGrid();
     this.btnExecute = new System.Windows.Forms.Button();
     ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
     this.SuspendLayout();
     //
     // btnExit
     //
     this.btnExit.Location = new System.Drawing.Point(440, 336);
     this.btnExit.Name     = "btnExit";
     this.btnExit.TabIndex = 2;
     this.btnExit.Text     = "Exit";
     this.btnExit.Click   += new System.EventHandler(this.btnExit_Click);
     //
     // txtInput
     //
     this.txtInput.Location = new System.Drawing.Point(120, 240);
     this.txtInput.Name     = "txtInput";
     this.txtInput.Size     = new System.Drawing.Size(168, 20);
     this.txtInput.TabIndex = 0;
     this.txtInput.Text     = "";
     this.txtInput.KeyUp   += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyUp);
     //
     // txtResult
     //
     this.txtResult.Location = new System.Drawing.Point(120, 280);
     this.txtResult.Name     = "txtResult";
     this.txtResult.Size     = new System.Drawing.Size(392, 20);
     this.txtResult.TabIndex = 3;
     this.txtResult.Text     = "";
     //
     // label1
     //
     this.label1.Location  = new System.Drawing.Point(16, 240);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(88, 23);
     this.label1.TabIndex  = 4;
     this.label1.Text      = "CAT Command";
     this.label1.TextAlign = System.Drawing.ContentAlignment.BottomRight;
     //
     // label2
     //
     this.label2.Location  = new System.Drawing.Point(16, 280);
     this.label2.Name      = "label2";
     this.label2.Size      = new System.Drawing.Size(88, 23);
     this.label2.TabIndex  = 5;
     this.label2.Text      = "CAT Response";
     this.label2.TextAlign = System.Drawing.ContentAlignment.BottomRight;
     //
     // dataGrid1
     //
     this.dataGrid1.DataMember      = "";
     this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
     this.dataGrid1.Location        = new System.Drawing.Point(8, 0);
     this.dataGrid1.Name            = "dataGrid1";
     this.dataGrid1.Size            = new System.Drawing.Size(512, 224);
     this.dataGrid1.TabIndex        = 6;
     //
     // btnExecute
     //
     this.btnExecute.Location = new System.Drawing.Point(312, 240);
     this.btnExecute.Name     = "btnExecute";
     this.btnExecute.TabIndex = 7;
     this.btnExecute.Text     = "Execute";
     this.btnExecute.Click   += new System.EventHandler(this.btnExecute_Click);
     //
     // CATTester
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(5, 13);
     this.ClientSize          = new System.Drawing.Size(536, 382);
     this.Controls.Add(this.btnExecute);
     this.Controls.Add(this.dataGrid1);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.txtResult);
     this.Controls.Add(this.txtInput);
     this.Controls.Add(this.btnExit);
     this.Name = "CATTester";
     this.Text = "CAT Command Tester";
     ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
     this.ResumeLayout(false);
 }