diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Componentes/PassBox.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes/PassBox.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Componentes/PassBox.cs | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/PassBox.cs b/Decompiler/Gestor.Application.Componentes/PassBox.cs new file mode 100644 index 0000000..7c25773 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/PassBox.cs @@ -0,0 +1,208 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Common.Validation; + +namespace Gestor.Application.Componentes; + +public class PassBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty HintProperty = DependencyProperty.Register("Hint", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty PasswordWidthProperty = DependencyProperty.Register("PasswordWidth", typeof(string), typeof(PassBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBoundWidthChanged))); + + private bool _hidePasswordView; + + internal Grid LayoutRoot; + + internal Button ShowHidePassword; + + internal PasswordBox TextPassword; + + internal TextBox TextPasswordVisible; + + private bool _contentLoaded; + + public bool Visible { get; set; } + + public string Value + { + get + { + return (string)((DependencyObject)this).GetValue(ValueProperty); + } + set + { + ((DependencyObject)this).SetValue(ValueProperty, (object)value); + } + } + + public string Hint + { + get + { + return (string)((DependencyObject)this).GetValue(HintProperty); + } + set + { + ((DependencyObject)this).SetValue(HintProperty, (object)value); + } + } + + public string PasswordWidth + { + get + { + return (string)((DependencyObject)this).GetValue(PasswordWidthProperty); + } + set + { + ((DependencyObject)this).SetValue(PasswordWidthProperty, (object)value); + } + } + + public bool HidePasswordView + { + get + { + return _hidePasswordView; + } + set + { + if (value) + { + HidePassword(); + } + } + } + + private static void OnBoundWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PassBox passBox = d as PassBox; + if (d != null && passBox != null) + { + string text = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (ValidationHelper.ValidateDouble(text)) + { + ((FrameworkElement)passBox.TextPassword).MinWidth = double.Parse(text); + ((FrameworkElement)passBox.TextPasswordVisible).MinWidth = double.Parse(text); + } + } + } + + public PassBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + public void ShowPassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)0; + ((UIElement)TextPassword).Visibility = (Visibility)1; + ((UIElement)TextPasswordVisible).Focus(); + Visible = true; + } + + public void HidePassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)1; + ((UIElement)TextPassword).Visibility = (Visibility)0; + ((UIElement)TextPassword).Focus(); + Visible = false; + } + + private void TextPassword_PasswordChanged(object sender, RoutedEventArgs e) + { + } + + private void ShowHidePassword_OnClick(object sender, RoutedEventArgs e) + { + if (Visible) + { + HidePassword(); + } + else + { + ShowPassword(); + } + } + + private void ShowHidePassword_OnMouseDown(object sender, MouseButtonEventArgs e) + { + ShowPassword(); + } + + private void ShowHidePassword_OnMouseUp(object sender, MouseButtonEventArgs e) + { + HidePassword(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/passbox.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + ShowHidePassword = (Button)target; + ((UIElement)ShowHidePassword).PreviewMouseDown += new MouseButtonEventHandler(ShowHidePassword_OnMouseDown); + ((UIElement)ShowHidePassword).PreviewMouseUp += new MouseButtonEventHandler(ShowHidePassword_OnMouseUp); + break; + case 3: + TextPassword = (PasswordBox)target; + TextPassword.PasswordChanged += new RoutedEventHandler(TextPassword_PasswordChanged); + break; + case 4: + TextPasswordVisible = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} |