protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SdataLayout); // Data from previous activity myID = Intent.GetIntExtra("myID", -1); receiverID = Intent.GetIntExtra("receiverID", -1); int PersID = Intent.GetIntExtra("PErsonId", -1); image1 = Intent.GetByteArrayExtra("image"); image = Intent.GetByteArrayExtra("picture"); // allaksame to image apo var se byte[] RetrieveData retrieve = new RetrieveData(); // retrieve "IsDoctor" IsDoctor = retrieve.RetreiveBool(); txt1 = FindViewById <TextView>(Resource.Id.txt1); message1 = FindViewById <EditText>(Resource.Id.editTxt1); message2 = FindViewById <EditText>(Resource.Id.editxt); Button Sendtext = FindViewById <Button>(Resource.Id.SendText); Sendtext.Click += Sendtext_ClickAsync; Button SendPhoto = FindViewById <Button>(Resource.Id.SendPhoto); SendPhoto.Click += SendPhoto_ClickAsync; Button button1 = FindViewById <Button>(Resource.Id.TakePhoto); button1.Click += Button_Click; Button button2 = FindViewById <Button>(Resource.Id.Gallery); button2.Click += Button2_Click; Button button3 = FindViewById <Button>(Resource.Id.Reselect); button3.Click += methodInvokeAlertDialogWithListView; Button button4 = FindViewById <Button>(Resource.Id.button6); button4.Click += Button4_Click; now = DateTime.Now.ToLocalTime(); string currentTime = (string.Format("Current Time: {0}", now)); }
private void Actions() { string endpoint; ConsumeRest cRest = new ConsumeRest(); Address address = new Address(); RetrieveData retrieve = new RetrieveData(); // retrieve "IsDoctor" IsDoctor = retrieve.RetreiveBool(); if (IsDoctor == false) { endpoint = address.Endpoint2 + "visits//?PersonId=" + myID; } else { endpoint = address.Endpoint2 + "visits//?PersonId=" + receiverID; } strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValid = validateJson.IsValidJson(strResponse); if (IsValid) { VISIT2 = JsonConvert.DeserializeObject <List <Visit2> >(strResponse.ToString()); VISIT2 = VISIT2.OrderBy(i => i.Date).ToList(); //convertClasses(); SetData(out mAdapter); expandableListView.SetAdapter(mAdapter); expandableListView.ChildClick += ExpandableListView_ChildClick1; } else { VISIT2 = JsonConvert.DeserializeObject <List <Visit2> >("[]".ToString()); new Android.App.AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found do to unexpected problem" + "\n" + strResponse) .SetIcon(Resource.Drawable.error) .Show(); } }
//public override bool OnCreateOptionsMenu(IMenu menu) //{ // MenuInflater.Inflate(Resource.Menu.option_menuGener, menu); // return true; //} //public override bool OnOptionsItemSelected(IMenuItem item) //{ // int id = item.ItemId; // if (id == Resource.Id.action_settings2) // { // Toast.MakeText(this, "Exit", ToastLength.Short).Show(); // History_ListviewActivity histListView = new History_ListviewActivity(); // histListView.AlertBox(); // return true; // } // else if (id == Resource.Id.action_settings3) // { // Toast.MakeText(this, "Reload", ToastLength.Short).Show(); // this.Recreate(); // return true; // } // return base.OnOptionsItemSelected(item); // //return super.onCreateView(inflater, container, savedInstanceState); //} #endregion private void setupMessages() { bool IsValid; string endpoint; List <ReceivedMessages> chMessages; Address address = new Address(); RetrieveData retrieve = new RetrieveData(); // retrieve "IsDoctor" IsDoctor = retrieve.RetreiveBool(); if (IsDoctor == false) { endpoint = address.Endpoint + "MessagesCommunication/" + myID + "/" + receiverID; } else { endpoint = address.Endpoint + "MessagesCommunication/" + receiverID + "/" + myID; } ConsumeRest cRest = new ConsumeRest(); strResponse = cRest.makeRequest(endpoint); ValidateJson validateJson = new ValidateJson(); IsValid = validateJson.IsValidJson(strResponse); if (IsValid) { chMessages = JsonConvert.DeserializeObject <List <ReceivedMessages> >(strResponse.ToString()); receivedMessag = chMessages.OrderBy(i => i.Date).ToList(); bool isSend; for (int i = 0; i < chMessages.Count; i++) { if ((IsDoctor == false) && (receivedMessag[i].IsMe == 0)) { isSend = true; } // check if message is send or received else if ((IsDoctor == true) && (receivedMessag[i].IsMe == 1)) { isSend = true; } else { isSend = false; } lstChat.Add(new chatMessages() { ChatMessage = receivedMessag[i].Text + "\n" + receivedMessag[i].Date, IsSend = isSend }); } } else { chMessages = JsonConvert.DeserializeObject <List <ReceivedMessages> >("[]".ToString()); new Android.App.AlertDialog.Builder(this) .SetTitle("An error has occured") .SetMessage("No data found do to unexpected problem" + "\n" + strResponse) .SetIcon(Resource.Drawable.error) .Show(); } }