Example #1
0
        //taskstat获取当前用户的任务信息,url:服务地址,msg要获取的list名
        private List <Messageobj> taskstat(string url, ListInfo msg)
        {
            List <Messageobj> msglist = new List <Messageobj>();

            if (url != null && msg != null)
            {
                string jsonstr    = JsonConvert.SerializeObject(msg);
                string postresult = http.postjson(url, jsonstr);
                if (postresult != "[emptylist")
                {
                    JArray taskinfos = (JArray)JsonConvert.DeserializeObject(postresult);
                    for (int i = 0; i < taskinfos.Count; i++)
                    {
                        string     taskstr = taskinfos[i].ToString();
                        Messageobj obj     = (Messageobj)JsonConvert.DeserializeObject(taskstr, typeof(Messageobj));
                        msglist.Add(obj);
                    }
                }
            }
            return(msglist);
        }
 //taskstat获取当前用户的任务信息,url:服务地址,msg要获取的list名
 private List<Messageobj> taskstat(string url, ListInfo msg)
 {
     List<Messageobj> msglist = new List<Messageobj>();
     if (url != null && msg != null)
     {
         string jsonstr = JsonConvert.SerializeObject(msg);
         string postresult = http.postjson(url, jsonstr);
         if (postresult != "[emptylist")
         {
             JArray taskinfos = (JArray)JsonConvert.DeserializeObject(postresult);
             for(int i=0;i<taskinfos.Count;i++)
             {
                 string taskstr = taskinfos[i].ToString();
                 Messageobj obj= (Messageobj)JsonConvert.DeserializeObject(taskstr, typeof(Messageobj));
                 msglist.Add(obj);
             }
         }
     }
     return msglist;
 }
        private void platform_Loaded(object sender, RoutedEventArgs e)
        {
            ListInfo orderlinfo = new ListInfo();
            orderlinfo.list = "20151005orderlist";

            ListInfo workinginfo = new ListInfo();
            workinginfo.list = "20151005workinglist";

            ListInfo doneinfo = new ListInfo();
            doneinfo.list = "20151005donelist";

            ListInfo myinfo = new ListInfo();
            myinfo.list = "20151005mytasklist";

            orderstat = taskstat(msgstaturl, orderlinfo);

            workingstat = taskstat(msgstaturl, workinginfo);

            donestat = taskstat(msgstaturl, doneinfo);

            mystat = taskstat(msgstaturl, myinfo);

            initwindow(order, "order", orderstat);
            initwindow(workinglist, "working", workingstat);
            initwindow(donelist, "order", donestat);
            initwindow(mylist, "order", mystat);
        }