Esempio n. 1
0
        private void DetectInput()
        {
            string Value = ValueInput.Text;

            if (string.IsNullOrEmpty(Value))
            {
                Value = ValueInput.PlaceholderText;
            }

            if (string.IsNullOrEmpty(Value) && !AllowEmpty)
            {
                Value = "";
                ValueInput.Focus(FocusState.Keyboard);
                return;
            }
            else
            {
                IsPrimaryButtonEnabled
                        = IsSecondaryButtonEnabled
                        = ValueInput.IsEnabled
                        = false
                    ;

                if (this.Value == Value)
                {
                    this.Hide();
                    return;
                }

                this.Value = Value;

                this.Canceled = false;
                this.Hide();
            }
        }
Esempio n. 2
0
 private void WriteButton_Click(object sender, RoutedEventArgs e)
 {
     // Validate user input first
     if (_tweak.RegistryDataType == RegDataType.REG_DWORD || _tweak.RegistryDataType == RegDataType.REG_QWORD)
     {
         long result = 0;
         if (!Int64.TryParse(ValueInput.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out result))
         {
             MessageBox.Show("Value must be numerical, in the hex format");
             ValueInput.Focus();
             return;
         }
         if (result < _tweak.Min || result > _tweak.Max)
         {
             MessageBox.Show(string.Format("Value must be in range {0} to {1} (hex)", _tweak.Min.ToString("X"), _tweak.Max.ToString("X")));
             ValueInput.Focus();
             return;
         }
     }
     _tweak.Value = ValueInput.Text;
 }
Esempio n. 3
0
        private void DetectInput()
        {
            string Name  = NameInput.Text;
            string Value = ValueInput.Text;

            if (Trim)
            {
                Name  = Name.Trim();
                Value = Value.Trim();
            }

            if (string.IsNullOrEmpty(Name) || string.IsNullOrEmpty(Value))
            {
                if (string.IsNullOrEmpty(Name))
                {
                    NameInput.Focus(FocusState.Keyboard);
                }
                else
                {
                    ValueInput.Focus(FocusState.Keyboard);
                }
                return;
            }
            else
            {
                IsPrimaryButtonEnabled
                          = IsSecondaryButtonEnabled
                          = NameInput.IsEnabled
                          = ValueInput.IsEnabled
                          = false
                    ;

                Target.Name  = Name;
                Target.Value = Value;

                this.Canceled = false;
                this.Hide();
            }
        }