/// <summary>
        /// 获取项目的任务列表
        /// </summary>
        /// <param name="ProjectId">项目id</param>
        /// <param name="Type">任务类型:all:默认,completed:已完成,uncompleted:未完成,expired:已过期</param>
        /// <returns>ObservableCollection<Task></returns>
        public static async Task<ObservableCollection<Worktile.Model.Task>> GetProjectTaskList(string ProjectId, string Type = "all")
        {
            string url = apiUrl + "tasks" ;
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("pid", ProjectId);
            parameters.Add("access_token", AccessToken);
            parameters.Add("type", Type);
            parameters.Add("rnd", new Random(100).Next().ToString());

            string json = await Helper.HttpHelper.DoGet(url, parameters);
            if (string.IsNullOrEmpty(json))
            {
                return null;
            }
            else
            {
                //开始解析返回数据
                try
                {
                    Debug.WriteLine("开始解析返回json---\n" + json);
                    JArray result = JArray.Parse(json);
                    Debug.WriteLine("解析返回json成功---\n");

                    ObservableCollection<Model.Task> TaskList = new ObservableCollection<Model.Task>();
                    foreach (JObject obj in result)
                    {
                        Model.Task task = new Model.Task();
                        task.Name = obj["name"].ToString();
                        task.Pid = obj["pid"].ToString();
                        task.Tid = obj["tid"].ToString();
                        task.EntryId = obj["entry_id"].ToString();
                        task.EntryName = obj["entry_name"].ToString();
                        task.CreateTime = (DateTime)obj["created_at"];
                        task.UpdateTime = (DateTime)obj["updated_at"];
                        task.Position = (int)obj["pos"];

                        foreach (JObject jLabel in (JArray)obj["labels"])
                        {
                            Label label = new Label();
                            label.Name = jLabel["name"].ToString();
                            label.Color = label.Name.Substring(0, 1).ToUpper() + label.Name.Substring(1);
                            label.Description = jLabel["desc"].ToString();
                            task.Labels.Add(label);
                        }
                        foreach (JObject jTodo in (JArray)obj["todos"])
                        {
                            Todo todo = new Todo();
                            todo.TodoId = jTodo["todo_id"].ToString();
                            todo.Name = jTodo["name"].ToString();
                            todo.Checked = (Model.Task.TaskCompleted)int.Parse(jTodo["checked"].ToString());
                            todo.Position = jTodo["pos"].ToString();
                            task.Todos.Add(todo);
                        }
                        JObject jBadge = (JObject)obj["badges"];
                        TaskBadge badge = new TaskBadge();
                        if (!string.IsNullOrEmpty(jBadge["expire_date"].ToString()))
                        {
                            badge.ExpireDate = (DateTime)jBadge["expire_date"];
                        }
                        badge.CommentCount = (int)jBadge["comment_count"];
                        badge.TodoCheckedCount = (int)jBadge["todo_checked_count"];
                        badge.TodoCount = (int)jBadge["todo_count"];
                        badge.FileCount = (int)jBadge["file_count"];
                        task.Badges = badge;

                        foreach (JObject jWacher in (JArray)obj["watchers"])
                        {
                            MemberInfo wacher = new MemberInfo();
                            wacher.Uid = jWacher["uid"].ToString();
                            wacher.Name = jWacher["name"].ToString();
                            wacher.NickName = jWacher["display_name"].ToString();
                            wacher.HeadImage = jWacher["avatar"].ToString();
                            wacher.Description = jWacher["desc"].ToString();
                            wacher.Status = (UserProfile.UserStatus)int.Parse(jWacher["status"].ToString());
                            wacher.Online = (UserProfile.UserOnline)int.Parse(jWacher["online"].ToString());
                            task.Watchers.Add(wacher);
                        }
                        foreach (JObject jMember in (JArray)obj["members"])
                        {
                            MemberInfo member = new MemberInfo();
                            member.Uid = jMember["uid"].ToString();
                            member.Name = jMember["name"].ToString();
                            member.NickName = jMember["display_name"].ToString();
                            member.HeadImage = jMember["avatar"].ToString();
                            member.Description = jMember["desc"].ToString();
                            member.Status = (UserProfile.UserStatus)int.Parse(jMember["status"].ToString());
                            member.Online = (UserProfile.UserOnline)int.Parse(jMember["online"].ToString());
                            task.Members.Add(member);
                        }
                        task.Completed = (Model.Task.TaskCompleted)int.Parse(obj["completed"].ToString());
                        if (!string.IsNullOrEmpty(obj["expire_date"].ToString()))
                        {
                            task.ExpireDate = (DateTime)obj["expire_date"];
                        }
                        task.Description = obj["desc"].ToString();
                        ProjectInfo project = new ProjectInfo();
                        JObject jProject = (JObject)obj["project"];
                        project.Pid = jProject["pid"].ToString();
                        project.Name = jProject["name"].ToString();
                        project.Picture = jProject["pic"].ToString();
                        project.BackgroundColor = jProject["bg"].ToString();
                        task.Project = project;
                        TaskList.Add(task);
                    }
                    return TaskList;
                }
                catch (Exception)
                {
                    Debug.WriteLine("解析返回json失败---\n" + json);
                    return null;
                }
            }
        }
        /// <summary>
        /// 获取项目详情
        /// </summary>
        /// <param name="ProjectId">项目id</param>
        /// <returns>ProjectDetail</returns>
        public static async Task<ProjectInfo> GetProjectDetail(string ProjectId)
        {
            string url = apiUrl + "projects/" + ProjectId  ;
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("access_token", AccessToken);

            string json = await Helper.HttpHelper.DoGet(url, parameters);
            if (string.IsNullOrEmpty(json))
            {
                return null;
            }
            else
            {
                //开始解析返回数据
                try
                {
                    Debug.WriteLine("开始解析返回json---\n" + json);
                    JObject result = JObject.Parse(json);
                    Debug.WriteLine("解析返回json成功---\n");

                    ProjectInfo project = new ProjectInfo();
                    project.Pid = result["pid"].ToString();
                    project.Name = result["name"].ToString();
                    project.TeamId = result["team_id"].ToString();
                    project.Description = result["desc"].ToString();
                    project.Archived = (ProjectInfo.ProjectArchived)int.Parse(result["archived"].ToString());
                    project.Picture = result["pic"].ToString();
                    project.BackgroundColor = result["bg"].ToString();
                    project.Visibility = (ProjectInfo.ProjectVisibility)int.Parse(result["visibility"].ToString());

                    foreach (JObject jLabel in (JArray)result["labels"])
                    {
                        Label label = new Label();
                        label.Name = jLabel["name"].ToString();
                        label.Color = label.Name.Substring(0, 1).ToUpper() + label.Name.Substring(1);
                        label.Description = jLabel["desc"].ToString();
                        project.Labels.Add(label);
                    }

                    JObject jCreateUser = (JObject)result["created_by"];
                    UserProfile user = new UserProfile();
                    user.Uid = jCreateUser["uid"].ToString();
                    user.Name = jCreateUser["name"].ToString();
                    user.NickName = jCreateUser["display_name"].ToString();
                    user.HeadImage = jCreateUser["avatar"].ToString();
                    user.Description  = jCreateUser["desc"].ToString();
                    user.Status = (UserProfile.UserStatus)int.Parse(jCreateUser["status"].ToString());
                    user.Online = (UserProfile.UserOnline)int.Parse(jCreateUser["online"].ToString());
                    project.CreatedBy = user;

                    return project;
                }
                catch (Exception)
                {
                    Debug.WriteLine("解析返回json失败---\n" + json);
                    return null;
                }
            }
        }