コード例 #1
0
        public static tagID createInstance(Dictionary <string, object> dic)
        {
            string tag       = string.Empty;
            string startTime = string.Empty;
            string cmd       = string.Empty;
            string state     = string.Empty;
            object tmpTag    = null;
            object tmpTime   = null;
            object tmpCmd    = null;
            object tmpState  = null;

            if (dic.TryGetValue("tag", out tmpTag) == true)
            {
                tag = (string)tmpTag;
            }
            if (dic.TryGetValue("startTime", out tmpTime) == true)
            {
                startTime = (string)tmpTime;
            }
            if (dic.TryGetValue("cmd", out tmpCmd) == true)
            {
                cmd = (string)tmpCmd;
            }
            if (dic.TryGetValue("state", out tmpState) == true)
            {
                state = (string)tmpState;
            }
            tagID u = new tagID(tag, startTime, cmd, state);

            return(u);
        }
コード例 #2
0
        public static string toJSONFromList(List <tagID> list)
        {
            if (list == null || list.Count <= 0)
            {
                return("[]");
            }
            string strR = "[";

            for (int i = 0; i < list.Count; i++)
            {
                tagID t = list[i];
                if (i > 0)
                {
                    strR += "," + t.toJSON();
                }
                else
                {
                    strR += t.toJSON();
                }
            }
            strR += "]";
            return(strR);
        }
コード例 #3
0
        //发送盘点结果
        private void menuItem4_Click(object sender, EventArgs e)
        {
            //发送前先将读取标签的操作停止
            if (this.menuItem5.Checked == true)//正在循环读取标签
            {
                __timer.Enabled = false;
                this.menuItem5.Checked = false;
            }

            string strTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            List<tagID> list = new List<tagID>();
            foreach (System.Windows.Forms.ListViewItem lvi in this.listView1.Items)
            {
                if (lvi.Checked == true)
                {
                    tagID tag1 = new tagID(lvi.Text, strTime, InventoryCommand.盘点);
                    list.Add(tag1);
                }
            }

            string jsonString = tagID.toJSONFromList(list);
            HttpWebConnect helper = new HttpWebConnect();
            helper.RequestCompleted += new deleGetRequestObject(helper_RequestCompleted);
            string url = RestUrl.addScanedTags;
            helper.TryPostData(url, jsonString);
        }
コード例 #4
0
ファイル: tagID.cs プロジェクト: uwitec/InventoryMobileClient
        public static tagID createInstance(Dictionary<string, object> dic)
        {
            string tag = string.Empty;
            string startTime = string.Empty;
            string cmd = string.Empty;
            string state = string.Empty;
            object tmpTag = null;
            object tmpTime = null;
            object tmpCmd = null;
            object tmpState = null;
            if (dic.TryGetValue("tag", out tmpTag) == true)
            {
                tag = (string)tmpTag;
            }
            if (dic.TryGetValue("startTime", out tmpTime) == true)
            {

                startTime = (string)tmpTime;

            }
            if (dic.TryGetValue("cmd", out tmpCmd) == true)
            {
                cmd = (string)tmpCmd;
            }
            if (dic.TryGetValue("state", out tmpState) == true)
            {
                state = (string)tmpState;
            }
            tagID u = new tagID(tag, startTime, cmd, state);
            return u;
        }