public static int ShwDlg(Screen screen, IntPtr ownerHandle, string title, string text, List <string> buttonsList, bool waitResponse, EventHandler <HtmlLinkClickedEventArgs> onLinkClicked = null) { // new message box var msgbox = new YamuiFormMessageBox(text, buttonsList, screen.WorkingArea.Height * 8 / 10, screen.WorkingArea.Width * 8 / 10) { ShowInTaskbar = !waitResponse, TopMost = true, Text = title }; if (onLinkClicked != null) { msgbox.LinkClicked += onLinkClicked; } var ownerRect = WinApi.GetWindowRect(ownerHandle); // center parent msgbox.Location = new Point((ownerRect.Width - msgbox.Width) / 2 + ownerRect.X, (ownerRect.Height - msgbox.Height) / 2 + ownerRect.Y); // get yamui form var curForm = FromHandle(ownerHandle); var yamuiForm = curForm as YamuiForm; // we either display a modal or a normal messagebox Transition.run(msgbox, "Opacity", 0d, 1d, new TransitionType_Linear(400)); if (waitResponse) { if (yamuiForm != null) { yamuiForm.HasModalOpened = true; } msgbox.ShowDialog(new WindowWrapper(ownerHandle)); if (yamuiForm != null) { yamuiForm.HasModalOpened = false; } // get focus back to owner WinApi.SetForegroundWindow(ownerHandle); } else { msgbox.Show(new WindowWrapper(ownerHandle)); } return(_dialogResult); }
public static int ShwDlg(Screen screen, IntPtr ownerHandle, string title, string text, List<string> buttonsList, bool waitResponse, EventHandler<HtmlLinkClickedEventArgs> onLinkClicked = null) { // new message box var msgbox = new YamuiFormMessageBox(text, buttonsList, screen.WorkingArea.Height*8/10, screen.WorkingArea.Width*8/10) { ShowInTaskbar = !waitResponse, TopMost = true, Text = title }; if (onLinkClicked != null) msgbox.LinkClicked += onLinkClicked; var ownerRect = WinApi.GetWindowRect(ownerHandle); // center parent msgbox.Location = new Point((ownerRect.Width - msgbox.Width)/2 + ownerRect.X, (ownerRect.Height - msgbox.Height)/2 + ownerRect.Y); // get yamui form var curForm = FromHandle(ownerHandle); var yamuiForm = curForm as YamuiForm; // we either display a modal or a normal messagebox Transition.run(msgbox, "Opacity", 0d, 1d, new TransitionType_Linear(400)); if (waitResponse) { if (yamuiForm != null) { yamuiForm.HasModalOpened = true; } msgbox.ShowDialog(new WindowWrapper(ownerHandle)); if (yamuiForm != null) { yamuiForm.HasModalOpened = false; } // get focus back to owner WinApi.SetForegroundWindow(ownerHandle); } else { msgbox.Show(new WindowWrapper(ownerHandle)); } return _dialogResult; }