コード例 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            if (ConfigurationManager.AppSettings == null)
            {
                ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);
            }
#if !DEBUG
            AppCenter.Start("6d9840ff-d832-4c1b-a2ee-bac7f15d89bd", typeof(Analytics), typeof(Crashes));
#endif

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Popup.Init(this, bundle);

            // Handler to create jobs.
            handler = new Handler(msg =>
            {
                switch (msg.What)
                {
                case MESSAGE_SERVICE_CLEAR_PAYMENTS:
                    clearPaymentsJob = (ClearPaymentsJob)msg.Obj;
                    clearPaymentsJob.ScheduleTask();
                    break;

                case MESSAGE_SERVICE_RECURRING_PAYMENTS:
                    recurringPaymentJob = (RecurringPaymentJob)msg.Obj;
                    recurringPaymentJob.ScheduleTask();
                    break;
                }
            });

            // Start services and provide it a way to communicate with us.
            var startServiceIntentClearPayment = new Intent(this, typeof(ClearPaymentsJob));
            startServiceIntentClearPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentClearPayment);

            var startServiceIntentRecurringPayment = new Intent(this, typeof(RecurringPaymentJob));
            startServiceIntentRecurringPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentRecurringPayment);

            if (Mvx.IoCProvider.CanResolve <IBackgroundTaskManager>() && Mvx.IoCProvider.CanResolve <ISettingsManager>())
            {
                Mvx.IoCProvider.Resolve <IBackgroundTaskManager>()
                .StartBackupSyncTask(Mvx.IoCProvider.Resolve <ISettingsManager>().BackupSyncRecurrence);
            }

            // If the user opened the app via one of the shortcuts,
            // navigate the user to the right page
            NavigateToShortcuts();
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            ConfigurationManager.Initialise(PCLAppConfig.FileSystemStream.PortableStream.Current);

#if !DEBUG
            AppCenter.Start(ConfigurationManager.AppSettings["AndroidAppcenterSecret"],
                            typeof(Analytics), typeof(Crashes));
#endif
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Popup.Init(this, bundle);

            // Handler to create jobs.
            handler = new Handler(msg => {
                switch (msg.What)
                {
                case MESSAGE_SERVICE_CLEAR_PAYMENTS:
                    clearPaymentsJob = (ClearPaymentsJob)msg.Obj;
                    clearPaymentsJob.ScheduleTask();
                    break;

                case MESSAGE_SERVICE_RECURRING_PAYMENTS:
                    recurringPaymentJob = (RecurringPaymentJob)msg.Obj;
                    recurringPaymentJob.ScheduleTask();
                    break;
                }
            });

            // Start services and provide it a way to communicate with us.
            var startServiceIntentClearPayment = new Intent(this, typeof(ClearPaymentsJob));
            startServiceIntentClearPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentClearPayment);

            var startServiceIntentRecurringPayment = new Intent(this, typeof(RecurringPaymentJob));
            startServiceIntentRecurringPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentRecurringPayment);

            if (Mvx.IoCProvider.CanResolve <IBackgroundTaskManager>() && Mvx.IoCProvider.CanResolve <ISettingsFacade>())
            {
                Mvx.IoCProvider.Resolve <IBackgroundTaskManager>()
                .StartBackupSyncTask(Mvx.IoCProvider.Resolve <ISettingsFacade>().BackupSyncRecurrence);
            }
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
#if !DEBUG
            AppCenter.Start("6d9840ff-d832-4c1b-a2ee-bac7f15d89bd",
                            typeof(Analytics), typeof(Crashes));
#endif
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Popup.Init(this, bundle);

            // Handler to create jobs.
            handler = new Handler(msg => {
                switch (msg.What)
                {
                case MESSAGE_SERVICE_CLEAR_PAYMENTS:
                    clearPaymentsJob = (ClearPaymentsJob)msg.Obj;
                    clearPaymentsJob.ScheduleTask();
                    break;

                case MESSAGE_SERVICE_RECURRING_PAYMENTS:
                    recurringPaymentJob = (RecurringPaymentJob)msg.Obj;
                    recurringPaymentJob.ScheduleTask();
                    break;
                }
            });

            // Start services and provide it a way to communicate with us.
            var startServiceIntentClearPayment = new Intent(this, typeof(ClearPaymentsJob));
            startServiceIntentClearPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentClearPayment);

            var startServiceIntentRecurringPayment = new Intent(this, typeof(RecurringPaymentJob));
            startServiceIntentRecurringPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentRecurringPayment);

            if (Mvx.IoCProvider.CanResolve <IBackgroundTaskManager>() && Mvx.IoCProvider.CanResolve <ISettingsManager>())
            {
                Mvx.IoCProvider.Resolve <IBackgroundTaskManager>()
                .StartBackupSyncTask(Mvx.IoCProvider.Resolve <ISettingsManager>().BackupSyncRecurrence);
            }
        }
コード例 #4
0
ファイル: MainActivity.cs プロジェクト: nathanial/MoneyFox
        /// <inheritdoc />
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            try
            {
                DataAccess.ApplicationContext.DbPath =
                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                 DatabaseConstants.DB_NAME);
                DataAccess.ApplicationContextOld.DbPath =
                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                 DatabaseConstants.DB_NAME_OLD);
            }
            catch (Exception ex)
            {
                await Mvx.Resolve <IDialogService>().ShowMessage("erro", ex.ToString());
            }

            // Handler to create jobs.
            handler = new Handler(msg => {
                switch (msg.What)
                {
                case MESSAGE_SERVICE_CLEAR_PAYMENTS:
                    clearPaymentsJob = (ClearPaymentsJob)msg.Obj;
                    clearPaymentsJob.ScheduleTask();
                    break;

                case MESSAGE_SERVICE_RECURRING_PAYMENTS:
                    recurringPaymentJob = (RecurringPaymentJob)msg.Obj;
                    recurringPaymentJob.ScheduleTask();
                    break;
                }
            });

            SetContentView(Resource.Layout.activity_main);

#if !DEBUG
            MobileCenter.Start("6d9840ff-d832-4c1b-a2ee-bac7f15d89bd",
                               typeof(Analytics), typeof(Crashes));
#endif

            DrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            MainFrame    = FindViewById <CoordinatorLayout>(Resource.Id.main_frame);

            if (bundle == null)
            {
                await ViewModel.ShowMenuAndFirstDetail();
            }

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            if (toolbar != null)
            {
                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                var drawerToggle = new MvxActionBarDrawerToggle(
                    this,                        // host Activity
                    DrawerLayout,                // DrawerLayout object
                    toolbar,                     // nav drawer icon to replace 'Up' caret
                    Resource.String.drawer_open, // "open drawer" description
                    Resource.String.drawer_close // "close drawer" description
                    );

                DrawerLayout.AddDrawerListener(drawerToggle);
                drawerToggle.SyncState();
            }

            // Start services and provide it a way to communicate with us.
            var startServiceIntentClearPayment = new Intent(this, typeof(ClearPaymentsJob));
            startServiceIntentClearPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentClearPayment);

            var startServiceIntentRecurringPayment = new Intent(this, typeof(RecurringPaymentJob));
            startServiceIntentRecurringPayment.PutExtra("messenger", new Messenger(handler));
            StartService(startServiceIntentRecurringPayment);

            Mvx.Resolve <IBackgroundTaskManager>().StartBackupSyncTask(Mvx.Resolve <ISettingsManager>().BackupSyncRecurrence);
        }