/// <summary>
 /// Add an text to the server_request listbox, denoting a request from a client.
 /// </summary>
 /// <param name="text">Description of event.</param>
 public void AddServerRequest(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (InvokeRequired)
     {
         SetTextEventHandler delegateMethod = new SetTextEventHandler(AddServerRequest);
         Invoke(delegateMethod, new object[] { text });
     }
     else
     {
         listBox_requests.Items.Add(text);
     }
 }
 /// <summary>
 /// Add an text to the server_log listbox, denoting an event.
 /// </summary>
 /// <param name="text">Description of event.</param>
 public void AddServerLog(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (InvokeRequired)
     {
         SetTextEventHandler delegateMethod = new SetTextEventHandler(AddServerLog);
         Invoke(delegateMethod, new object[] { text });
     }
     else
     {
         listbox_server_log.Items.Add(DateTime.Now.ToString("HH:mm:ss: ") + text);
     }
 }
        private void SetText(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            if (this.lblTip.InvokeRequired)
            {
                var d = new SetTextEventHandler(SetText);
                this.Invoke(d, new object[] { text });
            }
            else
            {
                this.lblTip.Text = text;
            }
        }
Exemple #4
0
        /// <summary>Set the server availability lable in this form.</summary>
        /// <param name="text">Text to be writen to the lable.</param>
        public void SetServerAvailability(string text)
        {
            // InvokeRequired  compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (lbl_ip_addr.InvokeRequired)
            {
                SetTextEventHandler delegateMethod = new SetTextEventHandler(SetServerAvailability);

                //invoke the thread responsible for the lable
                Invoke(delegateMethod, new object[] { text });
            }
            else
            {
                lbl_server_connect.Text = text;
            }
        }
Exemple #5
0
        /// <summary>Set the ip address lable in this form.</summary>
        /// <param name="text">Text to be writen to the lable.</param>
        public void SetClientIpAddress(string text)
        {
            // InvokeRequired  compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (lbl_ip_addr.InvokeRequired)
            {
                SetTextEventHandler delegateMethod = new SetTextEventHandler(SetClientIpAddress);

                //invoke the thread responsible for the lable
                Invoke(delegateMethod, new object[] { text });
            }
            else
            {
                lbl_ip_addr.Text = "Client ip address: " + text;
            }
        }
Exemple #6
0
        /// <summary>Set the network availability lable in this form.</summary>
        /// <param name="text">Text to be writen to the lable.</param>
        public void DisplayNetworkAvailability(string text)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (lbl_network.InvokeRequired)
            {
                SetTextEventHandler delegate_method = new SetTextEventHandler(DisplayNetworkAvailability);

                //invoke the thread responsible for the lable
                Invoke(delegate_method, new object[] { text });
            }
            else
            {
                lbl_network.Text = text;
            }

            client_networking.GetClientIP();
        }