Ejemplo n.º 1
0
        public static void readCar(Action nextStep, UIElement ui)
        {
            if (photoSavePath2 == null)
            {
                photoSavePath2 = "D:";
                photoSavePath  = "D:\\" + "zp.bmp";
            }

            name      = null;
            persionid = null;
            error     = null;
            startTag  = CD.timeTag.getTag();
            readTime  = 0;
            readCarThread.resetTime(200);
            readCarThread.start();

            if (uiThread == null)
            {
                uiThread = new ThreadProperty(50, true, false, nextStep, ui);
            }
            uiThread.srcUI  = ui;
            uiThread.action = nextStep;
        }
Ejemplo n.º 2
0
        //设备登陆
        public static void DeviceLogin()
        {
            if (isDemo() || isTryingLogin)
            {
                return;
            }
            isTryingLogin = true;

            string deviceIP      = null;
            string deviceMAC     = null;
            string hardver       = null;
            string softver       = null;
            string status        = null;
            bool   isUseTestData = Config.net_dic("IsUseTestData") == "1";

            if (isUseTestData)
            {
                deviceIP  = Config.net_dic("deviceIP");
                deviceMAC = Config.net_dic("deviceMAC");
                hardver   = Config.net_dic("hardver");
                softver   = Config.net_dic("softver");
                status    = Config.net_dic("status");
            }
            else
            {
            }

            Dictionary <string, string> kv = new Dictionary <string, string>();

            kv["deviceIP"]  = deviceIP;
            kv["deviceMAC"] = deviceMAC;
            kv["hardver"]   = hardver;
            kv["softver"]   = softver;
            kv["status"]    = status;
            string error = null;

            //test
            //return;
            MJson mj = NetHandle.Post(kv, "DeviceLogin", out error);

            if (error != null)
            {
                deviceLoginError = error;
                TipWin.showTip(error, 5000, null);
            }
            else
            {
                deviceLoginError = null;
                deviceID         = mj["data"]["deviceID"].ToString();
                wdno             = mj["data"]["wdno"].ToString();
                wdmc             = mj["data"]["wdmc"].ToString();
            }
            isTryingLogin = false;
            loginTP.resetTime(6000);
            if (deviceID != null && deviceID != "")
            {
                loginTP.stop();
            }
            ////////////[TEST]///////////////////////
            //MJson ret0 = UserLogin("100001", "userName", "password");
            //MJson ret1 = getCPCarMsg("412201199004126586", "张三");
            //UpdateRecord_Test();

            /////////////////////////////////////////
        }