private void cmbMethods_SelectedIndexChanged(object sender, EventArgs e) { ClearControls(); InterfaceDescription selectedInterface = this.cmbInterfaces.SelectedItem as InterfaceDescription; ParameterInfo[] pars = selectedInterface.GetMethodParameters(this.cmbMethods.SelectedItem as string); if (pars != null) { UpdateParams(pars); } }
private void cmbInterfaces_SelectedIndexChanged(object sender, EventArgs e) { InterfaceDescription selectedInterface = this.cmbInterfaces.SelectedItem as InterfaceDescription; this.cmbMethods.Items.Clear(); this.cmbMethods.Items.Add("-= Select a method to invoke =-"); foreach (string m in selectedInterface.GetMethods()) { this.cmbMethods.Items.Add(m); } this.cmbMethods.SelectedIndex = 0; }
private void btnInvoke_Click(object sender, EventArgs e) { InterfaceDescription selectedInterface = this.cmbInterfaces.SelectedItem as InterfaceDescription; string method = this.cmbMethods.SelectedItem as string; object[] ps = GetActualParameters(selectedInterface.GetMethodParameters(method)); try { this.rtxtResults.Clear(); this.AddMessageLine("Invoke '" + method + "' from '" + selectedInterface); object response = selectedInterface.InvokeMethod(method, ps); if (response != null) { Type respType = response.GetType(); if (respType.IsPrimitive || respType.Equals(typeof(string))) { this.AddMessageLine(response.ToString()); } else { string fn = (this.outputDir == "") ? null : Utils.GetFilenameForCreate(this.outputDir, method, "xml"); if (fn != null) { this.AddMessageLine("Output in file: " + fn); } if (response is IObservable <XmlNode> ) { this.StartObservable <XmlNode>(response as IObservable <XmlNode>, fn); } else if (response is IObservable <XmlNode> ) { this.StartObservable <XmlReadWrite>(response as IObservable <XmlReadWrite>, fn); } else { if (fn != null) { XmlReadWrite.WriteToFile(fn, response); } XmlReadWrite xmlObj = (response is XmlReadWrite) ? (response as XmlReadWrite) : new XmlObjectSerializer(response); this.AddMessageLine(xmlObj.ToString()); } } } } catch (Exception ex) { this.AddErrMessage("Error", ex); } }
private void FillFileCell(int row) { int seq = (int)this.gridTable.Rows[row]["Seq"] - 1; InterfaceDescription selectedInterface = this.cmbInterfaces.SelectedItem as InterfaceDescription; ParameterInfo par = selectedInterface.GetMethodParameter(this.cmbMethods.SelectedItem as string, seq); if (!par.ParameterType.Equals(typeof(String)) && !par.ParameterType.IsPrimitive) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.DefaultExt = ".xml"; openFileDialog.Filter = "XML files(*.xml)|*.xml"; openFileDialog.Multiselect = false; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.gridTable.Rows[row]["Value"] = openFileDialog.FileName; } } }