Skousel jsem jeste toto a nejde nestahne se to
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Net;
using System.IO;
namespace WindowsFormsApplication7
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
Environment.ExpandEnvironmentVariables("%UserProfile%");
WebClient client = new WebClient();
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
client.DownloadFileAsync(new Uri("http://assets.minecraft.net/1_4_7/minecraft.jar"), @"C:\Users\%UserProfile%\AppData\Roaming\.minecraft\bin\minecraft.jar");
}
void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Hotovo nahrano");
progressBar1.Value = 0;
}
void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
string sFormatted = string.Format("{0} of {1}", e.BytesReceived, e.TotalBytesToReceive);
Invoke(new MethodInvoker(delegate
{
progressBar1.Value = e.ProgressPercentage;
}));
}
}
}