private void cmenuInuptTree_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Text == "SaveInput") { XmlDocument xmlDocument = new XmlDocument(); MethodProperty property1 = GetCurrentMethodProperty(); if (property1 != null) { HttpWebClientProtocol protocol1 = property1.GetProxyProperty().GetProxy(); RequestProperties properties1 = new RequestProperties(protocol1); try { WSSWebRequest.RequestTrace = properties1; XmlCongifManager.ReadConfig(treeInput.Nodes[0], null, ref xmlDocument); } finally { WSSWebRequest.RequestTrace = null; propRequest.SelectedObject = properties1; richRequest.Text = properties1.requestPayLoad; richResponse.Text = properties1.responsePayLoad; } } if (property1 != null) { Stream myStream = null; saveFileDialog1.Filter = "xml files (*.xml)|*.xml"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != String.Empty && Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != null) { saveFileDialog1.InitialDirectory = Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath; } saveFileDialog1.FileName = treeInput.Nodes[0].Tag.ToString(); cmenuInputTree.Close(); if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if ((myStream = saveFileDialog1.OpenFile()) != null) { StreamWriter wText = new StreamWriter(myStream); wText.Write(XmlCongifManager.FormatXmlDocumentToString(xmlDocument)); wText.Flush(); myStream.Close(); } } } } else if (e.ClickedItem.Text == "LoadInput") { Stream myStream = null; openFileDialog1.Filter = "xml files (*.xml)|*.xml"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; if (Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != String.Empty && Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != null) { openFileDialog1.InitialDirectory = Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath; } cmenuInputTree.Close(); XmlDocument xmlDocument = new XmlDocument(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { if ((myStream = openFileDialog1.OpenFile()) != null) { xmlDocument.Load(myStream); myStream.Close(); } } if (treeMethods.Nodes.Count > 0) { if (xmlDocument.ChildNodes.Count > 0) { OuterRunHelper.ClickNode(mainForm.treeMethods, mainForm.treeMethods.Nodes[0], xmlDocument.ChildNodes[0].Name, mainForm); } } if (treeInput.Nodes.Count > 0) { XmlCongifManager.ApplyConfig(treeInput.Nodes[0], String.Empty, xmlDocument, wsdl.ProxyAssembly); } } else if (e.ClickedItem.Text == "Find") { FindForm findForm = new FindForm(); findForm.ShowDialog(); if (findForm.DialogResult == DialogResult.OK) { if (treeInput.Nodes != null && treeInput.Nodes.Count > 0) SelectNode(treeInput, treeInput.Nodes[0], findForm.FindValue); } } else if (e.ClickedItem.Text == "LoadValueField") { if (btnStart.Text == "Stop") { TreeNode node = treeInput.SelectedNode; ValueFieldsForm valueFieldsForm = new ValueFieldsForm(); valueFieldsForm.ShowDialog(); BatchRunCongifFileHelper.RunParameter(valueFieldsForm.SelectVauleField, TreeNodeToXPath(node.FullPath), treeMethods.SelectedNode.Text, treeMethods.SelectedNode.Text + ".xml"); } } }
//private string XpathToPSMLogXpath(string xpath) //{ // return xpath.Replace("Body/", ""); //} private void cmenuMethodTree_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Text == "Find") { FindForm findForm = new FindForm(); findForm.ShowDialog(); if (findForm.DialogResult == DialogResult.OK) { if (treeMethods.Nodes != null && treeMethods.Nodes.Count > 0) SelectNode(treeMethods, treeMethods.Nodes[0], findForm.FindValue); } } }
private void cmenuOutputTree_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (e.ClickedItem.Text == "SaveOutput") { if (treeOutput.Nodes.Count < 1) { return; } XmlDocument xmlDocument1 = new XmlDocument(); if (mainForm.treeOutput.Nodes[0].Nodes[1].Nodes.Count > 0) { TreeNode outPutNode = mainForm.treeOutput.Nodes[0].Nodes[1].Nodes[0]; XmlCongifManager.ReadOutput(outPutNode, null, ref xmlDocument1); } Stream myStream = null; saveFileDialog1.Filter = "xml files (*.xml)|*.xml"; saveFileDialog1.FilterIndex = 2; saveFileDialog1.RestoreDirectory = true; if (Configuration.MasterConfig.OtherSettings.DefaultOutputFilePath != String.Empty && Configuration.MasterConfig.OtherSettings.DefaultOutputFilePath != null) { saveFileDialog1.InitialDirectory = Configuration.MasterConfig.OtherSettings.DefaultOutputFilePath; } cmenuOutputTree.Close(); if (saveFileDialog1.ShowDialog() == DialogResult.OK) { if ((myStream = saveFileDialog1.OpenFile()) != null) { StreamWriter wText = new StreamWriter(myStream); wText.Write(XmlCongifManager.FormatXmlDocumentToString(xmlDocument1)); wText.Flush(); myStream.Close(); } } } else if (e.ClickedItem.Text == "Find") { FindForm findForm = new FindForm(); findForm.ShowDialog(); if (findForm.DialogResult == DialogResult.OK) { if (treeOutput.Nodes != null && treeOutput.Nodes.Count > 0) SelectNode(treeOutput, treeOutput.Nodes[0], findForm.FindValue); } } else if (e.ClickedItem.Text == "SaveValueField") { if (btnStart.Text == "Stop") { TreeNode node = treeOutput.SelectedNode; ValueFieldsForm valueFieldsForm = new ValueFieldsForm(); valueFieldsForm.ShowDialog(); BatchRunCongifFileHelper.RunSetValueField(valueFieldsForm.SelectVauleField, TreeNodeToXPath(node.FullPath), treeMethods.SelectedNode.Text, treeMethods.SelectedNode.Text + ".xml"); } } }