void list_box_index_change(object sender, EventArgs e) { if (IsPrimitive) { if (child_editbox != null) { child_editbox.Dispose(); child_editbox = null; } int selected_key = listBox.SelectedIndex; label.Text = jTokens[selected_key].Type.ToString(); // THAT IS TOKEN TYPE! good for labels, terrible for converting to objects! child_editbox = new GUI_node_editbox(form, new KeyValuePair <string, JToken>(selected_key.ToString(), jTokens[selected_key]), this, new Point(location.X, location.Y + 130)); } if (IsJagged) { if (child_editarray != null) { child_editarray.Dispose(); child_editarray = null; } int selected_key = listBox.SelectedIndex; label.Text = jTokens[selected_key].Type.ToString(); // THAT IS TOKEN TYPE! good for labels, terrible for converting to objects! child_editarray = new GUI_node_editarray(form, new KeyValuePair <string, JToken>(selected_key.ToString(), jTokens[selected_key]), this, new Point(location.X, location.Y + 130)); } if (IsObject && !IsPrimitive && !IsJagged) { if (child_property != null) { child_property.Dispose(); child_property = null; } int selected_key = listBox.SelectedIndex; label.Text = jTokens[selected_key].Type.ToString(); // THAT IS TOKEN TYPE! good for labels, terrible for converting to objects! child_property = new GUI_node_property(form, new KeyValuePair <string, JToken>(selected_key.ToString(), jTokens[selected_key]), this, new Point(location.X, location.Y + 130)); } }
void list_box_index_change(object sender, EventArgs e) { if (child_property != null) { child_property.Dispose(); child_property = null; } if (child_editbox != null) { child_editbox.Dispose(); child_editbox = null; } if (child_editarray != null) { child_editarray.Dispose(); child_editarray = null; } string selected_key = (string)list_box.SelectedItem; //Console.WriteLine(jobject[key].Type); label.Text = jobject_part[selected_key].Type.ToString(); // THAT IS TOKEN TYPE! good for labels, terrible for converting to objects! var temp = jobject_part[selected_key]; if (jobject_part[selected_key].Type == JTokenType.Object) { //Console.WriteLine("COMPLEX"); child_property = new GUI_node_property(form, new KeyValuePair <string, JToken>(selected_key, jobject_part[selected_key]), this, new Point(location.X + 130, location.Y)); } if (jobject_part[selected_key].Type == JTokenType.Array) { //Console.WriteLine("COMPLEX"); // child_property = new GUI_node_property(form, new KeyValuePair<string, JToken>(selected_key, jobject_part[selected_key]), this, new Point(location.X + 130, location.Y)); child_editarray = new GUI_node_editarray(form, new KeyValuePair <string, JToken>(selected_key, jobject_part[selected_key]), this, new Point(location.X + 130, location.Y)); } if (jobject_part[selected_key].Type == JTokenType.Float || jobject_part[selected_key].Type == JTokenType.Boolean || jobject_part[selected_key].Type == JTokenType.Integer || jobject_part[selected_key].Type == JTokenType.String) { //Console.WriteLine("PRIMITIVE"); child_editbox = new GUI_node_editbox(form, new KeyValuePair <string, JToken>(selected_key, jobject_part[selected_key]), this, new Point(location.X, location.Y + 130)); //Console.WriteLine(jobject[key]); } }
public void Dispose() { if (child_editbox != null) { child_editbox.Dispose(); child_editbox = null; } if (child_editarray != null) { child_editarray.Dispose(); child_editarray = null; } if (child_property != null) { child_property.Dispose(); child_property = null; } form.Controls.Remove(label); form.Controls.Remove(listBox); }
public void Dispose() { form.Controls.Remove(label); form.Controls.Remove(list_box); form.Controls.Remove(save_button); if (child_property != null) { child_property.Dispose(); child_property = null; } if (child_editbox != null) { child_editbox.Dispose(); child_editbox = null; } if (child_editarray != null) { child_editarray.Dispose(); child_editarray = null; } }