コード例 #1
0
        public static void doGetGroupMembers(Activity activity, int groupId, int type)
        {
            string url     = Global.ServerUrl + String.Format(Global.WebSvcGetGroupMembersFormat, Global.UserGroupMembersFunc, groupId, type);
            var    httpReq = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));

            httpReq.BeginGetResponse((ar) => {
                int success = 0;
                String msg  = "";
                List <GroupMemberInfo> _resultMembers = new List <GroupMemberInfo>();

                try{
                    var request = (HttpWebRequest)ar.AsyncState;
                    using (var response = (HttpWebResponse)request.EndGetResponse(ar))     {
                        var s          = response.GetResponseStream();
                        var membersArr = (JsonArray)JsonObject.Load(s);

                        for (int i = 0; i < membersArr.Count; i++)
                        {
                            JsonObject memberOne        = (JsonObject)membersArr[i];
                            GroupMemberInfo _memberInfo = new GroupMemberInfo();
                            _memberInfo.memberId        = memberOne["uid"];
                            _memberInfo.memberName      = memberOne["username"];
                            if (String.IsNullOrEmpty(memberOne["imgpath"]) == false)
                            {
                                _memberInfo.imgPath = Global.imgPhotoPrefix + memberOne["imgpath"];
                            }
                            _memberInfo.points = memberOne["points"];
                            _memberInfo.status = memberOne["status"];

                            if (type == 1 && _memberInfo.memberId == Global.userId)
                            {
                            }
                            else
                            {
                                _resultMembers.Add(_memberInfo);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                }

                if (type == GET_GROUPMEMBERS_GROUP)
                {
                    activity.RunOnUiThread(() => {
                        ((GroupActivity)activity).userGroupMembersWithResult(_resultMembers);
                    });
                }
                else if (type == GET_GROUPMEMBERS_TASKNEW)
                {
                    activity.RunOnUiThread(() => {
                        ((TaskNewActivity)activity).userGroupMembersWithResult(_resultMembers);
                    });
                }
            }, httpReq);
        }
コード例 #2
0
ファイル: GroupActivity.cs プロジェクト: david-denis/Chores
        public void changeUserInfo(int itemId)
        {
            if (itemId != -1)
            {
                GroupMemberInfo _info = _groupMemberList [itemId];

                // Show points/photo
                changeButtonEnable(_info.status);
            }
            else
            {
                changeButtonEnable(0);
            }
        }
コード例 #3
0
        private void addEmptyUsertoList()
        {
            GroupMemberInfo _noUserInfo = new GroupMemberInfo();

            _noUserInfo.memberName = "No User";

            userId = 0;
            Spinner spinnerUser = FindViewById <Spinner>(Resource.Id.spinnerUser);

            String[] _userNameArr = new String[1];
            _userNameArr[0] = "No User";

            ArrayAdapter <String> adapter_group = new ArrayAdapter <String>(this, Resource.Layout.SpinnerText, _userNameArr);

            adapter_group.SetDropDownViewResource(Resource.Layout.SpinnerText);
            spinnerUser.Adapter = adapter_group;
        }