public MainViewModel() { _model.OutputEvent += (x) => { Application.Current.Dispatcher.Invoke(() => { if (x.Message.IsNullOrEmpty()) { Progressvalue = x.Line; } else { MorphismCount++; if (x.IsError) { ErrorCount++; } if (x.DisplayFlag) { CheckResultCollection.Add(x); } } }); }; }
private async Task ReadFile() { CheckResultCollection.Clear(); ErrorCount = 0; MorphismCount = 0; var start = DateTime.Now; await Task.Run(() => { var main = File.ReadAllText(ReadFilePath); ReadFileLine = main.Count(x => x == '\n'); _model.MainLoop(main, ReadFileLine / 100 + 1); }); Progressvalue = ReadFileLine; var end = DateTime.Now; MessageBox.Show("完了しました" + (end - start).TotalSeconds.ToString()); }