/// <summary> /// Initializes a new instance of the ViewModelLocator class. /// </summary> public ViewModelLocator() { IIocContainer container; if (ViewModelBase.IsInDesignModeStatic) { // Create design time services and viewmodels container = new DesignTimeModule(); } else { // Create run time services and view models container = new RunTimeModule(); } var navigationService = container.Get <INavigationService>(); Messenger.Default.Register <MoveToViewMessage>(this, message => { switch (message.Page) { case Page.MainPage: navigationService.NavigateTo(MainPageUri); break; case Page.About: navigationService.NavigateTo(AboutPageUri); break; } }); _main = new MainViewModel(container.Get <IUrlShortener>()); _about = new AboutViewModel(); }
/// <summary> /// Initializes a new instance of the ViewModelLocator class. /// </summary> public ViewModelLocator() { IIocContainer container; if (ViewModelBase.IsInDesignModeStatic) { // Create design time services and viewmodels container = new DesignTimeModule(); } else { // Create run time services and view models container = new RunTimeModule(); } var navigationService = container.Get<INavigationService>(); Messenger.Default.Register<MoveToViewMessage>(this, message => { switch (message.Page) { case Page.MainPage: navigationService.NavigateTo(MainPageUri); break; case Page.About: navigationService.NavigateTo(AboutPageUri); break; } }); _main = new MainViewModel(container.Get<IUrlShortener>()); _about = new AboutViewModel(); }