OnInitialize not called?

10 views
Skip to first unread message

Gerhard Kreuzer

unread,
Feb 16, 2011, 3:56:16 AM2/16/11
to nro...@googlegroups.com
Hi Rishi,
try to build a WPF app, starting with some splash screen and navigating through a login screen to the application shell.
 
I define a VM (ShellVM) which takes care about this startup process and some views, together with a MainWindow. (Sorry about the name of the VM, I am just trying around ..).
 

<

Assembly: DefineViewViewModel(GetType(MainWindow), GetType(ShellVM))>

<

Assembly: DefineViewViewModel(GetType(SplashView), GetType(ShellVM))>

<

Assembly: DefineViewViewModel(GetType(LoginView), GetType(ShellVM))>

<

Assembly: DefineViewViewModel(GetType(AdminRootView), GetType(AdminRootVM))>

'Associate urls with Views

<

Assembly: DefineNavigationContent("Pages/Splash/", GetType(SplashView))>

<

Assembly: DefineNavigationContent("Pages/Login/", GetType(LoginView))>

<

Assembly: DefineNavigationContent("Pages/AdminRoot/", GetType(AdminRootView))>

In Application.xaml I define MainWindow as starting point:

xmlns

:n="http://nRoute/schemas/2010/xaml"

StartupUri="MainWindow.xaml">

<!-- BOOTSTRAPPING -->

<n:Application.ApplicationLifetimeObjects>

<n:nRouteApplicationService>

........

And in the VM I override OnInitialize, but never ends there .....

..... ShellVM ....

#Region

"Constructor(s)"

Public Sub New()

myInstanceId =

Guid.NewGuid

Debug.Print("ShellVM " & myInstanceId.ToString & " -- New")

End Sub

#End

Region

Protected Overrides Sub OnIntialize(state As nRoute.Components.ParametersCollection)

MyBase.OnIntialize(state)

Debug.Print("ShellVM " & myInstanceId.ToString & " -- OnInitialize")

End Sub

 

I get the line from 'New', but never from 'OnInitialize', but the MainWindow cames up and shows the SplashView.

 

By the way, is there a recommended pattern to implement a splash screen, which is up during application composition (MEF ...) and than the switches over automatically to a login view, using NavigationService.Navigate( ....) ?

 

With best regards

 

Gerhard

Reply all
Reply to author
Forward
0 new messages