static void Main(string[] args) { Console.WriteLine(MyUaClient.Greet()); Console.WriteLine("Type the URL to use and press Enter."); System.Console.WriteLine("(default if empty: opc.tcp://localhost:4840): "); var serverUrl = Console.ReadLine(); if (serverUrl == String.Empty) { serverUrl = "opc.tcp://*****:*****@"Endpoint #{0}", i); System.Console.WriteLine("\t{0}", endpoint[0]); System.Console.WriteLine("\t{0}", endpoint[1]); System.Console.WriteLine("\t{0}", endpoint[2]); i++; } Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
// public async Task<IActionResult> OnPostAsync() public IActionResult OnPost() { if (ModelState.IsValid) { Endpoints.Clear(); try{ if (OpcUaServerUrl == null || OpcUaServerUrl == String.Empty) { Endpoints = MyUaClient.GetEndpoints(new Uri("opc.tcp://localhost:4840")); } else { Endpoints = MyUaClient.GetEndpoints(new Uri(OpcUaServerUrl)); } } catch (Exception e) { System.Console.WriteLine(e.Message); } return(Page()); } return(RedirectToPage("/Index")); }