Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ChannelFactory <IMyDiskInfo> factory = new ChannelFactory <IMyDiskInfo>(
                new BasicHttpBinding(),
                new EndpointAddress("http://localhost/MyDiskInfo/ep2"));
            IMyDiskInfo channel = factory.CreateChannel();

            string free  = channel.FreeSpace("D:");
            string total = channel.TotalSpace("D:");

            Console.WriteLine("Free space: " + free);
            Console.WriteLine("Total space: " + total + "\n\n\n");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ChannelFactory <IMyDiskInfo> factory = new ChannelFactory <IMyDiskInfo>(new WSHttpBinding(),
                                                                                    new EndpointAddress("http://localhost:80/MyDiskInfo/ep1"));
            IMyDiskInfo channel = factory.CreateChannel();
            int         choice  = -1;
            string      diskName;
            bool        goOn = true;

            do
            {
                Console.Write("Введите имя диска: ");
                diskName = Console.ReadLine();
                Console.WriteLine("1 - Вывести размер диска?\n2 - Вывести размер свободного пространства диска?\n0 - Выход");
                choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 0:
                    goOn = false;
                    break;

                case 1:
                    Console.WriteLine(channel.TotalSpace(diskName));
                    break;

                case 2:
                    Console.WriteLine(channel.FreeSpace(diskName));
                    break;

                default:
                    Console.WriteLine("Неверный вывод");
                    break;
                }
            } while (goOn);
            factory.Close();
        }