private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { WorkArguments commandArg = e.Argument as WorkArguments; switch (commandArg.Command) { case "UpdateTableInfo": LinqSqlHelp.UpdateTableInfo(); break; case "DocumentCreate": DbDocumentCreator creator = new DbDocumentCreator(); creator.CreateDocument((DbDocumentInfo)commandArg.Args); break; case "DocumentRead": DbDocumentReader reader = new DbDocumentReader(); reader.CreateDBScript((TableCreateInfo)commandArg.Args); break; default: break; } }
private void mnuUpdateDBInfo_Click(object sender, EventArgs e) { try { this.lblMessage.Text = "最新情報の更新中..."; this.toolStripProgressBar1.Visible = true; this.Cursor = Cursors.WaitCursor; WorkArguments arg = new WorkArguments("UpdateTableInfo"); backgroundWorker1.RunWorkerAsync(arg); } catch (Exception ex) { MessageBox.Show(this, ex.Message, "例外", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void mnuDbDocumentCreate_Click(object sender, EventArgs e) { using (DocumentCreateForm docForm = new DocumentCreateForm()) { if (docForm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.lblMessage.ForeColor = Color.Black; this.lblMessage.Text = "データベース設計書を作成しています..."; this.toolStripProgressBar1.Visible = true; this.Cursor = Cursors.WaitCursor; WorkArguments arg = new WorkArguments("DocumentCreate"); arg.Args = docForm.CreateInfo; backgroundWorker1.RunWorkerAsync(arg); } } }
private void mnuDocumentImport_Click(object sender, EventArgs e) { using (SelectDbLayoutForm setForm = new SelectDbLayoutForm()) { if (setForm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { this.lblMessage.ForeColor = Color.Black; this.lblMessage.Text = "データベース設計書からスクリプトを作成しています..."; this.toolStripProgressBar1.Visible = true; this.Cursor = Cursors.WaitCursor; WorkArguments arg = new WorkArguments("DocumentRead"); arg.Args = setForm.SettingInfo; backgroundWorker1.RunWorkerAsync(arg); } } }