summaryrefslogtreecommitdiff
path: root/Gestor.Application/Componentes/PassBox.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/Componentes/PassBox.cs')
-rw-r--r--Gestor.Application/Componentes/PassBox.cs213
1 files changed, 0 insertions, 213 deletions
diff --git a/Gestor.Application/Componentes/PassBox.cs b/Gestor.Application/Componentes/PassBox.cs
deleted file mode 100644
index 9ca18aa..0000000
--- a/Gestor.Application/Componentes/PassBox.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-using Gestor.Common.Validation;
-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.Input;
-using System.Windows.Markup;
-
-namespace Gestor.Application.Componentes
-{
- public class PassBox : UserControl, IComponentConnector
- {
- public readonly static DependencyProperty ValueProperty;
-
- public readonly static DependencyProperty HintProperty;
-
- public readonly static DependencyProperty PasswordWidthProperty;
-
- private bool _hidePasswordView;
-
- internal Grid LayoutRoot;
-
- internal Button ShowHidePassword;
-
- internal PasswordBox TextPassword;
-
- internal TextBox TextPasswordVisible;
-
- private bool _contentLoaded;
-
- public bool HidePasswordView
- {
- get
- {
- return this._hidePasswordView;
- }
- set
- {
- if (value)
- {
- this.HidePassword();
- }
- }
- }
-
- public string Hint
- {
- get
- {
- return (string)base.GetValue(PassBox.HintProperty);
- }
- set
- {
- base.SetValue(PassBox.HintProperty, value);
- }
- }
-
- public string PasswordWidth
- {
- get
- {
- return (string)base.GetValue(PassBox.PasswordWidthProperty);
- }
- set
- {
- base.SetValue(PassBox.PasswordWidthProperty, value);
- }
- }
-
- public string Value
- {
- get
- {
- return (string)base.GetValue(PassBox.ValueProperty);
- }
- set
- {
- base.SetValue(PassBox.ValueProperty, value);
- }
- }
-
- public bool Visible
- {
- get;
- set;
- }
-
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, this, handler);
- }
-
- static PassBox()
- {
- PassBox.ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(PassBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
- PassBox.HintProperty = DependencyProperty.Register("Hint", typeof(string), typeof(PassBox), new FrameworkPropertyMetadata("SENHA", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
- PassBox.PasswordWidthProperty = DependencyProperty.Register("PasswordWidth", typeof(string), typeof(PassBox), new PropertyMetadata(null, new PropertyChangedCallback(PassBox.OnBoundWidthChanged)));
- }
-
- public PassBox()
- {
- this.InitializeComponent();
- this.LayoutRoot.DataContext = this;
- }
-
- public void HidePassword()
- {
- this.TextPasswordVisible.Visibility = System.Windows.Visibility.Hidden;
- this.TextPassword.Visibility = System.Windows.Visibility.Visible;
- this.TextPassword.Focus();
- this.Visible = false;
- }
-
- [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/passbox.xaml", UriKind.Relative));
- }
-
- private static void OnBoundWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- PassBox passBox = d as PassBox;
- if (d == null || passBox == null)
- {
- return;
- }
- string newValue = (string)e.NewValue;
- if (!ValidationHelper.ValidateDouble(newValue))
- {
- return;
- }
- passBox.TextPassword.MinWidth = double.Parse(newValue);
- passBox.TextPasswordVisible.MinWidth = double.Parse(newValue);
- }
-
- private void ShowHidePassword_OnClick(object sender, RoutedEventArgs e)
- {
- if (this.Visible)
- {
- this.HidePassword();
- return;
- }
- this.ShowPassword();
- }
-
- private void ShowHidePassword_OnMouseDown(object sender, MouseButtonEventArgs e)
- {
- this.ShowPassword();
- }
-
- private void ShowHidePassword_OnMouseUp(object sender, MouseButtonEventArgs e)
- {
- this.HidePassword();
- }
-
- public void ShowPassword()
- {
- this.TextPasswordVisible.Visibility = System.Windows.Visibility.Visible;
- this.TextPassword.Visibility = System.Windows.Visibility.Hidden;
- this.TextPasswordVisible.Focus();
- this.Visible = true;
- }
-
- [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.ShowHidePassword = (Button)target;
- this.ShowHidePassword.PreviewMouseDown += new MouseButtonEventHandler(this.ShowHidePassword_OnMouseDown);
- this.ShowHidePassword.PreviewMouseUp += new MouseButtonEventHandler(this.ShowHidePassword_OnMouseUp);
- return;
- }
- case 3:
- {
- this.TextPassword = (PasswordBox)target;
- this.TextPassword.PasswordChanged += new RoutedEventHandler(this.TextPassword_PasswordChanged);
- return;
- }
- case 4:
- {
- this.TextPasswordVisible = (TextBox)target;
- return;
- }
- }
- this._contentLoaded = true;
- }
-
- private void TextPassword_PasswordChanged(object sender, RoutedEventArgs e)
- {
- }
- }
-} \ No newline at end of file