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
The OnInitializeAsync method of the Screen class "blocks" the view from getting display until the view model has been initialized. This is not the expected behaviour as it basically defeats the purpose of initializing the view model asynchronously in the first place. The issue is easy to reproduce in a WPF project that references the 4.0.47-alpha version.
public class ShellViewModel : Conductor<IScreen>.Collection.AllActive
{
public ShellViewModel()
{
Items.Add(new ChildViewModel() { DisplayName = "Child..." });
}
}
ChildViewModel:
public class YmerViewModel : Screen
{
protected override async Task OnInitializeAsync(CancellationToken cancellationToken)
{
//simulate some initialization work...
await Task.Run(() => Thread.Sleep(5000));
}
}
Bootstrapper:
public class Bootstrapper : BootstrapperBase
{
public Bootstrapper() => Initialize();
protected override void OnStartup(object sender, StartupEventArgs e) =>
DisplayRootViewFor<ShellViewModel>(s_windowSettings);
}
Using the above sample code, it takes five seconds for the main window to show up. This can be fixed by modifying the ChangeActiveItemAsync method of the ConductorBaseWithActiveItem<T> class slightly. I'll submit a pull request.
The text was updated successfully, but these errors were encountered:
The
OnInitializeAsync
method of theScreen
class "blocks" the view from getting display until the view model has been initialized. This is not the expected behaviour as it basically defeats the purpose of initializing the view model asynchronously in the first place. The issue is easy to reproduce in a WPF project that references the 4.0.47-alpha version.ShellView:
ShellViewModel:
ChildViewModel:
Bootstrapper:
Using the above sample code, it takes five seconds for the main window to show up. This can be fixed by modifying the
ChangeActiveItemAsync
method of theConductorBaseWithActiveItem<T>
class slightly. I'll submit a pull request.The text was updated successfully, but these errors were encountered: