private void btnContinue_Click(object sender, EventArgs e)
        {
            //client.ClientServerPort = int.Parse(numPort.Value.ToString());
            //client.ClientServerIP = tbIPAddress.Text; // IP Address name / IP
            //client.PythonCode = " "; // So we dont execute nothing each time the client is updated
            //client.ClientID = client.GetLocalIPAddress();
               // int serverPort = portNum;

            bool ConnectionOK= true;
            // Need much better validation on this !
            if(checkBox1.Checked)
            {
                UserHandler.User.UseLocalHost = true;
                UserHandler.User.ServerIP = "127.0.0.1";
                NetworkHandler.ServerHandler localServer = new NetworkHandler.ServerHandler();

            }
            if (string.IsNullOrEmpty(tbIPAddress.Text) && checkBox1.Checked == false)
            {
                ConnectionOK = false;
            }
            else if (checkBox1.Checked == true && !string.IsNullOrEmpty(tbIPAddress.Text))
            {
                MessageBox.Show("Please select a server, you cant use a local and remote server at the same time \n");
            }
            UserHandler.User.ServerIP = tbIPAddress.Text;
            UserHandler.User.ServerPort = int.Parse(numPort.Value.ToString());

            try
            {

                //client.SendOnNetwork(client.GetIPV4(client.ClientServerIP), client.ClientServerPort, client);
                //AsyncSocks.AsynchronousClient.Echo(UserHandler.User.ServerIP, UserHandler.User.ServerPort);
               //ConnectionOK =  Utilitys.Utils.SendEcho(UserHandler.User.ServerIP,UserHandler.User.ServerPort, "Echo");
                ConnectionOK = NetworkHandler.ClientHandler.SendEcho(UserHandler.User.ServerIP, UserHandler.User.ServerPort, "Echo");

            } catch (Exception err)
            {
              //  MessageBox.Show(this, err.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Console.WriteLine("Socket Error" + err.Message);
                ConnectionOK = false;
            }
            finally
            {
                //socket.Close();
            }

            if (ConnectionOK == true)
            {

                MessageBox.Show(this, "Connected to server : " + UserHandler.User.ServerIP + " on Port : " +  UserHandler.User.ServerPort ,"Connected !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Prequery pq = new Prequery();

                EnableDoubleBuffering();
                this.Hide();

                // First save to the temp (this will be the start of the persistent file
                //client.WriteSeralizeFile();

                pq.Show();
            }
            else
            {
                MessageBox.Show(this, "Could not connect to server : " + UserHandler.User.ServerIP + " on Port : " + UserHandler.User.ServerPort + "\nPlease try again!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnContinue_Click(object sender, EventArgs e)
        {
            //client.ClientServerPort = int.Parse(numPort.Value.ToString());
            //client.ClientServerIP = tbIPAddress.Text; // IP Address name / IP
            //client.PythonCode = " "; // So we dont execute nothing each time the client is updated
            //client.ClientID = client.GetLocalIPAddress();
            // int serverPort = portNum;

            bool ConnectionOK = true;

            // Need much better validation on this !
            if (checkBox1.Checked)
            {
                UserHandler.User.UseLocalHost = true;
                UserHandler.User.ServerIP     = "127.0.0.1";
                NetworkHandler.ServerHandler localServer = new NetworkHandler.ServerHandler();
            }
            if (string.IsNullOrEmpty(tbIPAddress.Text) && checkBox1.Checked == false)
            {
                ConnectionOK = false;
            }
            else if (checkBox1.Checked == true && !string.IsNullOrEmpty(tbIPAddress.Text))
            {
                MessageBox.Show("Please select a server, you cant use a local and remote server at the same time \n");
            }
            UserHandler.User.ServerIP   = tbIPAddress.Text;
            UserHandler.User.ServerPort = int.Parse(numPort.Value.ToString());

            try
            {
                //client.SendOnNetwork(client.GetIPV4(client.ClientServerIP), client.ClientServerPort, client);
                //AsyncSocks.AsynchronousClient.Echo(UserHandler.User.ServerIP, UserHandler.User.ServerPort);
                //ConnectionOK =  Utilitys.Utils.SendEcho(UserHandler.User.ServerIP,UserHandler.User.ServerPort, "Echo");
                ConnectionOK = NetworkHandler.ClientHandler.SendEcho(UserHandler.User.ServerIP, UserHandler.User.ServerPort, "Echo");
            } catch (Exception err)
            {
                //  MessageBox.Show(this, err.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Console.WriteLine("Socket Error" + err.Message);
                ConnectionOK = false;
            }
            finally
            {
                //socket.Close();
            }

            if (ConnectionOK == true)
            {
                MessageBox.Show(this, "Connected to server : " + UserHandler.User.ServerIP + " on Port : " + UserHandler.User.ServerPort, "Connected !", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Prequery pq = new Prequery();

                EnableDoubleBuffering();
                this.Hide();

                // First save to the temp (this will be the start of the persistent file
                //client.WriteSeralizeFile();


                pq.Show();
            }
            else
            {
                MessageBox.Show(this, "Could not connect to server : " + UserHandler.User.ServerIP + " on Port : " + UserHandler.User.ServerPort + "\nPlease try again!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }