Entrar
Últimos assuntos
Os membros mais ativos da semana
Nenhum usuário |
[C#] Gerenciador de Tarefas
3 participantes
Página 1 de 1
[C#] Gerenciador de Tarefas
[Tens de ter uma conta e sessão iniciada para poderes visualizar esta imagem]
Adicione:
Adicione:
2 Label
2 TextBox
2 Button
1 ProgressBar
1 folderBrowserDialog
Renomeie:
Label 1 >> Direct Link:
Label 2 >> Save File:
Button 1 >> Download
Button 2 >> Save File
De 2 cliques sobre o Form1 em cima de namespace vocês iram adicionar o seguinte codigo:
2 TextBox
2 Button
1 ProgressBar
1 folderBrowserDialog
Renomeie:
Label 1 >> Direct Link:
Label 2 >> Save File:
Button 1 >> Download
Button 2 >> Save File
De 2 cliques sobre o Form1 em cima de namespace vocês iram adicionar o seguinte codigo:
Código:
- Código:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
Depois de 2 cliques sobre o Button 1 e adicione o seguinte codigo:
Código:
- Código:
if (textBox2.Text == String.Empty)//having a if statement to make the program more comfort
{
MessageBox.Show("Please selet a destination to save the file");
}
else
{
WebClient Download_Client = new WebClient();//Declaring the webclient as Download_Client
Download_Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);//the event handler
Download_Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);// " "
Download_Client.DownloadFileAsync(new Uri(textBox1.Text.Trim().ToString()), textBox2.Text.Trim());// " "
}
}
Logo abaixo adicione:
Código:
- Código:
private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;//setting the progressbar value as downloadprogress
}
private void Completed(object sender, AsyncCompletedEventArgs e)
{
MessageBox.Show("Downloading Successful ", "Download_Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);//just a messagebox
progressBar1.Value = (0);//resetting the progressbar
textBox1.Text = "";//resetting the textbox
textBox2.Text = "";// " "
}
Agora de 2 cliques sobre o Button 2 e adicione o seguinte codigo:
Código:
- Código:
FolderBrowserDialog Save = new FolderBrowserDialog();//Declaring the folder browsing dialog
Save.RootFolder = Environment.SpecialFolder.Desktop;//setting to desktop
if (Save.ShowDialog() == DialogResult.OK)//An if statement to to show the path in textbox
{
textBox2.Text = Save.SelectedPath;
}
string Text = textBox1.Text.ToString();//formatting to string
string[] arry = Text.Split('/');//splitting /
for (int i = 0; i < Int32.Parse(arry.Length.ToString()); i++)//a for loop here
{
if (i == Int32.Parse(arry.Length.ToString()) - 1)
{
textBox2.Text += "\\" + arry[i].ToString();
}
}
}
Créditos:
srDIEGO2014
Harchel- Programadores
- Mensagens : 27
Reputação : 2
Moedas : 390
Cash : 0
Ocorrências :
Re: [C#] Gerenciador de Tarefas
Olá, Nao entendo nem pra que serve isso! ;-;
Alguns usuários vão achar bem útil. ^^
Alguns usuários vão achar bem útil. ^^
Re: [C#] Gerenciador de Tarefas
Creio que ele quis mostrar como criar um gerenciador de Download.-Kawaii escreveu:Olá, Nao entendo nem pra que serve isso! ;-;
Alguns usuários vão achar bem útil. ^^
Epiconnn- Bronze
- Mensagens : 50
Reputação : 0
Moedas : 143
Cash : 5
Ocorrências :
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|
Qui Jan 11, 2018 4:06 pm por Founder
» Canal no youtube! voltando
Qui Jan 11, 2018 4:05 pm por Founder
» Player.img GTA SA
Sex Out 14, 2016 2:48 pm por dr7games
» [iPixel] Atualizações - Back!
Seg Out 03, 2016 8:25 pm por Reset
» DDtank Pirata - Server TITAN
Dom Out 02, 2016 7:32 pm por Founder
» Diogo
Sáb Out 01, 2016 5:16 pm por Snnop
» (EXCLUSIVO) - Technic Laucher Crackeado/Pirata!
Sáb Out 01, 2016 11:48 am por dr7games
» [HABBO] Rockz Hotel
Qua Set 28, 2016 9:19 pm por Snnop
» Habbo novo - Peace
Qua Set 28, 2016 9:16 pm por Snnop
» Mega Habbo Net
Qua Set 28, 2016 9:15 pm por Snnop