Ejemplo n.º 1
0
        public void SelectReaction(object sender, EventArgs e)
        {
            //What happens when selecting a reaction, accessing the server,
            //creating new reaction on the table,
            //changing grafiks on newspage and/or newsfeed!
            var BT = (Button)sender;

            if (ArticleID != -1)
            {
                var NRT = new ReactionTable
                {
                    User     = App.LoggedinUser.ID,
                    Article  = ArticleID,
                    Reaktion = Convert.ToInt32(BT.ClassId)
                };

                if (Reacted)
                {
                    App.database.DeleteReaction(RT);
                    if (RT.Reaktion != NRT.Reaktion)
                    {
                        if (activeNP != null)
                        {
                            activeNP.ReactionCheck();
                        }

                        App.database.InsertReaction(NRT);
                    }
                }
                else
                {
                    App.database.InsertReaction(NRT);
                }
                if (activeNP != null)
                {
                    activeNP.ReactionImage.Source = "reactions_" + NRT.Reaktion + ".png";
                }
            }
            //Then close window, as you can only select one reaction at a time
            ClosePopup(sender, e);
        }