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

                // Request the same interface that was created at the local Xamarin.Forms setup.
                Machine = scope.Resolve <IStateMachineBase>();
            }
        }
Пример #4
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();
        }
Пример #5
0
        public MainMenu()
        {
            using (var scope = AppContainer.GlobalVariableContainer.BeginLifetimeScope())
            {
                _stateMachine   = scope.Resolve <IStateMachineBase>();
                _formsMessenger = scope.Resolve <IFormsMessenger>();
            }

            // Not really used
            BindingContext = this;

            VerticalOptions   = LayoutOptions.StartAndExpand;
            HorizontalOptions = LayoutOptions.CenterAndExpand;

            BackgroundColor = Colors.HEADER_AND_TOOLBAR_COLOR;
            Opacity         = MAIN_MENU_OPACITY;

            InputTransparent = ALLOW_EVENT_TUNNELING;

            LoadMenuFromStateMachine();
        }