Example #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);
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Tax settings
            var taxes = new TaxEstimatorSelector();
            taxes.AddTaxRate(
                TaxPeriod.FY2009,
                new TaxEstimator(
                    new TaxBracketSelector(
                        new TaxBracket(-1, 6000M, 0, 0),
                        new TaxBracket(6000M, 35000M, 0, 0.15M),
                        new TaxBracket(35000M, 80000M, 4350, 0.30M),
                        new TaxBracket(80000M, 180000M, 17850, 0.38M),
                        new TaxBracket(180000M, decimal.MaxValue, 55850, 0.45M)
                        ),
                    new MedicareLevy(70000, 0.015M))
                );
            taxes.AddTaxRate(
                TaxPeriod.FY2010,
                new TaxEstimator(
                    new TaxBracketSelector(
                        new TaxBracket(-1, 6000M, 0, 0),
                        new TaxBracket(6000M, 37000M, 0, 0.15M),
                        new TaxBracket(37000M, 80000M, 4650, 0.30M),
                        new TaxBracket(80000M, 180000M, 17550, 0.37M),
                        new TaxBracket(180000M, decimal.MaxValue, 54550, 0.45M)
                        ),
                    new MedicareLevy(70000, 0.015M))
                );

            // Configure Magellan
            var controllerFactory = new AsyncControllerFactory();
            controllerFactory.Register("Home", () => new HomeController());
            controllerFactory.Register("Tax", () => new TaxController(taxes));

            var routes = new ControllerRouteCatalog(controllerFactory);
            routes.MapRoute("{controller}/{action}/{id}", new {controller = "Home", action = "Index", id = ""});

            var factory = new NavigatorFactory("tax", routes);
            var mainWindow = new MainWindow(factory);
            mainWindow.MainNavigator.Navigate<HomeController>(x => x.Index());
            mainWindow.Show();
        }
Example #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;
        }