示例#1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //Window1 window1 = new Window1(UsernameTxtbox.Text);
            string URL       = "localhost:8000";
            string ifSuccess = HTTP.GETfromServer("type=player&subtype=add&username="******"&ipaddress=" + URL);//+HTTP.getIP()+":8080");

            if (ifSuccess == "ok")
            {
                new Window1(UsernameTxtbox.Text, URL);
                //window1.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("An error has occured while logging in.");
            }
        }
示例#2
0
        public Window1(string user, string URL)
        {
            this.username = user;
            new GameList();
            this.players_List = new List <String>();
            InitializeComponent();
            //this.chatList.Items.Add("Test:test");
            //pList.Add("anon");
            //this.playerList.Items.Add("Anon");
            //this.addGame("game1", "0.0.0.0");
            gameList.MouseDoubleClick += gameList_MouseDoubleClick;
            Closing += Window1_Closing;

            requestQuery = new RequestQuery(this.addMessageDelegate);

            new HTTP(requestQuery, URL);//this);
            this.Show();
            HTTP.sendToServer("type=player&subtype=all&username=" + username);
        }
示例#3
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (chatBox.Text != "")
     {
         //TextBox chatTextBlock = (TextBox)this.FindName("chatBox");
         String message  = chatBox.Text;
         String privateM = "";
         if (privateMsgTo != "")
         {
             privateM = "&personal=" + privateMsgTo;
         }
         String urlParameters = "type=chat&username="******"&message=" + message + privateM;
         Console.WriteLine(urlParameters);
         Console.WriteLine("type");
         HTTP.sendToServer(urlParameters);
         //ListBox chatListBox = (ListBox)this.FindName("chatList");
         //chatBox.Items.Add("user:" + message);
     }
 }