Ejemplo n.º 1
0
        //其他///////////////////////////////////////
        private static MJson getResult(Dictionary <string, string> kv, string urlKey)
        {
            MJson mjError = hadLogin();

            Log.AddLog("TEST", "3");
            if (mjError != null)
            {
                return(mjError);
            }
            string error = null;
            MJson  mj    = NetHandle.Post(kv, urlKey, out error);

            if (error != null)
            {
                return(ErrorMJ(error));
            }
            return(mj);
        }
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();

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