You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, the above two methods will cause the view not to be displayed until inner module actived, so it's not very good.
So I can change active module from OnInitializeAsync to OnViewLoaded, But it can not await, it means we lost control of logic, override async methods has lost value too.
// class MainViewModel.publicclassMainViewModel:Conductor<IMainModule>.Collection.OneActive
{publicMainViewModel(IEnumerable<IMainModule>modules){
Items.AddRange(modules);ActiveItem= Items.FirstOrDefault();}protectedoverridevoidOnViewLoaded(objectview){base.OnViewLoaded(view);ActiveItem= Items.FirstOrDefault();}}// class FirstModuleViewModelpublicclassModuleFirst:IMainModule{// this is bad.protectedoverridevoidOnViewLoaded(objectview){base.OnViewLoaded(view);_= LoadDataFromWebApiAsync();}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Suppose I have the following structure:
I will regist all modules for IMainModule, and inject modules in Main.
The first place of doubt: How to active first module after main module loaded (actived)?
The 1st way, Specify one in advance.
The 2nd way, after parent active.
However, the above two methods will cause the view not to be displayed until inner module actived, so it's not very good.
So I can change active module from OnInitializeAsync to OnViewLoaded, But it can not await, it means we lost control of logic, override async methods has lost value too.
Beta Was this translation helpful? Give feedback.
All reactions