随笔分类 - C#
摘要:public decimal GetStringLastNumber(string str) { decimal result = 0; if (str != null && str != string.Empty) { Match match = Regex.Match(str, @"(^.+?)(\d+$)"); if(match.Success) { result = decimal.Parse(match.Groups[2].Value); } } return result; }
阅读全文
摘要:Actionaction=newAction(()=>{Thread.Sleep(5000);});varAsync=Observable.FromAsyncPattern(action.BeginInvoke,action.EndInvoke);Observable.Timeout(Async.Invoke(),DateTimeOffset.Now.AddSeconds(3)).ObserveOnDispatcher().Subscribe(it=>{MessageBox.Show("执行完毕");},ex=>{MessageBox.Show("
阅读全文
摘要:通过调用Windows API中的GetLastInputInfo来获取最后一次输入的时间usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usingSystem.Windows.Input;usingSystem.Windows.Media;usingSystem.Windows.M
阅读全文