Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Forms.Init(this, bundle);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            toolbar.NavigationClick += ToolbarOnNavigationClick;

            _lifetimeMonitor = Mvx.Resolve <IMvxAndroidActivityLifetimeListener>();
            _lifetimeMonitor.OnCreate(this, bundle);
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);
            var mvxFormsApp = new MvxFormsApplication();

            LoadApplication(mvxFormsApp);

            var presenter = (MvxFormsDroidPagePresenter)Mvx.Resolve <IMvxViewPresenter>();

            presenter.MvxFormsApp = mvxFormsApp;

            Mvx.Resolve <IMvxViewsContainer>()?.Add(typeof(MainViewModel), typeof(MainView));

            Mvx.Resolve <IMvxAppStart>().Start();
            _lifetimeListener = Mvx.Resolve <IMvxAndroidActivityLifetimeListener>();
            _lifetimeListener.OnCreate(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.tabbar;
            ToolbarResource   = Resource.Layout.toolbar;

            base.OnCreate(bundle);
            Forms.Init(this, bundle);
            MvxAndroidSetupSingleton.EnsureSingletonAvailable(ApplicationContext).EnsureInitialized();

            // register interactive alerts
            InteractiveAlerts.Init(() => this);
            Mvx.RegisterSingleton(InteractiveAlerts.Instance);

            var mvxFormsApp = new MvxFormsApplication();

            LoadApplication(mvxFormsApp);
            if (Mvx.Resolve <IMvxViewPresenter>() is CustomPresenter presenter)
            {
                presenter.FormsApplication = mvxFormsApp;
            }

            Mvx.Resolve <IMvxAppStart>().Start();

            //var cancellationToken = CancellationToken.None;
            //var autheService = Mvx.Resolve<IAuthenticationService>();
            //var needsToAuthenticate = autheService.NeedsToAuthenticate(cancellationToken).WaitAsync().Result;
            //if (needsToAuthenticate)
            //{
            //    try
            //    {
            //        var token = autheService.GetAccessToken("adam", "asdf3235", cancellationToken).WaitAsync().Result;
            //        var accessToken = token.Token;
            //    }
            //    catch (Exception ex)
            //    {

            //    }
            //}

            _lifetimeListener = Mvx.Resolve <IMvxAndroidActivityLifetimeListener>();
            _lifetimeListener.OnCreate(this);
        }
 public MvxLifecycleMonitorCurrentTopActivity(IMvxAndroidActivityLifetimeListener listener)
 {
     listener.ActivityChanged += Listener_ActivityChanged;
 }