コード例 #1
0
        public App()
        {
            var appSetup = new FormsContainerSetup();

            AppContainer.GlobalVariableContainer = appSetup.CreateContainer();

            // NOTE: Dependency without injection
            _stateMachine = AppContainer.GlobalVariableContainer.Resolve <IStateMachineBase>();

            InitializeComponent();

            // MainPage = new MvvmAntipattern.MainPage();
            // MainPage = new TiredAndTrueMainPage { BindingContext = new TiredAndTrueMainViewModel() };

            // If the MainPage gets set too late, serious problems occur -- so this is just a precaution
            MainPage = new ContentPage();
        }
コード例 #2
0
        public App()
        {
            var appSetup = new FormsContainerSetup();

            AppContainer.GlobalVariableContainer = appSetup.CreateContainer();

            InitializeComponent();

            FakeStringService.Init();

            // MainPage = new MyPage { BindingContext = new MyViewModel() };
            // MainPage = new MyPage { BindingContext = new MyDeviceViewModel() };
            var foregroundViewModel = new BalloonListCollectionViewModel(true);
            var taskRunViewModel    = new BalloonListCollectionViewModel(false);

            MainPage = new Views.Pages.BalloonsAndListsPage {
                BindingContext = new BalloonsAndListsViewModel(foregroundViewModel, taskRunViewModel)
            };
        }
コード例 #3
0
        public App()
        {
            var appSetup = new FormsContainerSetup();

            AppContainer.GlobalVariableContainer = appSetup.CreateContainer();

            using (var scope = AppContainer.GlobalVariableContainer.BeginLifetimeScope())
            {
                _formsMessenger = scope.Resolve <IFormsMessenger>();
                _stateMachine   = scope.Resolve <IStateMachineBase>();
            }

            InitializeComponent();

            // MainPage = new MvvmAntipattern.MainPage();
            // MainPage = new TiredAndTrueMainPage { BindingContext = new TiredAndTrueMainViewModel() };

            // If the MainPage gets set too late, serious problems occur -- so this is just a precaution
            MainPage = new ContentPage();
        }