protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window.RequestFeature(WindowFeatures.NoTitle);
                SetContentView(Resource.Layout.ConversationLayout);
                ServiceWrapper svc = new ServiceWrapper();
                InsertMessages ins = new InsertMessages();
                SenderList   = FindViewById <ListView>(Resource.Id.senderList);
                ReceiverList = FindViewById <ListView>(Resource.Id.receiverList);

                ConversationResponse cvr = new ConversationResponse();
                cvr   = svc.GetConversationList(1, 2).Result;
                myArr = cvr.ConversationList.ToList <RetriveMessages>();
                SenderListAdapter adapter = new SenderListAdapter(this, myArr);
                SenderList.Adapter = adapter;
                ConversationResponse cvr1 = new ConversationResponse();
                cvr1   = svc.GetConversationList(2, 1).Result;
                myArr1 = cvr1.ConversationList.ToList <RetriveMessages>();
                ReceiverListAdapter adapter1 = new ReceiverListAdapter(this, myArr1);
                ReceiverList.Adapter = adapter1;

                EditText    ed      = FindViewById <EditText>(Resource.Id.txtmsg);
                ImageButton btnsend = FindViewById <ImageButton>(Resource.Id.btnSend);
                btnsend.Click += async delegate
                {
                    ins.InsertMessage = ed.Text;
                    ins.sender_id     = 2;//Convert.ToInt32(CurrentUser.getUserId());
                    ins.receiver_id   = 1;
                    int i = await svc.InsertMessage(ins);

                    try
                    {
                        RefreshParent();
                    }
                    catch (Exception e)
                    {
                    }
                    ed.Dispose();
                };
            }
            catch (Exception e)
            {
            }
        }
 public void RefreshParent()
 {
     try
     {
         ServiceWrapper       svc = new ServiceWrapper();
         ConversationResponse cvr = new ConversationResponse();
         cvr   = svc.GetConversationList(Convert.ToInt32(CurrentUser.getUserId()), 2).Result;
         myArr = cvr.ConversationList.ToList <RetriveMessages>();
         SenderListAdapter adapter = new SenderListAdapter(this, myArr);
         SenderList.Adapter = adapter;
         adapter.NotifyDataSetChanged();
         ConversationResponse cvr1 = new ConversationResponse();
         cvr1   = svc.GetConversationList(2, Convert.ToInt32(CurrentUser.getUserId())).Result;
         myArr1 = cvr1.ConversationList.ToList <RetriveMessages>();
         ReceiverListAdapter adapter1 = new ReceiverListAdapter(this, myArr1);
         ReceiverList.Adapter = adapter1;
         adapter1.NotifyDataSetChanged();
     }
     catch (Exception e)
     {
     }
 }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.RequestFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.OtpReceiverLayout);
            string Sentotp = Intent.GetStringExtra("otp");
            string email=Intent.GetStringExtra("email");
            string address = Intent.GetStringExtra("address");
            string password = Intent.GetStringExtra("password");
            string username = Intent.GetStringExtra("username");
            string mobilenumber = Intent.GetStringExtra("mobilenumber");
            EditText receivedOtp = FindViewById<EditText>(Resource.Id.txtOtp);
            Button btnVerification = FindViewById<Button>(Resource.Id.btnVerify);
            btnVerification.Click += async delegate
            {
                if (Sentotp == receivedOtp.Text)
                {
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetTitle("Successfully you are registered");
                    alert.SetMessage("Thank You");
                    alert.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                    ServiceWrapper svc = new ServiceWrapper();
                    Registration ud = new Registration();
                    try
                    {
                        
                        ud.address = address;
                        ud.city = password;
                        ud.firstName = username;
                        ud.lastName = username;
                        ud.password = password;
                        ud.email = email;
                        ud.dob= DateTime.Now;
                        ud.gender = "M";
                        ud.country = "India";
                        ud.mobile = mobilenumber;
                        
                        
                        await svc.InsertUpdateUsers(ud);
                    }
                    catch(Exception e)
                    {
                        Toast.MakeText(this, e.Message, ToastLength.Short);
                    }
                    UserDetailsResponse udsr = new UserDetailsResponse();
                    udsr = svc.userdetailsList(mobilenumber).Result;
                    string uid = Convert.ToString(udsr.UserDetailsList[0].user_id);
                    CurrentUser.SaveUserId(uid);
                    var intent = new Intent(this, typeof(ProfilePictureSetActivity));
                    StartActivity(intent);
                }
                else
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Incorrect Otp");
                    aler.SetMessage("Please Check Again");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();

                }
            };
            
        }