public void ProductSearch() { var client = new BimLibraryService.BIMserviceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress("http://www.narodni-bim-knihovna.cz/BIMservice.svc")); client.Open(); var products = client.GetProductByName("test"); foreach (var product in products) { var description = product.ShortDescriptionk__BackingField; var name = product.Namek__BackingField; var isPublished = product.Publishedk__BackingField; var usDeleted = product.Deletedk__BackingField; var downloadId = product.DownloadIdk__BackingField; var image = GetImages(product).FirstOrDefault(); } }
public void ProductSearch() { var client = new BimLibraryService.BIMserviceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress("http://www.narodni-bim-knihovna.cz/BIMservice.svc")); client.Open(); var products = client.GetProductByName("test"); foreach (var product in products) { var description = product.ShortDescriptionk__BackingField; var name = product.Namek__BackingField; var isPublished = product.Publishedk__BackingField; var usDeleted = product.Deletedk__BackingField; var downloadId = product.DownloadIdk__BackingField; var image = GetImages(product).FirstOrDefault(); } }
public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { #if !DEBUG //show about information if this is the first time when the tool is used if (AddInApplication.Used == 0) { About.ShowFor(3); } AddInApplication.Used++; #endif //show UI var dlg = new SearchDialog(); var handle = new RevitHandle(); handle.SetAsOwnerTo(dlg); if (dlg.ShowDialog() != true) { return(Result.Cancelled); } //get search string var searchString = dlg.SearchText; //create proxy client for a BIM Library services var client = new BimLibraryService.BIMserviceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(Paths.BimServiceEndpoint)); //many exceptions may occure during service operation try { client.Open(); //search for a Revit products var products = client.GetProductByName(searchString); if (products.Length == 0) { TaskDialog.Show("Produkt nenalezen", "Nebyl nalezen žádný produkt odpovídající zadání."); //call this again to try is again; return(Execute(commandData, ref message, elements)); } //show result in a dialog where user can download the object into his project var resultsDlg = new SearchResultsDialog(); handle.SetAsOwnerTo(resultsDlg); resultsDlg.Products = products.Select(p => new ProductViewModel(p)); resultsDlg.ShowDialog(); } catch (FaultException customFaultEx) { return(FailGracefully(customFaultEx.Message)); } // The following is typically thrown on the client when a channel is terminated due to the server closing the connection. catch (ChannelTerminatedException cte) { return(FailGracefully(cte.Message)); } // The following is thrown when a remote endpoint could not be found or reached. The endpoint may not be found or // reachable because the remote endpoint is down, the remote endpoint is unreachable, or because the remote network is unreachable. catch (EndpointNotFoundException enfe) { return(FailGracefully(enfe.Message)); } // The following exception that is thrown when a server is too busy to accept a message. catch (ServerTooBusyException stbe) { return(FailGracefully(stbe.Message)); } catch (TimeoutException timeoutEx) { return(FailGracefully(timeoutEx.Message)); } catch (CommunicationException comException) { return(FailGracefully(comException.Message)); } catch (Exception e) { // rethrow any other exception not defined here throw e; } return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { #if !DEBUG //show about information if this is the first time when the tool is used if (AddInApplication.Used == 0) About.ShowFor(3); AddInApplication.Used++; #endif //show UI var dlg = new SearchDialog(); var handle = new RevitHandle(); handle.SetAsOwnerTo(dlg); if (dlg.ShowDialog() != true) return Result.Cancelled; //get search string var searchString = dlg.SearchText; //create proxy client for a BIM Library services var client = new BimLibraryService.BIMserviceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(Paths.BimServiceEndpoint)); //many exceptions may occure during service operation try { client.Open(); //search for a Revit products var products = client.GetProductByName(searchString); if (products.Length == 0) { TaskDialog.Show("Produkt nenalezen", "Nebyl nalezen žádný produkt odpovídající zadání."); //call this again to try is again; return Execute(commandData, ref message, elements); } //show result in a dialog where user can download the object into his project var resultsDlg = new SearchResultsDialog(); handle.SetAsOwnerTo(resultsDlg); resultsDlg.Products = products.Select(p => new ProductViewModel(p)); resultsDlg.ShowDialog(); } catch (FaultException customFaultEx) { return FailGracefully(customFaultEx.Message); } // The following is typically thrown on the client when a channel is terminated due to the server closing the connection. catch (ChannelTerminatedException cte) { return FailGracefully(cte.Message); } // The following is thrown when a remote endpoint could not be found or reached. The endpoint may not be found or // reachable because the remote endpoint is down, the remote endpoint is unreachable, or because the remote network is unreachable. catch (EndpointNotFoundException enfe) { return FailGracefully(enfe.Message); } // The following exception that is thrown when a server is too busy to accept a message. catch (ServerTooBusyException stbe) { return FailGracefully(stbe.Message); } catch (TimeoutException timeoutEx) { return FailGracefully(timeoutEx.Message); } catch (CommunicationException comException) { return FailGracefully(comException.Message); } catch (Exception e) { // rethrow any other exception not defined here throw e; } return Result.Succeeded; }