/// <summary> /// Displays a notification dialog. /// </summary> public static void ShowNotifyDialog(string heading, string text, string image, string buttonText, int timeout) { if (GUIGraphicsContext.form.InvokeRequired) { ShowNotifyDialogDelegate d = ShowNotifyDialog; GUIGraphicsContext.form.Invoke(d, heading, text, image, buttonText, timeout); return; } GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); if (pDlgNotify == null) { return; } try { pDlgNotify.Reset(); pDlgNotify.SetHeading(heading); pDlgNotify.SetImage(image); pDlgNotify.SetText(text); if (timeout >= 0) { pDlgNotify.TimeOut = timeout; } foreach (GUIControl item in pDlgNotify.GetControlList()) { if (item is GUIButtonControl) { GUIButtonControl btn = (GUIButtonControl)item; if (btn.GetID == 4 && !string.IsNullOrEmpty(buttonText) && !string.IsNullOrEmpty(btn.Label)) { // Only if ID is 4 and we have our custom text and if button already has label (in case the skin "hides" the button by emtying the label) btn.Label = buttonText; } } } pDlgNotify.DoModal(GUIWindowManager.ActiveWindow); } finally { if (pDlgNotify != null) { pDlgNotify.ClearAll(); } } }