public void Dispose()
        {
            interruptGrabbing = false;
            serverHandler = null;
            screenResponse = null;
            packetFactory = null;
            responsePacket = null;

            try
            {
                if (ScreenThread != null && ScreenThread.IsAlive)
                    ScreenThread.Abort();
            }
            catch { }
            mouseController.Dispose();
            mouseController = null;

            keyboardController.Dispose();
            keyboardController = null;

            commander.Dispose();
            commander = null;

            screenGrabber.Dispose();
            screenGrabber = null;

            if (nextScreen != null)
                nextScreen.Dispose();
            if (prevScreen != null)
                prevScreen.Dispose();
            if (difference != null)
                difference.Dispose();

            GC.SuppressFinalize(this);
        }
        public LdpRemoteDesktopSender()
        {
            serverHandler = LdpServer.GetInstance();
            serverHandler.GetListenerChannel.AddListener(this);
            mouseController = new LdpMouseController();
            keyboardController = new LdpKeyboardController();
            commander = new LdpCommandController();

            packetFactory = new LdpProtocolPacketFactory();
            screenGrabber = new LdpScreenGrabber();
        }