int DialogInitCallback(string title, string message, string button) { mainForm.ProcessTimer.Stop(); CallbackDialogForm dialog = new CallbackDialogForm(); dialog.Text = title; dialog.CallbackDialogFilenameLabel.Visible = false; dialog.CallbackDialogFilesProgressBar.Visible = false; dialog.CallbackDialoglMessageLabel.Text = message; // Check if the button string needs to be parsed if (button.IndexOf("/") != -1) { string[] buttons = button.Split(new Char[] { '/' }); dialog.buttons = buttons; for (int i = 0; i < buttons.Length; i++) { switch (i) { case 0: dialog.CallbackDialogOptional1Button.Text = buttons[i]; dialog.CallbackDialogOptional1Button.Visible = true; break; case 1: dialog.CallbackDialogOptional2Button.Text = buttons[i]; dialog.CallbackDialogOptional2Button.Visible = true; break; case 2: dialog.CallbackDialogOptional3Button.Text = buttons[i]; dialog.CallbackDialogOptional3Button.Visible = true; break; case 3: dialog.CallbackDialogOptional4Button.Text = buttons[i]; dialog.CallbackDialogOptional4Button.Visible = true; break; default: // Error break; } } } else { dialog.CallbackDialogCancelButton.Visible = true; dialog.CallbackDialogCancelButton.Text = button; } mainForm.Activate(); // This dialog should be pushed to topmost when it doesn't have a parent or else it can ger lost behind other apps. // You would think this is simple but for some reason MOG has really struggled with these dialogs being kept on top... // We have tried it all and finally ended up with this...toggling the TopMost mode seems to be working 100% of the time. dialog.TopMost = true; dialog.TopMost = false; dialog.TopMost = true; dialog.Show(); // Record the window tag for this form dialog.Tag = windowId++; mDialogs.Add(dialog); mainForm.ProcessTimer.Start(); dialog.Refresh(); return((int)dialog.Tag); }
int DialogInitCallback(string title, string message, string button) { CallbackDialogForm dialog = new CallbackDialogForm(); dialog.Text = title; dialog.CallbackDialogFilenameLabel.Visible = false; dialog.CallbackDialogFilesProgressBar.Visible = false; dialog.CallbackDialoglMessageLabel.Text = message; // Check if the button string needs to be parsed if (button.IndexOf("/") != -1) { string [] buttons = button.Split(new Char[] { '/' }); dialog.buttons = buttons; for (int i = 0; i < buttons.Length; i++) { switch (i) { case 0: dialog.CallbackDialogOptional1Button.Text = buttons[i]; dialog.CallbackDialogOptional1Button.Visible = true; break; case 1: dialog.CallbackDialogOptional2Button.Text = buttons[i]; dialog.CallbackDialogOptional2Button.Visible = true; break; case 2: dialog.CallbackDialogOptional3Button.Text = buttons[i]; dialog.CallbackDialogOptional3Button.Visible = true; break; case 3: dialog.CallbackDialogOptional4Button.Text = buttons[i]; dialog.CallbackDialogOptional4Button.Visible = true; break; default: // Error break; } } } else if (button == "") { dialog.CallbackDialogCancelButton.Visible = false; } else { dialog.CallbackDialogCancelButton.Visible = true; dialog.CallbackDialogCancelButton.Text = button; } dialog.Show(); // Record the window tag for this form dialog.Tag = windowId++; mDialogs.Add(dialog); Application.DoEvents(); return((int)dialog.Tag); }