Exemple #1
0
        public App()
        {
            // Put your Syncfusion License Key here.
            // Comment out this line if you don't have one
            // Or you can claim a community license from here:
            // https://www.syncfusion.com/products/communitylicense
            SyncfusionLicenseProvider.RegisterLicense(
                LicenseKey.LICENSE_KEY);

            InitializeComponent();

            MainPage = new BottomNavigationPage();
        }
        public App(string filePath)
        {
            CrossSecureStorage.Current.SetValue("RememberMe", "false");
            Application.Current.Properties["RememberMe"] = "false";
            IoCContainer = new Container();
            // Dependancy Injections:
            IoCContainer.Register <IBackgroundLocationService, BackgroundLocationService>(Lifestyle.Singleton);
            IoCContainer.Register <ILocationService, LocationService>(Lifestyle.Singleton);
            IoCContainer.Register <IUserManagementService, UserManagementService>(Lifestyle.Singleton);
            IoCContainer.Register <IItineraryService, ItineraryService>(Lifestyle.Singleton);
            //Register Syncfusion license
            InitializeComponent();
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(syncfusionLicense);

            MessagingCenter.Subscribe <object, string>(this, App.FirebaseTokenKey, OnKeyReceived);

            // MainPage = new LoginWithSocialIconPage();

            FilePath = filePath;

            MessagingCenter.Subscribe <object, string[]>(this, App.NotificationBodyReceivedKey, (object sender, string[] msg) =>
            {
                BottomNavigationPage temp     = new BottomNavigationPage();
                NotificationDB notificationDB = new NotificationDB();
                Device.BeginInvokeOnMainThread(() =>
                {
                    DependencyService.Get <NotificationServices>().CreateNotification(msg[0], msg[1]);
                    notificationDB.Title = msg[0];
                    notificationDB.Body  = msg[1];


                    using (SQLiteConnection conn = new SQLiteConnection(App.FilePath))
                    {
                        conn.CreateTable <NotificationDB>();
                        var notificaitons = conn.Table <NotificationDB>().ToList();
                        int rowsAdded     = conn.Insert(notificationDB);
                        //notificaitons = conn.Table<NotificationDB>().ToList();
                        conn.Close();
                    }
                    //me.loadNotifications();
                });
            });

            getUserNotifications();
        }