private void b_Add_Click(object sender, EventArgs e) { Point_Constructor point_Constructor = new Point_Constructor(); point_Constructor.ShowDialog(); if (point_Constructor.DialogResult == DialogResult.OK) { Point3D point = new Point3D() { x = point_Constructor.X, y = point_Constructor.Y, z = point_Constructor.Z }; switch (CurrentState) { case State.Binary: BinaryAdd(point); break; case State.XML: XMLAdd(point); break; case State.Soap: SoapAdd(point); break; case State.Json: JsonAdd(point); break; } } }
private void b_Change_Click(object sender, EventArgs e) { bool itemSelected = false; switch (CurrentState) { case State.Binary: if (lv_Binary.SelectedItems.Count > 0) { itemSelected = true; } break; case State.XML: if (lv_XML.SelectedItems.Count > 0) { itemSelected = true; } break; case State.Soap: if (lv_Soap.SelectedItems.Count > 0) { itemSelected = true; } break; case State.Json: if (lv_Json.SelectedItems.Count > 0) { itemSelected = true; } break; } if (itemSelected) { ListViewItem item = null; Point3D point = null; switch (CurrentState) { case State.Binary: item = lv_Binary.SelectedItems[0]; point = arr_points[(int)item.Tag] as Point3D; break; case State.XML: item = lv_XML.SelectedItems[0]; point = item.Tag as Point3D; break; case State.Soap: item = lv_Soap.SelectedItems[0]; point = item.Tag as Point3D; break; case State.Json: item = lv_Json.SelectedItems[0]; point = item.Tag as Point3D; break; } Point_Constructor point_Constructor = new Point_Constructor(point.x, point.y, point.z); point_Constructor.ShowDialog(); if (point_Constructor.DialogResult == DialogResult.OK) { point.x = point_Constructor.X; point.y = point_Constructor.Y; point.z = point_Constructor.Z; item.Text = point.ToString(); } } }