Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);

            // Setup controllers
            var controllerFactory = new AsyncControllerFactory();
            controllerFactory.Register("Home", () => new HomeController());
            controllerFactory.Register("Phone", () => new PhoneController(new InMemoryContactRepository()));
            controllerFactory.Register("Mail", () => new MailController());
            controllerFactory.Register("Settings", () => new SettingsController());

            // Setup transitions
            NavigationTransitions.Table.Add("Back", "Forward", () => new SlideTransition(SlideDirection.Back));
            NavigationTransitions.Table.Add("Forward", "Back", () => new SlideTransition(SlideDirection.Forward));
            NavigationTransitions.Table.Add("ZoomIn", "ZoomOut", () => new ZoomInTransition());
            NavigationTransitions.Table.Add("ZoomOut", "ZoomIn", () => new ZoomOutTransition());

            // Setup routes
            var routes = new ControllerRouteCatalog(controllerFactory);
            routes.MapRoute("{controller}/{action}");

            // Show the main window
            var main = new MainWindow();

            var navigation = new NavigatorFactory(routes);
            var navigator = navigation.CreateNavigator(main.Frame);
            main.Navigator = navigator;

            main.Show();

            base.OnStartup(e);
        }
Beispiel #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            var views = new ViewModelFactory();
            views.Register("Search", () => new SearchView(), () => new SearchViewModel(new SearchService()));
            views.Register("Details", () => new DetailsView(), () => new DetailsViewModel(new DetailsService()));

            var routes = new ViewModelRouteCatalog(views);
            routes.MapRoute("views/details/{id}", new { viewModel = "Details" });
            routes.MapRoute("views/{viewModel}");

            var shell = new ShellWindow();
            var navigation = new NavigatorFactory(routes);
            var navigator = navigation.CreateNavigator(shell.MainContent);
            shell.Show();

            navigator.Navigate("views/Search");
        }
Beispiel #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var controllers = new AsyncControllerFactory();
            controllers.Register("Wizard", () => new WizardController());

            var routes = new ControllerRouteCatalog(controllers);
            routes.MapRoute("wizard/{action}", new { controller = "Wizard"});

            var navigation = new NavigatorFactory(routes);

            var main = new MainWindow();
            navigation.ProgressListeners.Add(main);
            main.Show();

            var navigator = navigation.CreateNavigator(main.MainFrame);
            navigator.Navigate<WizardController>(x => x.Welcome());

            DispatcherUnhandledException += OnDispatcherUnhandledException;
            base.OnStartup(e);

            Magellan.Diagnostics.TraceSources.MagellanSource.Switch.Level = SourceLevels.Verbose;
        }
Beispiel #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            DispatcherUnhandledException += (x, y) => MessageBox.Show(y.Exception.Message);

            NavigationTransitions.Table.Add("Backward", "Forward", () => new SlideTransition(SlideDirection.Back));
            NavigationTransitions.Table.Add("Forward", "Backward", () => new SlideTransition(SlideDirection.Forward));

            var controllers = new ControllerFactory();
            controllers.Register("Home", () => new HomeController());

            var routes = new ControllerRouteCatalog(controllers);
            routes.MapRoute("{controller}/{action}");

            var navigation = new NavigatorFactory(routes);
            var mainWindow = new MainWindow();
            var navigator = navigation.CreateNavigator(mainWindow.MainFrame);
            mainWindow.Show();

            navigator.NavigateWithTransition("Home", "Index", "Forward");
        }
 public void InitializeNavigator(NavigatorFactory navFactory)
 {
     _navigator = navFactory.CreateNavigator(mainFrame);
     RegisterMessageHandlers();
 }