private void btnOK_Click(object sender, EventArgs e) { pn_control.Read(); S_NAME = pn_control.GetValue("name").Trim(); try { S_SIZE = Convert.ToInt32(pn_control.GetValue("size").Trim()); S_PAGE_SIZE = Convert.ToInt32(pn_control.GetValue("page").Trim()); S_EXTENSION = Convert.ToInt32(pn_control.GetValue("ext").Trim()); S_DIR = pn_control.GetValue("dir").Trim(); if (S_DIR == "--default--") { S_DIR = ""; } } catch (Exception em) { MessageBox.Show("Error: " + em.Message, "Incorrect value", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if ((S_NAME == "") | (S_PAGE_SIZE < 1) | (S_SIZE < 1) | (S_EXTENSION < 0)) { MessageBox.Show("Error: some value(s) is not specified", "Incorrect value", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } RESULT = true; btnOK.DialogResult = DialogResult.OK; this.Close(); }
private void btnCreate_Click(object sender, EventArgs e) { g.Read(); try { string s = g.GetValue("size").Trim(); if (s != "") { s_size = VSLib.ConvertStringToInt(s); } s = g.GetValue("ext").Trim(); if (s != "") { s_ext = VSLib.ConvertStringToInt(s); } s = g.GetValue("contsize").Trim(); if (s != "") { s_contsize = VSLib.ConvertStringToInt(s); } s = g.GetValue("context").Trim(); if (s != "") { s_contsize = VSLib.ConvertStringToInt(s); } } catch (Exception e1) { MessageBox.Show(e1.Message, "Create VXML space - invalid parameter(s)", MessageBoxButtons.OK); return; } if (s_size <= 0) { MessageBox.Show("Size is not specified", "Create VXML space", MessageBoxButtons.OK); return; } VXmlCatalog c = new VXmlCatalog(); c.Set(ROOT, "", s_size, s_ext, s_contsize, s_context); this.DialogResult = DialogResult.OK; this.Close(); }
private void btnOK_Click(object sender, EventArgs e) { pn_control.Read(); VALUE_STRING = pn_control.GetValue("inpt"); if (type == "int") { try { VALUE_INT = Convert.ToInt32(VALUE_STRING); } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid value", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } this.Close(); }
private void btnCreate_Click(object sender, EventArgs e) { short node_type = 0; string V = ""; string N = ""; for (int i = 0; i < n_type.Length; i++) { if (n_type[i] == cbNodeType.Text) { node_type = n_type_code[i]; break; } } RC = 0; g.Read(); N = g.GetValue("name"); V = g.GetValue("value"); if ((N == "") & DEFX.BR_NODE_NEED_NAME(node_type)) { MessageBox.Show("Name field is not defined", "Error"); } else if ((node_type == DEFX.NODE_TYPE_CONTENT) & ((g.GetValue("file") == "") | (g.GetValue("title") == ""))) { MessageBox.Show("File name or Title not defined", "Error"); } else { VXmlNode node = CONT.GetNode(VSLib.ConvertStringToLong(TN.Name)); try { if (node_type == DEFX.NODE_TYPE_CONTENT) { VXmlContent c = node.CreateContent(g.GetValue("file")); } else if (node_type == DEFX.NODE_TYPE_CATALOG) { VXmlCatalog cat = (VXmlCatalog)CONT.GetNode(node.Id); VXmlCatalog newcat = cat.CreateCatalog(g.GetValue("name")); if (V != "") { newcat.Value = V; } } else if (node_type == DEFX.NODE_TYPE_DOCUMENT) { VXmlCatalog cat = (VXmlCatalog)CONT.GetNode(node.Id); VXmlDocument d = cat.CreateDocument(N); if (V != "") { d.Value = V; } } else if (node_type == DEFX.NODE_TYPE_ATTRIBUTE) { node.SetAttribute(N, V); } else if (node_type == DEFX.NODE_TYPE_COMMENT) { node.CreateComment(V); } else if (node_type == DEFX.NODE_TYPE_TEXT) { node.CreateTextNode(V); } else if (node_type == DEFX.NODE_TYPE_TAG) { node.SetTag(V.Trim()); } else if (node_type == DEFX.NODE_TYPE_ELEMENT) { VXmlElement el = node.CreateElement(N, V); } else { MessageBox.Show("Invalid node type '" + DEFX.GET_NODETYPE(node_type) + "'", "Error"); RC = 1; } } catch (VXmlException ex) { MessageBox.Show(ex.Message, "Error"); RC = 1; } if (RC == 0) { this.Close(); } } }