/// <summary> /// button click to recieve a message based on your id /// </summary> /// <param name="sender">default</param> /// <param name="e">default</param> protected void Button2_Click(object sender, EventArgs e) { //make sure the text box is not empty if (TextBox3.Text != "") { //call the wcf service to recieve a message messages.Service1Client mess = new messages.Service1Client(); //get the name of the user who wants to see their message string name = TextBox3.Text; //call the wcf recieve message service and assign the values to the array string[] stuff = mess.recieveMessage(name); //iterate through the array and add the elements to the text box for (int i = 0; i < stuff.Length; i++) { TextBox4.Text += stuff[i]; } } else { TextBox3.Text = "enter some id"; } }
/// <summary> /// send a message to someone and store it in an xml file /// </summary> /// <param name="sender">default</param> /// <param name="e">defualt</param> // protected void Button1_Click(object sender, EventArgs e) { //create the wcf service client to send a message to the xml file messages.Service1Client mess = new messages.Service1Client(); //assign the variables string toWho = TextBox1.Text; string text = TextBox2.Text; string from = TextBox5.Text; //invoke the method mess.sendMessage(text, from, toWho); //assign the global variables of who sent the message and the message GlobalVariables.newMess = "you've got mail"; GlobalVariables.who = toWho; }