diff options
Diffstat (limited to 'Gestor.Application/Componentes/CustomSenhaLoginBox.cs')
| -rw-r--r-- | Gestor.Application/Componentes/CustomSenhaLoginBox.cs | 338 |
1 files changed, 0 insertions, 338 deletions
diff --git a/Gestor.Application/Componentes/CustomSenhaLoginBox.cs b/Gestor.Application/Componentes/CustomSenhaLoginBox.cs deleted file mode 100644 index ce1a278..0000000 --- a/Gestor.Application/Componentes/CustomSenhaLoginBox.cs +++ /dev/null @@ -1,338 +0,0 @@ -using ControlzEx;
-using MaterialDesignThemes.Wpf;
-using System;
-using System.CodeDom.Compiler;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Markup;
-using System.Windows.Media;
-
-namespace Gestor.Application.Componentes
-{
- public class CustomSenhaLoginBox : UserControl, IComponentConnector
- {
- public readonly static DependencyProperty TextProperty;
-
- public readonly static DependencyProperty IsReadOnlyProperty;
-
- public readonly static DependencyProperty PlaceHolderProperty;
-
- public readonly static DependencyProperty BackgroundProperty;
-
- public readonly static DependencyProperty ForegroundProperty;
-
- public readonly static DependencyProperty CaretBrushProperty;
-
- public readonly static DependencyProperty FontFamilyProperty;
-
- public readonly static DependencyProperty FontSizeProperty;
-
- public readonly static DependencyProperty BorderThicknessProperty;
-
- internal Grid LayoutRoot;
-
- internal TextBox TextRead;
-
- internal System.Windows.Controls.PasswordBox PasswordBox;
-
- internal Button ButtonEye;
-
- private bool _contentLoaded;
-
- private static bool _typing
- {
- get;
- set;
- }
-
- public new Brush Background
- {
- get
- {
- return (Brush)base.GetValue(CustomSenhaLoginBox.BackgroundProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.BackgroundProperty, value);
- }
- }
-
- public new Thickness BorderThickness
- {
- get
- {
- return (Thickness)base.GetValue(CustomSenhaLoginBox.BorderThicknessProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.BorderThicknessProperty, value);
- }
- }
-
- public Brush CaretBrush
- {
- get
- {
- return (Brush)base.GetValue(CustomSenhaLoginBox.CaretBrushProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.CaretBrushProperty, value);
- }
- }
-
- public new System.Windows.Media.FontFamily FontFamily
- {
- get
- {
- return (System.Windows.Media.FontFamily)base.GetValue(CustomSenhaLoginBox.FontFamilyProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.FontFamilyProperty, value);
- }
- }
-
- public new int FontSize
- {
- get
- {
- return (int)base.GetValue(CustomSenhaLoginBox.FontSizeProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.FontSizeProperty, value);
- }
- }
-
- public new Brush Foreground
- {
- get
- {
- return (Brush)base.GetValue(CustomSenhaLoginBox.ForegroundProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.ForegroundProperty, value);
- }
- }
-
- public bool IsReadOnly
- {
- get
- {
- return (bool)base.GetValue(CustomSenhaLoginBox.IsReadOnlyProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.IsReadOnlyProperty, value);
- }
- }
-
- public string PlaceHolder
- {
- get
- {
- return (string)base.GetValue(CustomSenhaLoginBox.PlaceHolderProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.PlaceHolderProperty, value);
- }
- }
-
- public string Text
- {
- get
- {
- return (string)base.GetValue(CustomSenhaLoginBox.TextProperty);
- }
- set
- {
- base.SetValue(CustomSenhaLoginBox.TextProperty, value);
- }
- }
-
- static CustomSenhaLoginBox()
- {
- CustomSenhaLoginBox.TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomSenhaLoginBox), new PropertyMetadata(string.Empty, new PropertyChangedCallback(CustomSenhaLoginBox.OnBoundPasswordChanged)));
- CustomSenhaLoginBox.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomSenhaLoginBox), new PropertyMetadata(false, new PropertyChangedCallback(CustomSenhaLoginBox.OnBoundIsReadOnlyChanged)));
- CustomSenhaLoginBox.PlaceHolderProperty = DependencyProperty.Register("PlaceHolder", typeof(string), typeof(CustomSenhaLoginBox), new FrameworkPropertyMetadata("SENHA", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
- CustomSenhaLoginBox.BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnBackgroundChanged)));
- CustomSenhaLoginBox.ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnForegroundChanged)));
- CustomSenhaLoginBox.CaretBrushProperty = DependencyProperty.Register("CaretBrush", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnCaretBrushChanged)));
- CustomSenhaLoginBox.FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(System.Windows.Media.FontFamily), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnFontFamilyChanged)));
- CustomSenhaLoginBox.FontSizeProperty = DependencyProperty.Register("FontSize", typeof(int), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)10, new PropertyChangedCallback(CustomSenhaLoginBox.OnFontSizeChanged)));
- CustomSenhaLoginBox.BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)(new Thickness(1)), new PropertyChangedCallback(CustomSenhaLoginBox.OnBorderThicknessChanged)));
- }
-
- public CustomSenhaLoginBox()
- {
- this.InitializeComponent();
- this.LayoutRoot.DataContext = this;
- }
-
- private void Eye_Click(object sender, RoutedEventArgs e)
- {
- if (this.IsReadOnly)
- {
- return;
- }
- Button button = sender as Button;
- this.TextRead.Visibility = (this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
- this.PasswordBox.Visibility = (this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
- if (button != null && button.Content != null)
- {
- ((PackIcon)button.Content).set_Kind((this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? 1492 : 1497));
- }
- if (this.PasswordBox.Visibility != System.Windows.Visibility.Visible)
- {
- return;
- }
- this.PasswordBox.Focus();
- this.PasswordBox.SelectAll();
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- {
- return;
- }
- this._contentLoaded = true;
- System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/componentes/customsenhaloginbox.xaml", UriKind.Relative));
- }
-
- private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.Background = (Brush)e.NewValue;
- }
-
- private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.BorderThickness = (Thickness)e.NewValue;
- }
-
- private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomPasswordBox customPasswordBox = d as CustomPasswordBox;
- if (d == null || customPasswordBox == null)
- {
- return;
- }
- bool newValue = (bool)e.NewValue;
- customPasswordBox.PasswordBox.Visibility = (newValue ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible);
- customPasswordBox.TextRead.Visibility = (newValue ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed);
- }
-
- private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox;
- if (d == null || customSenhaLoginBox == null)
- {
- return;
- }
- string newValue = (string)e.NewValue ?? "";
- if (CustomSenhaLoginBox._typing)
- {
- return;
- }
- customSenhaLoginBox.PasswordBox.Password = newValue;
- }
-
- private static void OnCaretBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.CaretBrush = (Brush)e.NewValue;
- }
-
- private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.FontFamily = (System.Windows.Media.FontFamily)e.NewValue;
- }
-
- private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.FontSize = (int)e.NewValue;
- }
-
- private static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox;
- if (d == null || newValue == null)
- {
- return;
- }
- newValue.Foreground = (Brush)e.NewValue;
- }
-
- private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
- {
- CustomSenhaLoginBox._typing = true;
- this.Text = this.PasswordBox.Password;
- CustomSenhaLoginBox._typing = false;
- }
-
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- {
- this.LayoutRoot = (Grid)target;
- return;
- }
- case 2:
- {
- this.TextRead = (TextBox)target;
- return;
- }
- case 3:
- {
- this.PasswordBox = (System.Windows.Controls.PasswordBox)target;
- this.PasswordBox.PasswordChanged += new RoutedEventHandler(this.PasswordBox_PasswordChanged);
- return;
- }
- case 4:
- {
- this.ButtonEye = (Button)target;
- this.ButtonEye.Click += new RoutedEventHandler(this.Eye_Click);
- return;
- }
- }
- this._contentLoaded = true;
- }
- }
-}
\ No newline at end of file |