| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using Muchinfo.MTPClient.Account.ViewModels;
- using Muchinfo.WPF.Controls.Windows;
- using System.Collections.Generic;
- namespace Muchinfo.MTPClient.Account.Views
- {
- /// <summary>
- /// TradeLoginView.xaml 的交互逻辑
- /// </summary>
- public partial class TradePWDModifyView : Window
- {
- /// <summary>
- /// 是否非强制更新
- /// </summary>
- /// <param name="isUnforceUpdate">if set to <c>true</c> [is unforce update].</param>
- public TradePWDModifyView(bool isUnforceUpdate)
- {
- InitializeComponent();
- this.DataContext = new TradePWDModifyViewModel(isUnforceUpdate);
- setFocusList.Add(fundComBoxBox);
- fundComBoxBox.GotFocus += fundComBoxBox_GotFocus;
- //UserpasswoBox.Password = string.Empty;
- //FundsAccountTextBox.Focus();
- this.KeyDown += TradePWDModifyView_KeyDown;
- }
- void TradePWDModifyView_KeyDown(object sender, KeyEventArgs e)
- {
- //避免按Alt+F4关闭窗口
- if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.F4)
- {
- e.Handled = true;
- }
- }
- void fundComBoxBox_GotFocus(object sender, RoutedEventArgs e)
- {
- var index = setFocusList.FindIndex((item) => sender.Equals(item));
- if (index >= 0)
- {
- focusIndex = index;
- }
- }
- List<Control> setFocusList = new List<Control>();
- private int focusIndex = 0;
- private void NewFundsPassword_OnKeyDown(object sender, KeyEventArgs e)
- {
- PasswordBox password = sender as PasswordBox;
- if (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)
- {
- if (password != null && password.Password.Length > 5)
- {
- e.Handled = true;
- return;
- }
- e.Handled = false;
- }
- else if (e.Key >= Key.D0 && e.Key <= Key.D9)
- {
- if (password != null && password.Password.Length > 5)
- {
- e.Handled = true;
- return;
- }
- e.Handled = false;
- }
- else
- {
- e.Handled = true;
- return;
- }
- }
- private void ConfFundsPassword_OnKeyDown(object sender, KeyEventArgs e)
- {
- PasswordBox password1 = sender as PasswordBox;
- if (e.Key >= Key.NumPad0 && e.Key <= Key.NumPad9)
- {
- if (password1 != null && password1.Password.Length > 5)
- {
- e.Handled = true;
- return;
- }
- e.Handled = false;
- }
- else if (e.Key >= Key.D0 && e.Key <= Key.D9)
- {
- if (password1 != null && password1.Password.Length > 5)
- {
- e.Handled = true;
- return;
- }
- e.Handled = false;
- }
- else
- {
- e.Handled = true;
- }
- }
- }
- }
|