protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Login);
WarpClient.initialize(Constants.API_KEY, Constants.SECRET_KEY);
WarpClient.GetInstance().AddConnectionRequestListener(this);
//Create the user interface in code
var layout = new LinearLayout(this);
layout.Orientation = Orientation.Vertical;
var btnLogin = FindViewById<ImageButton>(Resource.Id.imgbtnLogin);
var txtUserId = FindViewById<EditText>(Resource.Id.txtUsername);
var txtPassword = FindViewById<EditText>(Resource.Id.txtPassword);
btnLogin.Click += (sender, e) =>
{
//WarpClient.setRecoveryAllowance(10);
//WarpClient.GetInstance().RecoverConnection();
WarpClient.GetInstance().Connect(txtUserId.Text);
//StartActivity(typeof(MainActivity));
//this.Finish();
};
}
public void onConnectDone(ConnectEvent evt)
{
if (Looper.MyLooper() == null)
Looper.Prepare();
if (evt.getResult() == WarpResponseResultCode.SUCCESS)
{
Console.WriteLine("Connection Successful");
Android.Widget.Toast.MakeText(this, "Connection Successful", Android.Widget.ToastLength.Long).Show();
StartActivity(typeof(MainActivity));
this.Finish();
}
else
{
Console.WriteLine("Connection Failed");
Android.Widget.Toast.MakeText(this, "Connection Failed", Android.Widget.ToastLength.Long).Show();
}
}