private void Click_Edit_Replace(object sender, RoutedEventArgs e) { try { if (templatePath == "" || wordDoc == null) { MessageBox.Show("未加载模板,请先打开Word模板", "SC-Information"); return; } else { if (wordDoc.Bookmarks.Count == 0) { MessageBox.Show("当前Word文档中不存在任何书签", "SC-Information"); return; } if (DataGrid_Replace.Items.Count == 0) { MessageBox.Show("当前表格中未设置任何操作内容,请先添加操作数据,再执行此命令", "SC-Information"); return; } if (modifyInfo == null) { modifyInfo = new ModifyInfo(); modifyInfo.Owner = this; modifyInfo.Closed += new EventHandler(HandleModifyInfoWindowClosed); this.ModifiedContent += new ModifyInfoEventHandle(modifyInfo.AddItem); modifyInfo.Show(); } if (CheckBox_FuzzyMatch.IsChecked != true) { ReplaceNormal(); } else { ReplaceFuzzy(); } } } catch (Exception ex) { MessageBox.Show("错误信息:\n" + ex.Message + "\nSource:" + ex.Source + "\nTrace:" + ex.StackTrace); } }
private void HandleModifyInfoWindowClosed(object sender, EventArgs e) { modifyInfo = null; }