示例#1
0
        public void DownloadVideo(int id)
        {
            if (videoService == null)
            {
                videoService = new VideoService();
            }

            if (!videoService.GetListVideo().Exists(x => x == id))
            {
                videoService.DownloadVideo(id);
            }
            else
            {
                Console.WriteLine("Видео уже загружено");
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Прокси Сервиса");
            IVideoService service = new ProxyVideoService();

            Console.WriteLine(service.GetVideoInfo(5));
            service.DownloadVideo(45);
            service.DownloadVideo(2);
            service.DownloadVideo(45);
            service.DownloadVideo(8);
            Console.WriteLine(service.GetVideoInfo(8));
            service.GetListVideo().ForEach(item => Console.WriteLine("item: " + item));

            Console.WriteLine("Сервис");
            service = new VideoService();
            Console.WriteLine(service.GetVideoInfo(5));

            Console.Read();
        }