21 Aralık 2014 Pazar

C# Dosya İndirme Programı Yapımı Kodları

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net;
using System.ComponentModel;

namespace indir
{
    class Program
    {
        static void Main(string[] args)
        {

            string indirURL = "https://www.google.com.tr/logos/2012/shot_put-2012-hp.jpg";
            string klasor = "C:\\";
            string dsyadi = "LOGO.jpg";

            WebClient webClient = new WebClient();
            webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(tamamlandi);
            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(yuzde);
            webClient.DownloadFileAsync(new Uri(indirURL), klasor + dsyadi);

            Console.ReadLine();

        }
        private static void yuzde(object sender, DownloadProgressChangedEventArgs e)
        {
            Console.WriteLine("Dosya indiriliyor: %" + e.ProgressPercentage);
        }
        private static void tamamlandi(object sender, AsyncCompletedEventArgs e)
        {
            Console.WriteLine("Dosya İndirildi!!!");
        }
    }
}

Paylaş:

0 yorum:

Yorum Gönder

Popüler

Son

Kategoriler

Arşiv