public MainWindow()
        {
            instances = this;
            InitializeComponent();
            InitBindEvent();
            InitLoadSetting();
            this.Closed += Window_Closed;
            cm           = new ClientManger(IP, int.Parse(port));
            basePath     = AppDomain.CurrentDomain.BaseDirectory;
            SettingPath  = basePath + SettingPath;

            if (fileName != null)
            {
                StartFunction();
            }
            mouseThread = new Thread(startGetMouse);
            mouseThread.IsBackground = true;
            mouseThread.Start();

            socketThread = new Thread(socketThreadFunction);
            socketThread.IsBackground = true;
            socketThread.Start();

            KeyDown += KeyDownEvent;

            ipBox.LostFocus   += IpBox_LostFocus;
            portBox.LostFocus += PortBox_LostFocus;


            InitnotifyIcon();
        }
        public ClientManger(string ip, int port)
        {
            new LogManger(new LogClass(), AppDomain.CurrentDomain.BaseDirectory, "log.txt");
            instaces = this;
            ToolClass.GetDataPack    = GetPack;
            ToolClass.msgArrLen      = 1024000;
            ToolClass.SendHeaderPack = false;
            bc = new TcpClient(new socketEvent());
            bc.Connect(ip, port);

            wid = (int)System.Windows.SystemParameters.PrimaryScreenWidth;  //得到屏幕整体宽度
            hig = (int)System.Windows.SystemParameters.PrimaryScreenHeight; //得到屏幕整体高度
        }