示例#1
0
 private void btnEditConfirm_Click(object sender, EventArgs e)
 {
     this.btnDel.Visible    = true;
     this.btnEdit.Visible   = true;
     this.btnCancel.Visible = true;
     this.isEdit            = false;
     if (this.txtName.Text != "")
     {
         string id          = PolygonCollectionManager.FindId(instanceObj);
         var    polygonData = PolygonCollectionManager.GetPolygonData(id);
         this.CreateRealPolygonAfterEditted();
         polygonData.name        = String.Copy(txtName.Text);
         polygonData._point      = new List <PointLatLng>(cacheList);
         polygonData.polygon     = instanceObj;
         this.isEdit             = false;
         this.btnConfirm.Visible = false;
         MessageBox.Show("แก้ไขข้อมูลเสร็จสิ้น", "อาณาเขต", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Reset();
         btnEditConfirm.Visible = false;
         btnEdit.Visible        = true;
     }
     else
     {
         MessageBox.Show("กรุณากรอกข้อมูลให้ครบถ้วน", "อาณาเขต", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     PolygonManager.ClearIndex();
 }
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (!this.CheckNull())
     {
         MessageBox.Show("กรุณากรอกข้อมูลให้ครบถ้วน", "อาณาเขต", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         DialogResult dialogResult = MessageBox.Show("ยืนยันที่จะสร้างอาณาเขตนี้หรือไม่", "อาณาเขต", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dialogResult == DialogResult.Yes)
         {
             polygonManager.CreatePolygon(points);
         }
         polygonManager.isPreview = false;
         //polygonManager.CreateRealPoints(points);
         AddDataToCollection(txtName.Text, new List <PointLatLng>(main._pointsPoly), cmbStatusEx.SelectedItem.ToString(), "None", polygonManager.polygon);
         Reset();
         main.SetPolygonFuncClick(false);
         this.isEdit = false;
         polygonManager.ClearIndex();
         main._pointsPoly.Clear();
         main.isRdClicked = false;
     }
 }