Files
bodyshop-uploader/BodyshopUploader/Views/Login.xaml.cs
2024-03-20 14:30:48 -07:00

72 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProManagerPartner.Views
{
/// <summary>
/// Interaction logic for Login.xaml
/// </summary>
public partial class Login : Window
{
public Login()
{
Utils.SquirrelAwareHelper.InitializeSquirrelAware();
Utils.UpdateHandler.RestoreSettings();
Properties.Settings.Default.Reload();
InitializeComponent();
Utils.ApplicationExceptionHandler.InitExceptionHandlers();
}
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
if (this.DataContext != null)
{ ((dynamic)this.DataContext).UserPassword = ((PasswordBox)sender).SecurePassword; }
}
private void PasswordBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
var pb = sender as PasswordBox;
if ((Keyboard.GetKeyStates(Key.CapsLock) & KeyStates.Toggled) == KeyStates.Toggled)
{
if (pb.ToolTip == null)
{
ToolTip tt = new ToolTip();
tt.Content = "Warning: CapsLock is on";
tt.PlacementTarget = sender as UIElement;
tt.Placement = PlacementMode.Right;
pb.ToolTip = tt;
tt.IsOpen = true;
}
}
else
{
var currentToolTip = pb.ToolTip as ToolTip;
if (currentToolTip != null)
{
currentToolTip.IsOpen = false;
}
pb.ToolTip = null;
}
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Application.Current.Shutdown(0);
}
}
}