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 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); } }