Exemple #1
0
        private static void PrintUPSList(string upsdServer, bool displayDesc)
        {
            UPSDClient client = new UPSDClient(upsdServer);

            try
            {
                client.Connect();
                List <UPS> upsList = client.ListUPS();
                foreach (UPS ups in upsList)
                {
                    Console.Write(ups.Name);
                    if (displayDesc)
                    {
                        Console.Write(": " + ups.Description);
                    }
                    Console.WriteLine();
                }
            }
            catch (SocketException sockex)
            {
                Console.WriteLine("Error: " + sockex.Message);
            }
            catch (UPSException upsex)
            {
                Console.WriteLine("Error: " + upsex.Description);
            }
            finally
            {
                client.Disconnect();
            }
        }