123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- 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;
- using Aitex.Core.UI.MVVM;
- using Aitex.Triton160.UI.ViewModel;
- namespace Aitex.Jet.UI.Views
- {
- /// <summary>
- /// DiagnoseView.xaml 的交互逻辑
- /// </summary>
- public partial class DiagnoseView : UserControl
- {
- public DiagnoseView()
- {
- InitializeComponent();
- this.DataContext = new DiagnoseViewModel();
- this.IsVisibleChanged += LeakCheckView_IsVisibleChanged;
- }
- private void LeakCheckView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- (this.DataContext as TimerViewModelBase).EnableTimer(this.IsVisible);
- if (this.IsVisible)
- (this.DataContext as DiagnoseViewModel).UpdateLeakCheckResult();
- }
- private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- e.Handled = !IsTextAllowed(e.Text);
- }
- private static bool IsTextAllowed(string text)
- {
- Regex regex = new Regex("[^0-9.]+"); //regex that matches disallowed text
- return !regex.IsMatch(text);
- }
- }
- }
|