public static chooseframe InstanceObject() { if (_instance == null) { _instance = new chooseframe(); } return _instance; }
private void btnComplete_Click(object sender, EventArgs e) { _instance = null; if (null != pbThread) { this.pbThread.Abort(); pbThread = null; } this.Dispose(); }
/************************************窗体控制部分****************************************/ private void chooseframe_FormClosing(object sender, FormClosingEventArgs e) { if (null != pbThread) { pbThread.Abort(); pbThread = null; } _instance = null; }
/// <summary> /// 编辑映射 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSetCol_Click(object sender, EventArgs e) { string isChoosed; try { isChoosed = this.dgvMdb.CurrentRow.Cells[0].EditedFormattedValue.ToString(); } catch { MessageBox.Show("请在第一列中选中需要做映射的表."); return; } if (isChoosed == "True") { string dstName = this.dgvMdb.CurrentRow.Cells[1].Value.ToString(); string srcName = this.dgvMdb.CurrentRow.Cells[2].Value.ToString(); if (!"".Equals(dstName) && !"".Equals(srcName)) { cf = chooseframe.InstanceObject(); cf.SetDaoAndTable(mdbDao, sqlDao, srcName, dstName); //新表,需要根据需要建立 if (this.dgvMdb.CurrentCell.RowIndex >= this.mdbTblNum) { cf.SetNewTblFlag(1); cf.BindData(); } else { //数据导入现有表 cf.DoFormLoad(); cf.DataBinding(); } cf.Focus(); cf.Show(); } else { MessageBox.Show("请设置好ACCESS表名和SQL Server表名."); return; } } }