public Bootstrapper(ViewModelRegistry vmRegistry) { if (vmRegistry == null) throw new ArgumentNullException("vmRegistry is null."); _vmRegistry = vmRegistry; var numDiceVm = getNumberDiceViewModel(); var numSidesVm = getNumberSidesViewModel(); var rollModeVm = getRollModeViewModel(); var randomModeVm = getRandomModeViewModel(); _mainViewModel = new MainViewModel(numDiceVm, numSidesVm, rollModeVm, randomModeVm) { View = ViewReference.MainPage }; _vmRegistry.RegisterViewModel(typeof(MainPage), x => _mainViewModel); }
// Do not add any additional code to this method private void InitializePhoneApplication() { if (phoneApplicationInitialized) return; // Create the frame but don't set it as RootVisual yet; this allows the splash // screen to remain active until the application is ready to render. RootFrame = new TransitionFrame(); ViewModelRegistry = new ViewModelRegistry(RootFrame); RootFrame.Navigated += CompleteInitializePhoneApplication; // Handle navigation failures RootFrame.NavigationFailed += RootFrame_NavigationFailed; // Ensure we don't initialize again phoneApplicationInitialized = true; }