/// <summary>
        /// Disconnect existing connections to the server
        /// </summary>
        void Disconnect(ServerConnectionStatus css)
        {
            //stop reading and writing
            if (css.nclient != null)
            {
                //update the context menu of each extension to allow call forwarding clicking
                Globals.ExtensionManager.OnConnectionChanged(css.GetServerIPAndPort(), false);

                Globals.Logger.LogString(LogManager.LogLevels.LogFlagInfo, "Disconnected from server " + css.IP);
                css.nclient.Disconnect();
                css.nclient = null;
            }
            //notify user that we no longer get updates from the server
            ShowNoConnectionWindow();
        }
        /// <summary>
        /// When connection settings change, this function should be called to create a new connection
        /// </summary>
        public void CreateNewConnection(ServerConnectionStatus css)
        {
            //make sure we ditch old data
            Disconnect(css);

            if (Globals.IsAppRunning == false)
            {
                return;
            }

            //need connection details in order to create a new connection
            if (css.IP == null || css.IP.Length == 0 || css.PendingRemove == true)
            {
                return;
            }

            //create a client connection that should persist while the UI is alive
            NetworkClient TClient = new NetworkClient(css.IP, css.Port);

            TClient.ConnectToServer(css.IP, css.Port);
            if (TClient.IsConnected() == false)
            {
                Globals.Logger.LogString(LogManager.LogLevels.LogFlagInfo, "Failed to created new server connection to " + css.IP + ":" + css.Port.ToString());
                TClient = null;
                return; //failed to create a connection
            }

            //no more need to show user that there is no connection
            HideNoConnectionWindow();

            //if it is good to use, we use it
            css.nclient            = TClient;
            css.LastHeartBeatStamp = Environment.TickCount;

            if (PacketParserThread == null)
            {
                PacketParserThread = new Thread(new ThreadStart(AsyncParsePackets));
                PacketParserThread.Start();
            }

            //update the context menu of each extension to allow call forwarding clicking
            Globals.ExtensionManager.OnConnectionChanged(css.GetServerIPAndPort(), true);

            Globals.Logger.LogString(LogManager.LogLevels.LogFlagInfo, "Created new server connection to " + css.IP.ToString() + ":" + css.Port.ToString());
        }