Add project files.
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
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 VirtualKeyboard.Wpf.Controls
|
||||
{
|
||||
class AdvancedTextBox : TextBox
|
||||
{
|
||||
public int CaretPosition
|
||||
{
|
||||
get { return (int)GetValue(CaretPositionProperty); }
|
||||
set { SetValue(CaretPositionProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for CaretPosition. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty CaretPositionProperty =
|
||||
DependencyProperty.Register("CaretPosition", typeof(int), typeof(AdvancedTextBox),
|
||||
new PropertyMetadata(0, OnCaretPositionChange));
|
||||
|
||||
public string SelectedValue
|
||||
{
|
||||
get { return (string)GetValue(SelectedValueProperty); }
|
||||
set { SetValue(SelectedValueProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for SelectedValue. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty SelectedValueProperty =
|
||||
DependencyProperty.Register("SelectedValue", typeof(string), typeof(AdvancedTextBox),
|
||||
new PropertyMetadata("", OnSelectedTextChange));
|
||||
|
||||
public string TextValue
|
||||
{
|
||||
get { return (string)GetValue(TextValueProperty); }
|
||||
set { SetValue(TextValueProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for TextValue. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty TextValueProperty =
|
||||
DependencyProperty.Register("TextValue", typeof(string), typeof(AdvancedTextBox),
|
||||
new PropertyMetadata("", OnTextValueChange));
|
||||
|
||||
public AdvancedTextBox()
|
||||
{
|
||||
SelectionChanged += AdvancedTextBox_SelectionChanged;
|
||||
TextChanged += (s, e) => SetValue(TextValueProperty, Text);
|
||||
}
|
||||
|
||||
private void AdvancedTextBox_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetValue(CaretPositionProperty, CaretIndex);
|
||||
SetValue(SelectedValueProperty, SelectedText);
|
||||
}
|
||||
|
||||
private static void OnCaretPositionChange(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
int? value = e.NewValue as int?;
|
||||
((TextBox)sender).CaretIndex = value ?? 0;
|
||||
}
|
||||
|
||||
private static void OnSelectedTextChange(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
string value = e.NewValue as string;
|
||||
((TextBox)sender).SelectedText = value ?? "";
|
||||
}
|
||||
|
||||
private static void OnTextValueChange(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var s = (AdvancedTextBox)sender;
|
||||
int caretPosition = s.CaretPosition;
|
||||
string value = e.NewValue as string;
|
||||
s.Text = value;
|
||||
s.CaretIndex = caretPosition <= value.Length ? caretPosition : value.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using DE70_CMDv2;
|
||||
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 SafeBagDE70
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CollectionUC.xaml
|
||||
/// </summary>
|
||||
public partial class TimeoutUC : UserControl
|
||||
{
|
||||
public TimeoutUC()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public void ShowInfor(string strInfor)
|
||||
{
|
||||
lblInfor.Text = strInfor;
|
||||
}
|
||||
|
||||
private void btnEnd_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppData.WDTCount = 0;
|
||||
//var state= ((MainWindow)Application.Current.MainWindow).GetDepositScreen().GetPrevioustState();
|
||||
// ((MainWindow)Application.Current.MainWindow).GetDepositScreen().TransitionToState(state);
|
||||
((MainWindow)Application.Current.MainWindow).StopTimers();
|
||||
((MainWindow)Application.Current.MainWindow).BackScreen();
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (AppData.cCmdRsp != null)
|
||||
AppData.cCmdRsp.SendXXCmd((byte)Command.CMD_DE_CANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user