Click here to Skip to main content
15,900,818 members
Home / Discussions / C#
   

C#

 
QuestionHow to run windows service on remote server Pin
tmieruch30-Mar-09 4:40
tmieruch30-Mar-09 4:40 
QuestionSHCameraCapture Pin
Craigjw30-Mar-09 3:51
Craigjw30-Mar-09 3:51 
AnswerRe: SHCameraCapture Pin
musefan30-Mar-09 4:08
musefan30-Mar-09 4:08 
GeneralRe: SHCameraCapture Pin
Craigjw30-Mar-09 5:17
Craigjw30-Mar-09 5:17 
QuestionHow to display Progress Bar while application is in operation? Pin
Nopo30-Mar-09 3:40
Nopo30-Mar-09 3:40 
AnswerRe: How to display Progress Bar while application is in operation? Pin
DaveyM6930-Mar-09 3:47
professionalDaveyM6930-Mar-09 3:47 
AnswerRe: How to display Progress Bar while application is in operation? Pin
Abhijit Jana30-Mar-09 3:48
professionalAbhijit Jana30-Mar-09 3:48 
AnswerRe: How to display Progress Bar while application is in operation? Pin
musefan30-Mar-09 3:57
musefan30-Mar-09 3:57 
Create a background worker in your application.

It has three events that you will want to handle.

.DoWork:
put you code that does the upload file here, at the end of each file report the progress as a percentage ( 100 / totalNumFiles * numFilesUploaded), this is done via BackgroundWorker1.ReportProgress()

.ProgressChanged:
update your progress bar value with the percentage passed as in the event args i.e. ProgressBar1.Value = e.ProgressPercentage

.WorkerComplete:
notify the user that the uploading has been complete or whatever you do after its finished.



Once you have coded these event handlers you can start the upload with BackgroundWorker1.RunWorkerAsync();
As this will start a new thread you will need to pass any data that your uploading code may need as parameters to the above function

i.e

string[] filepaths = {"file1", "file2"};
string destinationPath = "destination path";

BackgroundWorker1.RunWorkerAsync(new object[]{filepaths, destinationPath});


then at the start of your .DoWork event handler you can aquire these value with the following code:

object[] args = (object[])e.Argument;
string[] filepaths = (string[])args[0];
string destinationPath = (string)args[1];


Life goes very fast. Tomorrow, today is already yesterday.

Questionstarting Windows service again on exception.. Pin
Mubeen.asim30-Mar-09 3:26
Mubeen.asim30-Mar-09 3:26 
AnswerRe: starting Windows service again on exception.. Pin
musefan30-Mar-09 3:32
musefan30-Mar-09 3:32 
GeneralRe: starting Windows service again on exception.. Pin
Mubeen.asim30-Mar-09 3:38
Mubeen.asim30-Mar-09 3:38 
GeneralRe: starting Windows service again on exception.. Pin
musefan30-Mar-09 3:44
musefan30-Mar-09 3:44 
GeneralRe: starting Windows service again on exception.. Pin
Mubeen.asim30-Mar-09 3:50
Mubeen.asim30-Mar-09 3:50 
GeneralRe: starting Windows service again on exception.. Pin
musefan30-Mar-09 4:02
musefan30-Mar-09 4:02 
GeneralRe: starting Windows service again on exception.. Pin
Mubeen.asim30-Mar-09 4:06
Mubeen.asim30-Mar-09 4:06 
GeneralRe: starting Windows service again on exception.. Pin
musefan30-Mar-09 4:12
musefan30-Mar-09 4:12 
GeneralRe: starting Windows service again on exception.. Pin
Mubeen.asim30-Mar-09 4:16
Mubeen.asim30-Mar-09 4:16 
GeneralRe: starting Windows service again on exception.. Pin
musefan30-Mar-09 4:19
musefan30-Mar-09 4:19 
QuestionWriting XML into URL using dataset( Windows Application) Pin
K V Sekhar30-Mar-09 3:24
K V Sekhar30-Mar-09 3:24 
AnswerRe: Writing XML into URL using dataset( Windows Application) Pin
musefan30-Mar-09 3:29
musefan30-Mar-09 3:29 
GeneralRe: Writing XML into URL using dataset( Windows Application) Pin
K V Sekhar30-Mar-09 3:38
K V Sekhar30-Mar-09 3:38 
GeneralRe: Writing XML into URL using dataset( Windows Application) Pin
musefan30-Mar-09 3:47
musefan30-Mar-09 3:47 
QuestionClipboard Text Pin
satsumatable30-Mar-09 1:53
satsumatable30-Mar-09 1:53 
AnswerRe: Clipboard Text Pin
musefan30-Mar-09 2:31
musefan30-Mar-09 2:31 
AnswerRe: Clipboard Text Pin
N a v a n e e t h30-Mar-09 2:38
N a v a n e e t h30-Mar-09 2:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.