Beispiel #1
0
        protected void BtnSend_Click(object sender, EventArgs e)
        {
            

            if (TBMsg.Text.Length > 30)
            {
                LbError.Text = "Melding skal maks ha 30 tegn";
                TBMsg.Text = String.Empty;
            }
            else if (string.IsNullOrWhiteSpace(TBMsg.Text))
            {
                LbError.Text = "Meldingen er tomt!";
                TBMsg.Text = String.Empty;
            }
            else
            {
                c = new TCP_Client();
                HttpCookie cookie = Request.Cookies["UserName"];

                TextBox chatText = TBMsg;
                string username = cookie["Name"];
                string chatInput = CheckIP();
                chatInput += "Chat=" + username + ": " + chatText.Text;
                chatText.Text = "";
                c.Send(chatInput);

                LbError.Text = String.Empty;
            }


        }
Beispiel #2
0
        protected void voteBtn_Click(object sender, EventArgs e)
        {
            voteInput = "Jukebox=" + songList.SelectedItem;
            c.Send(voteInput);

            //Receive updated list

            createList();
            //create cookie, save name of song and expiration
            HttpCookie cookie = new HttpCookie("Voted");

            cookie["VotedSong"] = songList.SelectedItem.Text;
            cookie.Expires      = DateTime.Now.AddDays(0.00347222);
            Response.Cookies.Add(cookie);

            Page.Response.Redirect(Page.Request.Url.ToString(), true);
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            c = new TCP_Client();

            songList.Items.Clear();
            c.Send("Jukebox=Page Load");
            createList();


            if (HttpContext.Current.Request.Cookies["Voted"] != null)
            {
                HttpCookie cookie = Request.Cookies["Voted"];
                MultiView2.ActiveViewIndex = 1;
            }
            else
            {
                MultiView2.ActiveViewIndex = 0;
            }
        }