标签:text 交互 gen reading sed input new t vat sse
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 System.Threading;
namespace WpfApplication9
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
bool isPressed;
bool entryTouch;
Thread th = null;
public delegate void CloseDelegate();
CloseDelegate closeDelegate;
public MainWindow()
{
InitializeComponent();
isPressed = false;
entryTouch = false;
}
private void Btn_MouseDown(object sender, RoutedEventArgs e)
{
isPressed = true;
if (th != null)
{
if (th.ThreadState == ThreadState.Running || th.ThreadState == ThreadState.WaitSleepJoin)
{
th.Abort();
}
}
th = new Thread(new ThreadStart(()=>{
Thread.Sleep(1500);
if (isPressed)
{
MessageBox.Show("长按1.5秒");
isPressed = false;
}
else
{
MessageBox.Show("少于1.5秒");
}
}));
th.Start();
}
private void Btn_MouseUp(object sender, RoutedEventArgs e)
{
if (entryTouch)
{
MessageBox.Show("进入长按事件");
}
isPressed = false;
}
}
}
标签:text 交互 gen reading sed input new t vat sse
原文地址:https://www.cnblogs.com/sundh1981/p/9834700.html