Exemple #1
0
        public App()
        {
            InitializeComponent();



            if (database == null)
            {
                database = new DBHelper(DependencyService.Get <IFileHelper>().GetLocalFilePath("UserDB.db3"));
            }
            Loginpage     = new LoginPage();
            SideMenu      = new ChoicesPage();
            Mainpage      = new MainPage();
            LoadingScreen = new LoadingPopUp();
            Startpage     = new MasterDetailPage()
            {
                Master = new NavigationPage(SideMenu)
                {
                    Title = "Side Menu", BarBackgroundColor = App.MC, BarTextColor = Color.FromHex("#FFFFFF"),
                },
                Detail = new NavigationPage(Loginpage)
                {
                    BarBackgroundColor = App.MC, BarTextColor = Color.FromHex("#FFFFFF"),
                }
            };

            Timer = new System.Timers.Timer
            {
                Interval = 60000
            };
            Timer.Elapsed += OnTimedEvent;
            Timer.Enabled  = true;



            MainPage = Startpage;// new NavigationPage();

            App.Startpage.IsPresentedChanged += (s, e) => {
                SideMenu.TaglistCheck();
            };

            Instanciated = true;
        }
Exemple #2
0
        async void LoadNews(object sender, EventArgs e)
        {
            bool LoadFailure = false;
            var  Header      = (Button)sender;

            Header.IsEnabled = false;
            var id = Int32.Parse(Header.ClassId);

            await System.Threading.Tasks.Task.Run(async() =>
            {
                var NP = new ContentPage();

                bool OK = false;

                Device.BeginInvokeOnMainThread(async() =>
                {
                    //IsBusy = true;

                    LoadingPopUp x = new LoadingPopUp();
                    x.loadingAnimation.Play();
                    await Navigation.PushAsync(x);
                });


                //ANVÄND KOD HÄR
                var RSSTable = App.database.GetServerRSS(id);
                if (RSSTable != null)
                {
                    RSSTable RSS = RSSTable.First();
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        NP = new NewsPage(RSS, argc);
                        OK = true;
                    });
                }
                else
                {
                    LoadFailure = true;
                }



                await System.Threading.Tasks.Task.Delay(10);
                Device.BeginInvokeOnMainThread(async() =>
                {
                    Console.WriteLine("Initiering Klar");

                    await Navigation.PopAsync();
                    if (OK)
                    {
                        await Navigation.PushAsync(NP);
                    }

                    //IsBusy = false;
                });
            });

            Header.IsEnabled = true;
            if (LoadFailure)
            {
                await DisplayAlert("Article Load Failure", "Artikeln misslyckades att laddas in, vänligen försök igen.", "OK");
            }
        }