【发布时间】:2015-08-18 05:47:31
【问题描述】:
我在 windows phone 中进行应用聊天,我有一个类名为 GetFriendResponse
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RAMACHAT.Model
{
public class FriendInfo
{
public bool success { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
public _user data { get; set; }
}
public class GetFriendResponse
{
public bool success { get; set; }
public int statusCode { get; set; }
public string message { get; set; }
public string _id { get; set; }
public List<_user> data { get; set; }
}
和类 _user 为
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RAMACHAT.Model
{
public class _user
{
public string _id { get; set; }
public string username { get; set; }
public string avatar { get; set; }
public bool isOnline { get; set; }
public bool isFollow { get; set; }
}
}
}
现在我想在服务器响应用户 frendslist 时将 frendslist 设为 longlistselector
string result = await App.client.getAllFriends();
string resultHistory = await App.client.getChatHistory();
resultObject = JsonConvert.DeserializeObject<GetFriendResponse>(result);
var resultHistoryObject = JsonConvert.DeserializeObject<HistoryResponse>(resultHistory);
List<AlphaKeyGroup.AlphaKeyGroup1<_user>> DataSource = AlphaKeyGroup.AlphaKeyGroup1<_user>.CreateGroups(resultObject.data,
System.Threading.Thread.CurrentThread.CurrentUICulture,
(_user s) => { return s.username; }, true);
friendList.ItemsSource = DataSource;
但它不起作用,任何人有解决它的想法,非常感谢!
【问题讨论】:
标签: c# windows-phone-7 windows-phone-8 windows-phone-8.1 longlistselector