コード例 #1
0
        public App()
        {
            InitializeComponent();

            var assembly = Assembly.GetExecutingAssembly();

            var navigation = new ShellNavigationHelper();

            navigation.RegisterViewsInAssembly(assembly);

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterAssemblyTypes(assembly)
            .Where(x => x.IsSubclassOf(typeof(Page)));

            containerBuilder.RegisterAssemblyTypes(assembly)
            .Where(x => x.IsSubclassOf(typeof(ViewModelBase)));

            containerBuilder.RegisterInstance <INavigationHelper>(navigation);

            var container = containerBuilder.Build();

            Resolver.SetResolver(new AutofacResolver(container));



            MainPage = new AppShell();
        }
コード例 #2
0
        public App()
        {
            InitializeComponent();

            var currentAssembly = Assembly.GetExecutingAssembly();

            var navigationHelper = new ShellNavigationHelper();

            navigationHelper.RegisterViewsInAssembly(currentAssembly);

            var containerBuilder = new ContainerBuilder();

            containerBuilder.RegisterInstance <INavigationHelper>(navigationHelper);

            var appAssembly = typeof(App).GetTypeInfo().Assembly;

            containerBuilder.RegisterAssemblyTypes(appAssembly)
            .Where(x => x.IsSubclassOf(typeof(Page)));

            containerBuilder.RegisterAssemblyTypes(appAssembly)
            .Where(x => x.IsSubclassOf(typeof(ViewModelBase)));

            var container = containerBuilder.Build();

            Resolver.SetResolver(new AutofacResolver(container));

            TinyMvvm.Forms.TinyMvvm.Initialize();


            MainPage = new AppShell();
        }
コード例 #3
0
        void PacienteShell_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (Application.Current.MainWindow != null)
            {
                ShellNavigationHelper shellNavigationHelper = this.Container.GetExportedValue <ShellNavigationHelper>();
                shellNavigationHelper.SwitchShell(ShellType.ProfesionalShell);

                e.Cancel = true;
            }
        }
コード例 #4
0
ファイル: App.xaml.cs プロジェクト: PureWeen/TinyMvvm
        public App()
        {
            InitializeComponent();

            var navigationHelper = new ShellNavigationHelper();

            navigationHelper.RegisterRoute("about/contact", typeof(ContactView));

            navigationHelper.RegisterViewsInAssembly(Assembly.GetExecutingAssembly());

            TinyMvvm.Forms.TinyMvvm.Initialize();

            MainPage = new MainShell();
        }