private async void Init() { if (string.IsNullOrEmpty(FileName)) { return; } // var index = FileName.LastIndexOf("\\"); var timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 1); //间隔1秒 timer.Tick += new EventHandler(timer_Tick); timer.Start(); var result = await _hcdzClient.FormatDrive(FileName); timer.Stop(); ProgressShow = false; if (result) { ProgressText = string.Format("格式化成功,用时{0}秒!", index); } else { ProgressText = string.Format("格式化失败,用时{0}秒!", index); } }