//
// Copyright 2014 Perforce Software Inc.
//
using Perforce.ViewModel;
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.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Perforce.View {
/// <summary>
/// Interaction logic for LoginForm.xaml
/// </summary>
public partial class LoginForm : UserControl {
private LoginFormViewModel _model;
public LoginForm(string message = null) {
InitializeComponent();
_model = new LoginFormViewModel();
this.DataContext = _model;
_model.Init(message);
this.Loaded += LoginForm_Loaded;
}
private void LoginForm_Loaded(object sender, RoutedEventArgs e) {
if(string.IsNullOrEmpty(DetailsText.Text.Trim())) {
Keyboard.Focus(LocationChoice);
} else if(string.IsNullOrEmpty(UsernameText.Text.Trim())) {
Keyboard.Focus(UsernameText);
} else {
Keyboard.Focus(PasswordText);
}
}
private void TextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) {
if (e.KeyboardDevice.IsKeyDown(Key.Tab))
((TextBox)sender).SelectAll();
}
public Technewlogic.WpfDialogManagement.Contracts.ICustomContentDialog ParentDialog { get; set; }
private void Textfield_KeyUp(object sender, KeyEventArgs e) {
if (DetailsText.Text.Trim().Length > 0 &&
UsernameText.Text.Trim().Length > 0 &&
PasswordText.Password.Trim().Length > 0) {
ParentDialog.CanOk = true;
} else {
ParentDialog.CanOk = false;
}
}
}
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 15071 | alan_petersen |
Populate -o //guest/perforce_software/piper/... //guest/alan_petersen/piper/.... |
||
| //guest/perforce_software/piper/windows/main/Perforce/View/LoginForm.xaml.cs | |||||
| #1 | 11255 | alan_petersen | Rename/move file(s) | ||
| //guest/perforce_software/piper/windows/Perforce/View/LoginForm.xaml.cs | |||||
| #1 | 10761 | alan_petersen |
initial drop of Piper for Windows.... this version still has _many_ bugs (er... i mean "unintended features") but I will be updating it over the next week as more stability is added. |
||