private void initTestService() { InterfaceConfiguration iconf1 = new InterfaceConfiguration("SimpleInterface", "Simple Interface", new RuntimeInfo(typeof(ISimpleInterface), typeof(SimpleInterfaceImpl))); InterfaceConfiguration iconf2 = new InterfaceConfiguration("TestInterface", "Test Interface", new RuntimeInfo(typeof(ITestInterface), typeof(TestInterfaceImpl))); ServiceConfig sconf = new ServiceConfig("hxf_service", "HXF Service"); sconf.InterfaceConfigs.Add(iconf1); sconf.InterfaceConfigs.Add(iconf2); testService = ServiceBuilder.BuildFromServiceConf(sconf); TreeBuilder builder = new TreeBuilder(testService); TreeNode rootNode = builder.Build(); treeView.Nodes.Add(rootNode); edtJson.Text = testService.ToJson(); }
private void addServiceFromUrl(string url) { try { WebClient client = new WebClient(); string serviceDesc = client.DownloadString(url); Service service = Service.CreateFromJson(serviceDesc); TreeBuilder builder = new TreeBuilder(service); TreeNode rootNode = builder.Build(); treeView.Nodes.Add(rootNode); edtJson.Text = testService.ToJson(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }