private void barEditItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.barEditItem3.EditValue.ToString() == "False") { if (MessageBox.Show("確認連接遠程?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } s = new ServiceReference1.Service1SoapClient(); this.bindingSourceDepot.DataSource = s.Query("select DepotId,DepotName from Depot order by Id", 30, "depot").Tables[0]; this.bindingSourceCategory.DataSource = s.Query("select ProductCategoryId,ProductCategoryName,Id from ProductCategory order by Id", 30, "ProductCategory").Tables[0]; this.barEditItem3.EditValue = true; return; } else { if (MessageBox.Show("確認取消遠程連接?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } this.bindingSourceDepot.DataSource = this.depotManager.Query("select DepotId,DepotName from Depot order by Id", 30, "depot").Tables[0]; this.bindingSourceCategory.DataSource = this.depotManager.Query("select ProductCategoryId,ProductCategoryName,Id from ProductCategory order by Id", 30, "ProductCategory").Tables[0]; this.barEditItem3.EditValue = false; } }