Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            RegValue oldR = Program.Settings.RegValues.Find(RegValue => RegValue.Name == (string)listQueries.SelectedItem);
            RegValue R    = new RegValue();

            R.Name  = txtName.Text;
            R.Key   = (string)cbHive.SelectedItem;
            R.Path  = txtPath.Text;
            R.Value = txtValue.Text;
            if (oldR != null)
            {
                Program.Settings.RegValues.Remove(oldR);
            }
            Program.Settings.RegValues.Add(R);
            if ((oldR != null) && (oldR.Name != R.Name))
            {
                listQueries.Items.RemoveAt(listQueries.SelectedIndex);
            }
            else if ((oldR == null) || (oldR.Name != R.Name))
            {
                listQueries.Items.Add(txtName.Text);
            }
            listQueries.SelectedIndex = listQueries.Items.IndexOf(txtName.Text);
            listQueries_SelectedIndexChanged(sender, e);        // Force refresh to "not editing" state
        }
Exemplo n.º 2
0
 private void listQueries_SelectedIndexChanged(object sender, EventArgs e)
 {
     txtName.Enabled  = false; txtName.ReadOnly = true;
     cbHive.Enabled   = false;
     txtPath.Enabled  = false; txtPath.ReadOnly = true;
     txtValue.Enabled = false; txtValue.ReadOnly = true;
     if (listQueries.SelectedItem != null)
     {
         RegValue R = Program.Settings.RegValues.Find(RegValue => RegValue.Name == (string)listQueries.SelectedItem);
         btnEdit.Enabled      = true;
         btnDelete.Enabled    = true;
         txtName.Text         = R.Name;
         cbHive.SelectedIndex = cbHive.Items.IndexOf(R.Key);
         txtPath.Text         = R.Path;
         txtValue.Text        = R.Value;
     }
     else
     {
         btnEdit.Enabled      = false;
         btnDelete.Enabled    = false;
         txtName.Text         = RegValue.Defaults.Name;
         txtPath.Text         = RegValue.Defaults.Path;
         txtValue.Text        = RegValue.Defaults.Value;
         cbHive.SelectedIndex = -1;
     }
 }
Exemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            RegValue R = Program.Settings.RegValues.Find(RegValue => RegValue.Name == (string)listQueries.SelectedItem);

            Program.Settings.RegValues.Remove(R);
            listQueries.Items.RemoveAt(listQueries.SelectedIndex);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Implement the ICloneable interface
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            RegValue clone = new RegValue();
            clone.Name = Name.Clone() as string;
            clone.Key = Key.Clone() as string;
            clone.Path = Path.Clone() as string;
            clone.Value = Value.Clone() as string;

            return clone;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Implement the ICloneable interface
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            RegValue clone = new RegValue();

            clone.Name  = Name.Clone() as string;
            clone.Key   = Key.Clone() as string;
            clone.Path  = Path.Clone() as string;
            clone.Value = Value.Clone() as string;

            return(clone);
        }
Exemplo n.º 6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     RegValue oldR = Program.Settings.RegValues.Find(RegValue => RegValue.Name == (string)listQueries.SelectedItem);
     RegValue R = new RegValue();
     R.Name = txtName.Text;
     R.Key = (string)cbHive.SelectedItem;
     R.Path = txtPath.Text;
     R.Value = txtValue.Text;
     if (oldR != null) Program.Settings.RegValues.Remove(oldR);
     Program.Settings.RegValues.Add(R);
     if ((oldR != null) && (oldR.Name != R.Name))
         listQueries.Items.RemoveAt(listQueries.SelectedIndex);
     else if ((oldR == null) || (oldR.Name != R.Name))
         listQueries.Items.Add(txtName.Text);
     listQueries.SelectedIndex = listQueries.Items.IndexOf(txtName.Text);
     listQueries_SelectedIndexChanged(sender, e);        // Force refresh to "not editing" state
 }