private void MakeComplicatedWork(Action <byte[]> action, byte[] bytes) { DoingWork = true; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); action(bytes); stopwatch.Stop(); NotifyPopup.ShowToast("用时" + (int)stopwatch.Elapsed.TotalSeconds + "." + stopwatch.Elapsed.Milliseconds + "秒"); DoingWork = false; }
private async Task MakeComplicatedWork(Func <Task> action) { DoingWork = true; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); await action(); stopwatch.Stop(); NotifyPopup.ShowToast("用时" + (int)stopwatch.Elapsed.TotalSeconds + "." + stopwatch.Elapsed.Milliseconds + "秒"); DoingWork = false; }