/// <summary> /// Initializes a new instance of the <see cref="ScriptExplorerViewModel"/> class. /// </summary> /// <param name="controlParent"> /// The control Parent. /// </param> /// <param name="childControls"> /// The child Controls. /// </param> public ScriptExplorerViewModel(Grid controlParent, UserControl[] childControls) { Log.Enter(this, MethodBase.GetCurrentMethod().Name); this.editParameterControl = childControls[0] as EditParameterControl; if (this.editParameterControl != null) { this.editParameterControl.SetParent(controlParent); } this.messageBoxControl = childControls[1] as MessageBoxControl; if (this.messageBoxControl != null) { this.messageBoxControl.SetParent(controlParent); } }
public Task <MessageBoxResult> ShowMessageBox(string parentViewKey, string message = "", MessageBoxImage messageBoxImage = MessageBoxImage.Information, MessageBoxButton messageBoxButton = MessageBoxButton.OK) { var messageBoxViewKey = Guid.NewGuid().ToString(); var view = new MessageBoxControl { NavigationService = this, ViewKey = messageBoxViewKey, Message = message, MessageBoxImage = messageBoxImage, MessageBoxButton = messageBoxButton }; var modalResult = ShowModalInternal <MessageBoxResult>(view, messageBoxViewKey, parentViewKey, null, false, true); return(modalResult.Result); }
private ViewGroupNode CreateNewNodeFrom(string viewInstanceKey, string viewKey, object viewModel, bool isModal, bool isMessageBox) { FrameworkElement viewInstance; if (isMessageBox) { viewInstance = new MessageBoxControl(); } else { viewInstance = _viewLocator.GetViewInstance(viewKey); viewInstance.DataContext = viewModel; EnforceViewKey(viewInstance, viewModel, viewInstanceKey); } var internalViewInstance = viewInstance; if (isModal) { var modalHost = new ModalHostControl { ModalContent = viewInstance }; internalViewInstance = modalHost; } var viewInfo = new View(viewInstanceKey) { UIMetadata = GetUIMetadata(viewInstance, viewModel), ViewHostInstance = new ViewHostControl { View = internalViewInstance }, ViewInstance = viewInstance, ViewModelInstance = viewModel, IsModal = isModal, IsMessageBox = isMessageBox }; return(new ViewGroupNode(null, viewInfo)); }