/// <summary>
 /// Sends a message to the server for executing a function that will calculate the average of the numbers in the memory.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonMemAvg_Click(object sender, RoutedEventArgs e)
 {
     textdisplay.Text = "Calculating average of memory";
     ClientConnMgr.operationStringToSend = textdisplay.Text;
     ClientConnMgr.ConectClient();
     textdisplay.Text = ClientConnMgr.resultReceived;
 }
 /// <summary>
 /// Sends a message to the server for executing a function that will clear the memory of the calculator.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonMemClear_Click(object sender, RoutedEventArgs e)
 {
     textdisplay.Text = "Memory cleared";
     ClientConnMgr.operationStringToSend = textdisplay.Text;
     ClientConnMgr.ConectClient();
     textdisplay.Text = ClientConnMgr.resultReceived;
 }
 /// <summary>
 /// Sends a message to the server for executing a function that will remove the last number stored in the memory.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonMemMinus_Click(object sender, RoutedEventArgs e)
 {
     textdisplay.Text = "Last result removed from memory";
     ClientConnMgr.operationStringToSend = textdisplay.Text;
     ClientConnMgr.ConectClient();
     textdisplay.Text = ClientConnMgr.resultReceived;
 }
 /// <summary>
 /// Sends a message to the server for executing a function that will add the number on the screen to a list of doubles.
 /// This will emulate the memory of the calculator.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonMemPlus_Click(object sender, RoutedEventArgs e)
 {
     if (textdisplay.Text.Contains("mem") ||
         textdisplay.Text.Contains("Mem") ||
         textdisplay.Text == "0")
     {
         textdisplay.Text = "";
     }
     textdisplay.Text = "Result added to memory";
     ClientConnMgr.operationStringToSend = textdisplay.Text;
     ClientConnMgr.ConectClient();
     textdisplay.Text = ClientConnMgr.resultReceived;
 }
 /// <summary>
 /// Sends to the server mathematic operation when the "=" button or key is pressed on the GUI.
 /// This mathematic operation is located as a string in the display of the GUI.
 /// </summary>
 /// <param name="sender">System parameter for detect actions of the GUI</param>
 /// <param name="e">System parameter for detect events of the GUI</param>
 private void buttonEquals_Click(object sender, RoutedEventArgs e)
 {
     ClientConnMgr.operationStringToSend = textdisplay.Text;
     ClientConnMgr.ConectClient();
     textdisplay.Text = ClientConnMgr.resultReceived;
 }
 /// <summary>
 /// When the window is about to close the function that closes the connection is invoked.
 /// </summary>
 /// <param name="sender">System parameter for detect actions of the GUI</param>
 /// <param name="e">System parameter for detect events of the GUI</param>
 void ClientCalc_Closing(object sender, CancelEventArgs e)
 {
     ClientConnMgr.CloseSocket();
 }
 /// <summary>
 /// When the GUI starts initiate the connection via socket with the Calc_Server.
 /// </summary>
 public ClientCalc()
 {
     InitializeComponent();
     ClientConnMgr.operationStringToSend = "Client_Calc connected";
     ClientConnMgr.ConectClient();
 }