public T ShowDialog <T>(IView owner = null, IViewModel viewModel = null, DialogShowMethod method = DialogShowMethod.AddFront, Action <T> onShown = null) where T : class, IView { Action <T> newOnShown = dialog => { if (onShown != null) { onShown(dialog); } OnViewCreated(dialog); }; var result = _dialogManager.ShowDialog(GetViewTypeByView(typeof(T)), owner, viewModel, method, newOnShown); return(result); }
public IView ShowDialog(Type type, ViewType viewType, IView owner = null, IViewModel viewModel = null, DialogShowMethod method = DialogShowMethod.AddFront, Action <IView> onShown = null) { D.Log(LoggingTags.Events, "Open Dialog: " + type); IView dialog = null; if (Current == null && method == DialogShowMethod.Queued) { method = DialogShowMethod.AddFront; } switch (method) { case DialogShowMethod.AddFront: dialog = CreateDialog(type, owner, viewModel); if (Current != null) { dialog.Next = Current; } var currentScreen = _screensManager.Current; if (currentScreen != null) { currentScreen.OnBlur(); } break; case DialogShowMethod.CloseOthers: dialog = CreateDialog(type, owner, viewModel); if (Current != null) { CloseAll(); } break; case DialogShowMethod.Queued: if (Current != null) { _dialogQueue.Enqueue(new QueueData { mOpenDialogAction = () => ShowDialog(type, viewType, owner, viewModel, DialogShowMethod.AddFront, onShown), mOwnerScreen = owner }); return(null); } dialog = CreateDialog(type, owner, viewModel); break; } AfterCreateDialog(viewType, onShown, dialog); return(dialog); }
public ShowDialogMessage(ViewModelBase vmb, Window dialog, DialogShowMethod method, Action<bool?> callback = null) : this(dialog, method, callback) { this.ParentViewModel = vmb; }
/// <summary> /// Показать диалог с медиатором TDialogClass /// </summary> /// <typeparam name="T">Медиатор показываемого диалога</typeparam> /// <param name="viewType">Тип вьюмодели</param> /// <param name="owner">открывающий скрин. Может быть null</param> /// <param name="method">Способ отображения диалога</param> /// <param name="onShown"> </param> /// <returns>Инстанс медиатора диалога</returns> public T ShowDialog <T>(ViewType viewType, IView owner = null, IViewModel viewModel = null, DialogShowMethod method = DialogShowMethod.AddFront, Action <T> onShown = null) where T : class, IView { Action <IView> onShowAction = null; if (onShown != null) { onShowAction = a => onShown(a as T); } return(ShowDialog(typeof(T), viewType, owner, viewModel, method, onShowAction) as T); }
public ShowDialogMessage(Window dialog, DialogShowMethod method, Action<bool?> callback = null) { this.Dialog = dialog; this.ShowMethod = method; this.Calllback = callback; }