/// <summary> /// 生成数据库文档 /// </summary> private void tsBtnGenDbChm_Click(object sender, EventArgs e) { if (App.Instance.DBLink == null) { return; } DBDocBuilder builder = new DBDocBuilder(App.Instance.Database); FrmLoading loadForm = new FrmLoading(); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += delegate (object s1, DoWorkEventArgs e1) { builder.Build(); }; worker.RunWorkerCompleted += delegate (object s2, RunWorkerCompletedEventArgs e2) { loadForm.Close(); Process.Start(builder.TargetFolder); }; worker.RunWorkerAsync(); loadForm.ShowDialog(); }
/// <summary> /// 重新加载元数据 /// </summary> private void tsBtnReloadSchema_Click(object sender, EventArgs e) { if (App.Instance.DBLink == null) { return; } FrmLoading loadForm = new FrmLoading(); BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += delegate (object s1, DoWorkEventArgs e1) { //保存说明 //重新加载数据结构 App.Instance.RefreshDbSchema(); }; worker.RunWorkerCompleted += delegate (object s2, RunWorkerCompletedEventArgs e2) { loadForm.Close(); //更新界面 AppEvent.Publish(new DatabaseRefreshEvent() { Database = App.Instance.Database }); }; worker.RunWorkerAsync(); loadForm.ShowDialog(); }