private void DoValidation() { Progress.Start(); try { int max = 1000; Thread.Sleep(3000); for (int i = 0; i <= max; i++) { if (Progress.IsRequestCancel) { throw new OperationCanceledException(); } Thread.Sleep(10); Progress.SetValue(i, max); } } catch (OperationCanceledException) { Debug.Print("throw Canceled"); } catch (Exception ex) { ExDialogs.Error(ex.Message); } Progress.End(); }
void SchemaSelectCommandExecute() { string file = ExDialogs.SelectionFile(Properties.Resources.ToolItemButtonChooseSch, new[] { ".sch" }); if (File.Exists(file)) { Schema = new DocumentSchemaModel(file); } }
void XmlSelectCommandExecute() { string[] files = ExDialogs.SelectionFiles(Properties.Resources.ToolItemButtonChooseXml, new[] { ".xml" }); foreach (string file in files) { if (File.Exists(file) && !Xmls.Exists(file)) { Xmls.Add(file); } } }
async void ValidationCommandExecute() { if (!Progress.IsProgress) { await Task.Run(() => DoValidation()); } else { if (ExDialogs.Question("中断しますか?")) { Progress.Cancel(); } } }
void SchemaMessageViewCommandExecute() { ExDialogs.Warning(Schema.Message); }