public static void Open(string message, string title, Dialog.Buttons buttons, Dialog.Icon icon, Func <Result, Boolean> result) { DialogFactory window = new DialogFactory(); window.Open(message, title, buttons, icon, result); }
public static void Open(string message, string title, Dialog.Buttons buttons) { Open(message, title, buttons, Dialog.Icon.None); }
public static void Open(string message, string title, Dialog.Buttons buttons, Dialog.Icon icon) { Open(message, title, buttons, icon, null); }
public void Open(string message, string title, Dialog.Buttons buttons, Dialog.Icon icon, Func <Dialog.Result, Boolean> result) { this.callback_result = result; if (title != null) { this.title.Content = title; } if (message != null) { this.message.Text = message; } switch (icon) { case Dialog.Icon.Asterisk: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Asterisk.png", UriKind.Relative)); break; case Dialog.Icon.Error: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Error.png", UriKind.Relative)); break; case Dialog.Icon.Exclamation: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Exclamation.png", UriKind.Relative)); break; case Dialog.Icon.Hand: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Hand.png", UriKind.Relative)); break; case Dialog.Icon.Information: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Information.png", UriKind.Relative)); break; case Dialog.Icon.None: this.icon.Source = null; break; case Dialog.Icon.Question: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Question.png", UriKind.Relative)); break; case Dialog.Icon.Stop: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Stop.png", UriKind.Relative)); break; case Dialog.Icon.Warning: this.icon.Source = new BitmapImage(new Uri("/DSTEd;component/Assets/Dialog/Warning.png", UriKind.Relative)); break; } if (icon != Dialog.Icon.None) { this.icon.Width = 48; this.icon.Height = 48; } switch (buttons) { case Dialog.Buttons.None: this.UpdateButton(this.button_left, I18N.__("OK"), true, this.OnOK); this.UpdateButton(this.button_middle, null, false, null); this.UpdateButton(this.button_right, null, false, null); break; case Dialog.Buttons.AbortRetryIgnore: this.UpdateButton(this.button_left, I18N.__("Abort"), true, this.OnOK); this.UpdateButton(this.button_middle, I18N.__("Retry"), true, this.OnRetry); this.UpdateButton(this.button_right, I18N.__("Ignore"), true, this.OnIgnore); break; case Dialog.Buttons.OK: this.UpdateButton(this.button_left, I18N.__("OK"), true, this.OnOK); this.UpdateButton(this.button_middle, null, false, null); this.UpdateButton(this.button_right, null, false, null); break; case Dialog.Buttons.OKCancel: this.UpdateButton(this.button_left, I18N.__("OK"), true, this.OnOK); this.UpdateButton(this.button_middle, I18N.__("Cancel"), true, this.OnCancel); this.UpdateButton(this.button_right, null, false, null); break; case Dialog.Buttons.RetryCancel: this.UpdateButton(this.button_left, I18N.__("Retry"), true, this.OnRetry); this.UpdateButton(this.button_middle, I18N.__("Cancel"), true, this.OnCancel); this.UpdateButton(this.button_right, null, false, null); break; case Dialog.Buttons.YesNo: this.UpdateButton(this.button_left, I18N.__("Yes"), true, this.OnYes); this.UpdateButton(this.button_middle, I18N.__("No"), true, this.OnNo); this.UpdateButton(this.button_right, null, false, null); break; case Dialog.Buttons.YesNoCancel: this.UpdateButton(this.button_left, I18N.__("Yes"), true, this.OnYes); this.UpdateButton(this.button_middle, I18N.__("No"), true, this.OnNo); this.UpdateButton(this.button_right, I18N.__("Cancel"), true, this.OnCancel); break; } this.Closing += this.DialogFactory_Closing; Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, new Action(delegate() { this.ShowDialog(); })); }