我是从 WCF 创建的,我可以知道如何专门读取数据吗?
[DataContract]
public class UserData
{
[DataMember]
public int userID { get; set; }
[DataMember]
public string name { get; set; }
[DataMember]
public string email { get; set; }
[DataMember]
public string contact { get; set; }
[DataMember]
public string status { get; set; }
}
这是 WCF 方面并从 WCF 返回,我想从 Window 手机中读取此内容。我可以知道有一些例子吗?谢谢你的回复
更新
我要使用数据的电话部分中的代码
private Service1Client _serviceClient;
public Login()
{
InitializeComponent();
_serviceClient = new Service1Client();
_serviceClient.LoginUserCompleted += new EventHandler<LoginUserCompletedEventArgs>(_serviceClient_LoginUserCompleted);
}
private void loginBtn_Click(object sender, RoutedEventArgs e)
{
_serviceClient.LoginUserAsync(txtEmail.Text, txtPassword.Password);
}
private void _serviceClient_LoginUserCompleted(object sender, LoginUserCompletedEventArgs e)
{
if (e.Error == null && e.Result != null)
{
(App.Current as App).MyUserID = 16; MessageBox.Show("Welcome " + e.Result + "!"); //ContentPanel.Visibility = Visibility.Collapsed; //Data.Visibility = Visibility.Visible; //Testing.ItemsSource = e.Result;
想知道如何使这几行代码相应地读取数据,将其放入列表或可以提取特定数据,目前这几行代码给了我这个答案::
WCFReference.UserData
}
else
{
MessageBox.Show(e.Error.InnerException.Message + " Couldn't Login, Please try again =D");
}
}