//private delegate DialogResult showMessageDelegate(out string message);
        private static DialogResult showMessage(string status, bool shortview)
        {
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl showMessage invoked");
            var control = new UpdateInfoDialogControl {
                _dialogresult = DialogResult.None
            };

            AddControlToForm(control);
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl control to form added");
            control.Show(status, shortview);

            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl resume layout");
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl MSG cycle beginning");
            DebugHelper.FlushTraceBuffer();

            var msg = new MSG();

            while (GetMessage(out msg, IntPtr.Zero, 0, 0))
            {
                TranslateMessage(ref msg);
                DispatchMessage(ref msg);

                if (control._dialogresult != DialogResult.None)
                {
                    break;
                }
            }

            RemoveControlFromForm(control);
            DialogResult res = control._dialogresult;

            control.Dispose();
            return(res);
        }
 //Удалить контрол с формы
 private static void RemoveControlFromForm(UpdateInfoDialogControl control)
 {
     control.Hide();
     _masterForm.Controls.Remove(control);
     _masterForm.Menu = control._menu;
     _visibleDialogsCounter--;
 }
 //Добавить контрол на форму
 private static void AddControlToForm(UpdateInfoDialogControl control)
 {
     control.Location     = new Point(0, 0);
     control.Size         = _masterForm.ClientSize;
     control.Dock         = DockStyle.Fill;
     control.Visible      = false;
     control._initialized = true;
     _masterForm.Controls.Add(control);
     control.BringToFront();
     _visibleDialogsCounter++;
 }
        //private delegate DialogResult showMessageDelegate(out string message);
        private static DialogResult showMessage(string status, bool shortview)
        {
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl showMessage invoked");
            var control = new UpdateInfoDialogControl { _dialogresult = DialogResult.None };
            AddControlToForm(control);
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl control to form added");
            control.Show(status, shortview);

            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl resume layout");
            DebugHelper.WriteTraceEntry("PasswordRestoreDialogControl MSG cycle beginning");
            DebugHelper.FlushTraceBuffer();

            var msg = new MSG();
            while (GetMessage(out msg, IntPtr.Zero, 0, 0))
            {
                TranslateMessage(ref msg);
                DispatchMessage(ref msg);

                if (control._dialogresult != DialogResult.None)
                    break;
            }

            RemoveControlFromForm(control);
            DialogResult res = control._dialogresult;
            control.Dispose();
            return res;
        }
 //Удалить контрол с формы
 private static void RemoveControlFromForm(UpdateInfoDialogControl control)
 {
     control.Hide();
     _masterForm.Controls.Remove(control);
     _masterForm.Menu = control._menu;
     _visibleDialogsCounter--;
 }
 //Добавить контрол на форму
 private static void AddControlToForm(UpdateInfoDialogControl control)
 {
     control.Location = new Point(0, 0);
     control.Size = _masterForm.ClientSize;
     control.Dock = DockStyle.Fill;
     control.Visible = false;
     control._initialized = true;
     _masterForm.Controls.Add(control);
     control.BringToFront();
     _visibleDialogsCounter++;
 }