点击:
lstText.ItemClick += (sender, args) =>
{
Logon(GetString(Resource.String.LogonMessage), sUUID, sUserId, sUserPIN);
};
警报对话框:
private void Logon(string message, string sUUID, string sUserId, string sUserPIN) //
{
RunOnUiThread(() =>
{
var uuidFetch = this.GetSystemService(Context.TelephonyService) as Android.Telephony.TelephonyManager;
var IMEI = uuidFetch.DeviceId;
var getUserId = LayoutInflater.From(this).Inflate(Resource.Layout.Login, null);
getUserId.FindViewById<TextView>(Resource.Id.getUserId).Text = sUserId;
var getPIN = LayoutInflater.From(this).Inflate(Resource.Layout.Login, null);
getPIN.FindViewById<EditText>(Resource.Id.sUserPin).Text = sUserPIN;
new AlertDialog.Builder(this)
.SetTitle(GetString(Resource.String.LogonTitle))
.SetMessage(message)
.SetView(getUserId)
.SetView(getPIN)
.SetCancelable(true)
.SetPositiveButton(GetString(Resource.String.LogonOk), (sender, e) =>
{
sUUID = IMEI;
sUserId = "474";
sUserPIN = getPIN.FindViewById<EditText>(Resource.Id.sUserPin).Text;
Window.SetSoftInputMode(SoftInput.StateHidden);
ThreadPool.QueueUserWorkItem(o => Authorize(sUUID, sUserId, sUserPIN));
SetContentView(Resource.Layout.Splash);
})
.SetNegativeButton(GetString(Resource.String.LogonCancel), (sender, e) =>
{
Window.SetSoftInputMode(SoftInput.StateHidden);
})
.Show();
});
正如您在警报对话框中看到的那样,我的 sUserId 是静态的(因为我正在测试和构建应用程序,而且我真的处于开发的早期阶段)但我需要它是列表中的一个值,因为每个项目(ergo 用户)在listview 中有他自己的sUserId。
我的项目适配器中的几行:
var sUserId = view.FindViewById<TextView>(Resource.Id.sUserId);
sUserId.Text = item.sUserId != null ? item.sUserId : "";
如果需要,我将提供任何进一步的代码/信息。感谢您的时间,您的建议和任何提示,以帮助我解决我的问题。