Example #1
0
        public ReactionPopUp(int ArticleID_, bool Reacted_, ReactionTable RT_, NewsPage NP)
        {
            ArticleID = ArticleID_;
            RT        = RT_;
            Reacted   = Reacted_;
            activeNP  = NP;

            InitializeComponent();
        }
Example #2
0
        // Fetches the RSS object of an article from the database and uses it to load in a news page.
        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);
                });

                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);
                    }
                });
            });

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