public static UIModel <TModel> RegisterViewModel <TModel>(this UiActor actor, string name, IViewModel <TModel>?model = null) where TModel : class { model ??= actor.LifetimeScope.Resolve <IViewModel <TModel> >(); if (!model.IsInitialized) { model.InitModel(ObservableActor.ExposedContext, name); } return(new UIModel <TModel>( actor.RegisterProperty <IViewModel <TModel> >(name).WithDefaultValue(model).Property)); }
public static Func <Task <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(async() => { var result = await actor .Dispatcher .InvokeAsync(() => { var dialog = actor.LifetimeScope.Resolve <TDialog>(parameters); var task = dialog.Init(initalData()); _dialogCoordinator.ShowDialog(dialog); return task; }); actor.Dispatcher.Post(() => _dialogCoordinator.HideDialog()); return result; }); }
internal FluentPropertyRegistration(string name, UiActor actor) { Actor = actor; Property = new UIProperty <TData>(name); actor.RegisterProperty(Property); }
public static FluentCollectionPropertyRegistration <TData> RegisterUiCollection <TData>(this UiActor actor, string name) { actor.ThrowIsSeald(); return(new FluentCollectionPropertyRegistration <TData>(name, actor)); }
public DialogBuilder(IObservable <TInitialData> data, Parameter[] parameters, UiActor actor) { _data = data; _parameters = parameters; _actor = actor; }
public static DialogBuilder <TViewData> Dialog <TViewData>(this IObservable <TViewData> input, UiActor actor, params Parameter[] parameters) => new(input, parameters, actor);
//public static Func<Task<TData>> ShowDialog<TDialog, TData>(this UiActor actor, params Parameter[] parameters) // where TDialog : IBaseDialog<TData, TData> //{ // return ShowDialog<TDialog, TData, TData>(actor, () => default!, parameters); //} public static Func <Task <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 <Task <TData> > ShowDialog <TDialog, TData>(this UiActor actor, params Parameter[] parameters) where TDialog : IBaseDialog <TData, TData> => ShowDialog <TDialog, TData, TData>(actor, () => default !, parameters);
public static Task <TData> ShowDialogAsync <TDialog, TData>(this UiActor actor, params Parameter[] parameters) where TDialog : IBaseDialog <TData, TData> => ShowDialog <TDialog, TData>(actor, parameters)();