Esempio n. 1
0
 private static Guid ConfigurePortsOrExit(SmlComServiceClient proxy, DateTime configuredAt, Guid clientGuid)
 {
     try
     {
         string configureResult = proxy.ConfigurePorts(portList.ToArray(), null);
         Console.WriteLine("Configure Result: {0}", configureResult);
         if (configureResult.StartsWith("ERROR"))
         {
             Console.WriteLine(
                 "Seconds elapsed: {0}. A handled configuration error has occured: {1}.",
                 (DateTime.Now - configuredAt).Duration().TotalSeconds,
                 configureResult);
         }
         else
         {
             clientGuid = Guid.Parse(configureResult);
             Console.WriteLine(
                 "Seconds elapsed: {0}. Client GUID obtained from service: {1}.",
                 (DateTime.Now - configuredAt).Duration().TotalSeconds,
                 clientGuid);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("A unhandled configuration error has occured. {0} - {1}.", ex.Message, ex.StackTrace);
         Console.ReadLine();
         Application.Exit();
     }
     return clientGuid;
 }