Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
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 
Why not use a MethodInvoker that wraps the download code. I could pass that to the dialog, then in the Shown event I could fire it off.

The only question then is how does that code update the UI?

Something like this:
private MethodInvoker GetConfigFileDownloadInvoker()
{
    MethodInvoker invoker = new MethodInvoker(delegate
    {
    });

    return invoker;
}

private MethodInvoker GetDatabaseDownloadInvoker()
{
    MethodInvoker invoker = new MethodInvoker(delegate
    {
    });

    return invoker;
}

private void DownloadDeviceFiles()
{
    DatabaseDownloaded = false;
    ConfigFileDownloaded = false;

    MethodInvoker invoker1 = GetConfigFileDownloadInvoker();
    MethodInvoker invoker2 = GetDatabaseDownloadInvoker();

    dialog = new DownloadDialog(invoker1, invoker2);
    dialog.Text = "Retrieving Mission Data";
    dialog.Progress1Caption = "Config File";
    dialog.Progress2Caption = "Database";
    dialog.StartPosition = FormStartPosition.CenterScreen;

    // Blocks and fires off the invokers
    dialog.ShowDialog(this);

    if (!ConfigFileDownloaded || !DatabaseDownloaded)
    {
        // TODO: Return to connection mode
        OnDisconnected(EventArgs.Empty);
    }
}
If it's not broken, fix it until it is


modified 29-Apr-15 17:32pm.

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 
GeneralRe: Fit text to label without changing label font and size Pin
Sascha Lefèvre29-Apr-15 5:14
professionalSascha Lefèvre29-Apr-15 5:14 
GeneralRe: Fit text to label without changing label font and size Pin
Pete O'Hanlon29-Apr-15 5:15
mvePete O'Hanlon29-Apr-15 5:15 
GeneralRe: Fit text to label without changing label font and size Pin
OriginalGriff29-Apr-15 5:22
mveOriginalGriff29-Apr-15 5:22 
Questionc# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Pranita Gupta29-Apr-15 0:14
professionalPranita Gupta29-Apr-15 0:14 
AnswerRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Pete O'Hanlon29-Apr-15 0:18
mvePete O'Hanlon29-Apr-15 0:18 
AnswerRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Eddy Vluggen29-Apr-15 1:12
professionalEddy Vluggen29-Apr-15 1:12 
GeneralRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
OriginalGriff29-Apr-15 4:59
mveOriginalGriff29-Apr-15 4:59 
QuestionWhy designer save Bad COORDINATES of UserControl's Child (EnableDesign) ? Pin
Emanuele Bonin28-Apr-15 23:39
Emanuele Bonin28-Apr-15 23:39 

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.