diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs | 343 |
1 files changed, 343 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs new file mode 100644 index 0000000..90b1761 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs @@ -0,0 +1,343 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; +using ControlzEx; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class CustomSenhaLoginBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundIsReadOnlyChanged))); + + public static readonly DependencyProperty PlaceHolderProperty = DependencyProperty.Register("PlaceHolder", typeof(string), typeof(CustomSenhaLoginBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBackgroundChanged))); + + public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnForegroundChanged))); + + public static readonly DependencyProperty CaretBrushProperty = DependencyProperty.Register("CaretBrush", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnCaretBrushChanged))); + + public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(FontFamily), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnFontFamilyChanged))); + + public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register("FontSize", typeof(int), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)10, new PropertyChangedCallback(OnFontSizeChanged))); + + public static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)new Thickness(1.0), new PropertyChangedCallback(OnBorderThicknessChanged))); + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal PasswordBox PasswordBox; + + internal Button ButtonEye; + + private bool _contentLoaded; + + private static bool _typing { get; set; } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public string PlaceHolder + { + get + { + return (string)((DependencyObject)this).GetValue(PlaceHolderProperty); + } + set + { + ((DependencyObject)this).SetValue(PlaceHolderProperty, (object)value); + } + } + + public Brush Background + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(BackgroundProperty); + } + set + { + ((DependencyObject)this).SetValue(BackgroundProperty, (object)value); + } + } + + public Brush Foreground + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(ForegroundProperty); + } + set + { + ((DependencyObject)this).SetValue(ForegroundProperty, (object)value); + } + } + + public Brush CaretBrush + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(CaretBrushProperty); + } + set + { + ((DependencyObject)this).SetValue(CaretBrushProperty, (object)value); + } + } + + public FontFamily FontFamily + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (FontFamily)((DependencyObject)this).GetValue(FontFamilyProperty); + } + set + { + ((DependencyObject)this).SetValue(FontFamilyProperty, (object)value); + } + } + + public int FontSize + { + get + { + return (int)((DependencyObject)this).GetValue(FontSizeProperty); + } + set + { + ((DependencyObject)this).SetValue(FontSizeProperty, (object)value); + } + } + + public Thickness BorderThickness + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Thickness)((DependencyObject)this).GetValue(BorderThicknessProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(BorderThicknessProperty, (object)value); + } + } + + private static void OnCaretBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.CaretBrush = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.BorderThickness = (Thickness)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontSize = (int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontFamily = (FontFamily)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Foreground = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Background = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + string password = ((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue) ?? ""; + if (!_typing) + { + customSenhaLoginBox.PasswordBox.Password = password; + } + } + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + public CustomSenhaLoginBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + _typing = true; + Text = PasswordBox.Password; + _typing = false; + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Invalid comparison between Unknown and I4 + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Invalid comparison between Unknown and I4 + //IL_007f: Expected O, but got Unknown + if (!IsReadOnly) + { + Button val = (Button)((sender is Button) ? sender : null); + ((UIElement)TextRead).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + ((UIElement)PasswordBox).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + if (val != null && ((ContentControl)val).Content != null) + { + ((PackIconBase<PackIconKind>)(PackIcon)((ContentControl)val).Content).Kind = (PackIconKind)(((int)((UIElement)TextRead).Visibility == 2) ? 1492 : 1497); + } + if ((int)((UIElement)PasswordBox).Visibility == 0) + { + ((UIElement)PasswordBox).Focus(); + PasswordBox.SelectAll(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/customsenhaloginbox.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [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_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + TextRead = (TextBox)target; + break; + case 3: + PasswordBox = (PasswordBox)target; + PasswordBox.PasswordChanged += new RoutedEventHandler(PasswordBox_PasswordChanged); + break; + case 4: + ButtonEye = (Button)target; + ((ButtonBase)ButtonEye).Click += new RoutedEventHandler(Eye_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} |