public static UIProperty <TData> RegisterImport <TData>(this UiActor actor, string propertyName) where TData : notnull { var target = actor.LifetimeScope.Resolve <TData>(); return((UIProperty <TData>)actor.RegisterProperty <TData>(propertyName).WithDefaultValue(target).Property.LockSet()); }
public static ModelProperty RegisterModel <TModel>(this UiActor actor, string propertyName, string actorName) { var model = actor.LifetimeScope.Resolve <IViewModel <TModel> >(); model.InitModel(ObservableActor.ExposedContext, actorName); return(new ModelProperty(model.Actor, actor.RegisterProperty <IViewModel <TModel> >(propertyName).WithDefaultValue(model).Property.LockSet())); }
public static Func <TData> ShowDialog <TDialog, TData, TViewData>(this UiActor actor, Func <TViewData> initalData, params Parameter[] parameters) where TDialog : IBaseDialog <TData, TViewData> { _dialogCoordinator ??= actor.LifetimeScope.Resolve <IDialogCoordinator>(); return(() => { Task <TData>?task = null; actor.Dispatcher.Invoke(() => { var dialog = actor.LifetimeScope.Resolve <TDialog>(parameters); task = dialog.Init(initalData()); _dialogCoordinator.ShowDialog(dialog); }); var result = task !.Result; actor.Dispatcher.Invoke(() => _dialogCoordinator.HideDialog()); return result; }); }
public static Func <TData> ShowDialog <TDialog, TData>(this UiActor actor, Func <TData> initalData, params Parameter[] parameters) where TDialog : IBaseDialog <TData, TData> => ShowDialog <TDialog, TData, TData>(actor, initalData, parameters);
public static Func <TData> ShowDialog <TDialog, TData>(this UiActor actor, params Parameter[] parameters) where TDialog : IBaseDialog <TData, TData> => ShowDialog <TDialog, TData, TData>(actor, () => default !, parameters);