Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
GeneralRe: PBX Call Log Pin
Member 1011228330-Apr-15 2:51
Member 1011228330-Apr-15 2:51 
GeneralRe: PBX Call Log Pin
Simon_Whale30-Apr-15 2:01
Simon_Whale30-Apr-15 2:01 
GeneralRe: PBX Call Log Pin
Member 1011228330-Apr-15 2:30
Member 1011228330-Apr-15 2:30 
GeneralRe: PBX Call Log Pin
Simon_Whale30-Apr-15 2:34
Simon_Whale30-Apr-15 2:34 
GeneralRe: PBX Call Log Pin
Member 1011228330-Apr-15 2:41
Member 1011228330-Apr-15 2:41 
GeneralRe: PBX Call Log PinPopular
F-ES Sitecore30-Apr-15 3:15
professionalF-ES Sitecore30-Apr-15 3:15 
AnswerRe: PBX Call Log Pin
BillWoodruff30-Apr-15 1:56
professionalBillWoodruff30-Apr-15 1:56 
QuestionWinForms Update A Dialog Pin
Kevin Marois29-Apr-15 9:24
professionalKevin Marois29-Apr-15 9:24 
[UPDATE] - Sorry, the formatting is all screwy.

First, it's been a while since I did any WinForms, and this isn't my app, sooo...

I need to call 2 methods, both of which download a file off a device. I want to first pop up a dialog with 2 progress bars and update them as the file is downloaded.

I can't get the dialog to refresh. The Progress bar's value IS being set. I just don't see any change.

So far I have:
private void DownloadDeviceFiles()
{
    // Create and display the progress dialog
    DownloadDialog dialog = new DownloadDialog();
    dialog.Text = "Retrieving Mission Data";
    dialog.Progress1Caption = "Config File";
    dialog.Progress2Caption = "Database";
    dialog.StartPosition = FormStartPosition.CenterScreen;
    dialog.Show(this);

    // Get the Config file, passing in the dialog to update
    DownloadConfigFile(dialog);

     .
     .
     .
     .

}

Then in the DownloadConfigFile method I have:
private bool DownloadConfigFile(DownloadDialog dialog)
{
    int percentDone = 0;
    int speed = 0;
    int downloadResponse = 0;
    int cause = 0;
    int totalTime = 0;
    int attempts = 0;
    bool isDownloaded = false;
    bool isFileRead = false;
    string message = string.Empty;

<pre>
while (attempts < 3)

{
// If the file has not yet been downloaded...
if (!isDownloaded)
{
// Download the file from the device to the local folder
ClientComm.GetFile(FileSystemLocations.TemoraryConfigurationFileLocation, null, (int)ClientComm.file_types.file_user_config, 0, 0);

// Get the file
string fileData = "";
while (true)
{
Thread.Sleep(10);

totalTime += 10;
MDF.ClientComm.FileProgress(out fileData, out percentDone, out speed, out downloadResponse, out cause);

dialog.Progress1PercentDone = percentDone;

if ((percentDone == 100) || (totalTime < MAX_CONFIG_DOWNLOAD_TIME) || dialog.Cancelled)
{
break;
}
}
}

}

return ConfigFileDownloaded;
}


Again, the problem is that the dialog does not refresh. What am I doing wrong here?

Thanks
If it's not broken, fix it until it is

GeneralRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 9:34
professionalSascha Lefèvre29-Apr-15 9:34 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 9:37
professionalKevin Marois29-Apr-15 9:37 
AnswerRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 10:32
professionalSascha Lefèvre29-Apr-15 10:32 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 10:37
professionalKevin Marois29-Apr-15 10:37 
GeneralRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 10:57
professionalSascha Lefèvre29-Apr-15 10:57 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 10:58
professionalKevin Marois29-Apr-15 10:58 
GeneralRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 11:17
professionalSascha Lefèvre29-Apr-15 11:17 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 11:23
professionalKevin Marois29-Apr-15 11:23 
GeneralRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 11:50
professionalSascha Lefèvre29-Apr-15 11:50 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 11:54
professionalKevin Marois29-Apr-15 11:54 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 12:23
professionalKevin Marois29-Apr-15 12:23 
AnswerRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 13:00
professionalSascha Lefèvre29-Apr-15 13:00 
GeneralRe: WinForms Update A Dialog Pin
Kevin Marois29-Apr-15 13:16
professionalKevin Marois29-Apr-15 13:16 
GeneralRe: WinForms Update A Dialog Pin
Sascha Lefèvre29-Apr-15 13:33
professionalSascha Lefèvre29-Apr-15 13:33 
QuestionFit text to label without changing label font and size Pin
Al-Rehman29-Apr-15 2:55
Al-Rehman29-Apr-15 2:55 
AnswerRe: Fit text to label without changing label font and size Pin
OriginalGriff29-Apr-15 4:58
mveOriginalGriff29-Apr-15 4:58 
GeneralRe: Fit text to label without changing label font and size Pin
Al-Rehman29-Apr-15 5:10
Al-Rehman29-Apr-15 5:10 

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.