private void _ShowMessage() { var vm = new MessageBoxViewModel { Title = MessageBoxData.Title, Message = MessageBoxData.Message, Icon = MessageBoxData.Icon, ShowConfirm = MessageBoxData.ShowConfirm, ConfirmText = MessageBoxData.ConfirmText, ShowDecline = MessageBoxData.ShowDecline, DeclineText = MessageBoxData.DeclineText, ShowCancel = MessageBoxData.ShowCancel, CancelText = MessageBoxData.CancelText, DefaultAction = MessageBoxData.DefaultAction, AllowNonResponse = MessageBoxData.AllowNonResponse }; var view = new MessageBoxView { DataContext = vm, WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = this }; view.ShowDialog(); }
public async Task <T?> ShowDialog <T>(IMessageBox <T> messageBox) { MessageBoxView view = new MessageBoxView(); var viewModel = new MessageBoxViewModel <T>(messageBox); view.DataContext = viewModel; await view.ShowDialog <bool>(mainWindowHolder.Window); return(viewModel.SelectedOption); }
private static Task <DialogResult> ShowCore(Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options) { MessageBoxView window = new MessageBoxView(owner, options); window.DataContext = new MessageBoxViewModel(text, caption, buttons, window.GetIconDrawing(icon), defaultButton, options); return(owner != null?window.ShowDialog(owner) : window.Show()); }
private async void PresentMessages() { IEnumerator <string> enumerator = _messages.GetConsumingEnumerable().GetEnumerator(); while (await Task.Factory.StartNew(() => enumerator.MoveNext(), TaskCreationOptions.LongRunning)) { _window.Title = "Log entry occurred"; _window.Message = enumerator.Current; _window.ShowDialog(); } }
public static MessageBoxResult Show(Window parentWindow, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options) { MessageBoxViewModel viewModel = new MessageBoxViewModel(messageBoxText, caption, button, icon, defaultResult, options); MessageBoxView view = new MessageBoxView(); view.DataContext = viewModel; view.Owner = parentWindow; view.ShowDialog(); return(viewModel.Result); }
public MessageBoxResult ShowMessageBox(string text, string title, MessageBoxButton buttons, MessageBoxImage icon = MessageBoxImage.Asterisk, MessageBoxResult defaultResult = MessageBoxResult.None) { var vm = new MessageBoxViewModel(text, title, buttons, icon, defaultResult); var owner = _viewProvider.View; var popup = new MessageBoxView { Owner = owner, DataContext = vm }; _blur.Blur(); popup.ShowDialog(); _blur.UnBlur(); return(vm.Result); }
private static void OpenMessageWindow(StudioViewsFilesSplitViewModel model) { var messageInfo = new MessageInfo { Title = PluginResources.Message_Title_Task_Result, Message = model.Message, LogFilePath = model.LogFilePath, Folder = model.ExportPath, ShowImage = true, ImageUrl = model.Success ? "/Sdl.Community.StudioViews;component/Resources/information.png" : "/Sdl.Community.StudioViews;component/Resources/warning.png" }; var messageView = new MessageBoxView(); var messageViewModel = new MessageBoxViewModel(messageView, messageInfo); messageView.DataContext = messageViewModel; messageView.ShowDialog(); }
public static MessageBoxViewModel Show(string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, string dontShowAgainKey, bool isDependenciesButtonVisible, bool isError, bool isInfo, bool isQuestion, List <string> urlsFound, bool isDeleteAnywayButtonVisible, bool applyToAll) { // Check for don't show again option var dontShowAgainOption = GetDontShowAgainOption(dontShowAgainKey); var msgBoxViewModel = new MessageBoxViewModel(messageBoxText, caption, button, FontAwesomeIcon.ExclamationTriangle, isDependenciesButtonVisible, isError, isInfo, isQuestion, urlsFound, isDeleteAnywayButtonVisible, applyToAll); if (dontShowAgainOption.Item1) { // Return the remembered option msgBoxViewModel.Result = dontShowAgainOption.Item2; return(msgBoxViewModel); } if (caption != "Duplicated Resources") { urlsFound = new List <string>(); } var msgBoxView = new MessageBoxView { DataContext = msgBoxViewModel }; msgBoxViewModel.IsDuplicatesVisible = urlsFound.Count > 0; msgBoxViewModel.IsError = isError; msgBoxViewModel.IsInfo = isInfo; msgBoxViewModel.IsQuestion = isQuestion; msgBoxViewModel.IsDependenciesButtonVisible = isDependenciesButtonVisible; msgBoxViewModel.IsDeleteAnywayButtonVisible = isDeleteAnywayButtonVisible; msgBoxViewModel.ApplyToAll = applyToAll; msgBoxView.ShowDialog(); return(msgBoxViewModel); }