public void Setup(string title, string message, string option, MessageOverlayTypes type, DoneCallbackMethod doneCallback) { // cancel pending message if (this.doneCallback != null) { doneCallback(MessageOverlayResults.Cancel); } this.doneCallback = doneCallback; // setup titleTextBox.Text = title; messageLabel.Text = message; if (option != null) { optionCheckBox.IsChecked = true; optionCheckBox.Content = option; optionCheckBox.Visibility = Visibility.Visible; } else { optionCheckBox.IsChecked = false; optionCheckBox.Visibility = Visibility.Hidden; } if (type == MessageOverlayTypes.Ok) { okButton.Content = "Ok"; cancelButton.Visibility = Visibility.Hidden; } else if (type == MessageOverlayTypes.OkCancel) { okButton.Content = "Ok"; cancelButton.Content = "Cancel"; cancelButton.Visibility = Visibility.Visible; } else { okButton.Content = "Yes"; cancelButton.Content = "No"; cancelButton.Visibility = Visibility.Visible; } }
public void ShowMessageOverlay(string title, string message, string option, MessageOverlayTypes type = MessageOverlayTypes.Ok, MessageOverlay.DoneCallbackMethod doneCallback = null) { ShowMessageOverlayInternal(title, message, option, type, doneCallback); }
private void ShowMessageOverlayInternal(string title, string message, string option, MessageOverlayTypes type, MessageOverlay.DoneCallbackMethod doneCallback) { if (Dispatcher.CheckAccess()) { messageOverlay.Setup(title, message, option, type, doneCallback); messageOverlay.Visibility = Visibility.Visible; } else { Dispatcher.InvokeAsync(delegate() { messageOverlay.Setup(title, message, option, type, doneCallback); messageOverlay.Visibility = Visibility.Visible; }); } }