private void GeneralChm(IReader reader, string input, string name) { LoadingDialog.IsOpen = true; Task.Run(() => { var models = reader.Read(input); HtmlGenerator.GeneralHtml(name, models); var filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), name + ".chm"); var defaultpage = $"{HtmlGenerator.CATALOGUEFILENAME}.html"; ChmGenerator chm = new ChmGenerator(filename, name, defaultpage, name); bool isSuccess = chm.Compile(); HtmlGenerator.DeleteHtml(name); LoadingDialog.Dispatcher.Invoke(() => { LoadingDialog.IsOpen = false; }); if (isSuccess) { var message = $"生成成功,文件目录:{filename}"; ShowMessage(message); } else { var message = "生成失败"; ShowMessage(message); } }); }
/// <summary> /// Generates the CHM project, and compile it optionally /// </summary> private void GenerateChm() { try { // TODO: If the chm has been compiled, remove the project directory from the temporal directory. ChmGenerator chmGenerator = new ChmGenerator(Document, UI, Project, AdditionalFiles, ChmDecorator); chmGenerator.Generate(); } catch (Exception ex) { UI.Log(ex); } }