protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException; SetContentView(Resource.Layout.MyContactslayout); groupmodel = JsonConvert.DeserializeObject <GroupRequestViewModel>(Intent.GetStringExtra("GroupObject")); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.app_bar); SetSupportActionBar(toolbar); SupportActionBar.SetTitle(Resource.String.AddContacts); paginationModel.Status = 2; mRecyclerView = FindViewById <RecyclerView>(Resource.Id.lvGroupContactList); if (mRecyclerView != null) { mRecyclerView.HasFixedSize = true; var layoutManager = new LinearLayoutManager(this); mRecyclerView.SetLayoutManager(layoutManager); } paginationModel.SkipRecords = 0; loadadapter(); } catch (System.Exception ex) { Crashes.TrackError(ex); } }
private async void PostGroupData() { try { if (groupmodel != null && ContactList.Count > 0) { List <GroupMemberViewModel> ListGroupMemberViewModel = new List <GroupMemberViewModel>(); for (int i = 0; i < ContactList.Count; i++) { if (ContactList[i].isSelected()) { var _objGroupMemberViewModel = new GroupMemberViewModel { MemberId = ContactList[i].ContactId }; ListGroupMemberViewModel.Add(_objGroupMemberViewModel); } } var _objGroupRequestModel = new GroupRequestViewModel { Name = groupmodel.Name, Description = groupmodel.Description, InterestId = groupmodel.InterestId, MemberCount = ListGroupMemberViewModel.Count(), Visibility = 1, IsPrivate = groupmodel.IsPrivate, GroupType = groupmodel.GroupType, Members = ListGroupMemberViewModel, UserId = CommonHelper.GetUserId(), PictureUrl = groupmodel.PictureUrl }; var result = await new GroupChatService().CreateGroup(_objGroupRequestModel); if (result.Status == 1) { var modelGroup = JsonConvert.DeserializeObject <GroupResponseViewModel>(result.Response.ToString()); await _objChatSignalRService.GroupCreate(modelGroup); GroupRepository.SaveGroupCreated(modelGroup); foreach (var member in modelGroup.Members) { GroupRepository.SaveorUpdateGroupMember(member, modelGroup.GroupId); } StartActivity(typeof(MainActivity)); } } } catch (System.Exception ex) { Crashes.TrackError(ex); } }
private async void uploadMedia(string filePath, string mediaType) { var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType); var url = ""; try { // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black); if (mediaType == "Photo") { await AWSUploader.AWSUploadImage(filePath, mediaName); } else { await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType); } url = AWSUploader.GetMediaUrl(mediaType) + mediaName; try { if (string.IsNullOrEmpty(url)) { Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show(); } else { var model = new GroupRequestViewModel { Name = txtGroupName.Text, Description = txtGroupDesc.Text, GroupType = (GroupType)grouptype, InterestId = Convert.ToInt32(drpInterestList[drpInterest.SelectedItemPosition].Value), IsPrivate = privategroup.Checked, PictureUrl = url }; Intent intent = new Intent(this, typeof(SelectGroupContactActivity)); intent.PutExtra("GroupObject", JsonConvert.SerializeObject(model)); StartActivity(intent); } } catch (Java.Lang.Exception e) { Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } } catch (Java.Lang.Exception e) { Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } }
public void InsertCreateGroupdata() { if (txtGroupName.Text.Trim() == "") { txtGroupName.BecomeFirstResponder(); new UIAlertView("Create Group", "Enter Group Name", null, "OK", null).Show(); return; } if (cmbInterestPicker.Text == "--Select Interest--") { new UIAlertView("Create Group", "Please Select Interest", null, "OK", null).Show(); return; } if (txtDescription.Text == "") { txtDescription.BecomeFirstResponder(); new UIAlertView("Create Group", "Group Description is empty", null, "OK", null).Show(); return; } BTProgressHUD.Show("Please Wait", maskType: ProgressHUD.MaskType.Black); GroupRequestViewModel model = new GroupRequestViewModel(); model = new GroupRequestViewModel { Name = txtGroupName.Text, Description = txtDescription.Text, GroupType = (GroupType)grouptype, InterestId = interestID, IsPrivate = privategroup }; if (!string.IsNullOrEmpty(filePath)) { uploadMedia(filePath, mediaType, model); } else { BTProgressHUD.Dismiss(); var viewController = (SelectGroupContactViewController)Storyboard.InstantiateViewController("SelectGroupContactViewController"); viewController.groupmodel = model; NavigationController.PushViewController(viewController, true); } }
public async Task <InpowerResult> CreateGroup(GroupRequestViewModel model) { InpowerResult resp = null; try { resp = await _helper.Post <GroupRequestViewModel>(model, GlobalConstant.GroupChatUrls.PostGroupUrl.ToString()); return(resp); } catch (Exception ex) { CrashReportService crashReport = new CrashReportService(); CrashReportModel CR = new CrashReportModel(); CR.Filename = "Registration"; CR.Eventname = "AccountService"; // CR.UserID = GlobalClass.UserID == null ? "0" : GlobalClass.UserID; CR.ErrorMsg = ex.Message + ex.StackTrace; await crashReport.SendCrashReport(CR, GlobalConstant.CrashUrl); return(resp); } }
private async void uploadMedia(string filePath, string mediaType, GroupRequestViewModel model) { var mediaName = System.IO.Path.GetFileName(filePath); //AWSUploader.SetMediaName (mediaType); var url = ""; try { // BTProgressHUD.Show("Processing media..", maskType: ProgressHUD.MaskType.Black); if (mediaType == "Photo") { await AWSUploader.AWSUploadImage(filePath, mediaName); } else { await AWSUploader.AWSUploadAudioVideo(filePath, mediaName, mediaType); } url = AWSUploader.GetMediaUrl(mediaType) + mediaName; try { if (string.IsNullOrEmpty(url)) { //Toast.MakeText(this, "Check Your Internet Connection", ToastLength.Long).Show(); } else { GroupRequestViewModel groupRequestViewModel = new GroupRequestViewModel(); groupRequestViewModel = new GroupRequestViewModel { Name = txtGroupName.Text, Description = txtDescription.Text, GroupType = (GroupType)grouptype, InterestId = interestID, IsPrivate = privategroup, PictureUrl = url }; BTProgressHUD.Dismiss(); InvokeOnMainThread(delegate { var viewController = (SelectGroupContactViewController)Storyboard.InstantiateViewController("SelectGroupContactViewController"); viewController.groupmodel = groupRequestViewModel; NavigationController.PushViewController(viewController, true); }); } } catch (Exception e) { Crashes.TrackError(e); BTProgressHUD.Dismiss(); new UIAlertView("Error", e.ToString(), null, "OK", null).Show(); //Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } } catch (Exception e) { Crashes.TrackError(e); BTProgressHUD.Dismiss(); new UIAlertView("Error", e.ToString(), null, "OK", null).Show(); //Toast.MakeText(this, e.Message, ToastLength.Long).Show(); } }
private void CreateGroup() { Drawable icon_error = Resources.GetDrawable(Resource.Drawable.alert); icon_error.SetBounds(0, 0, 50, 50); if (txtGroupName.Text.Trim() == "") { txtGroupName.SetError("Group Name is empty", icon_error); txtGroupName.RequestFocus(); return; } if (drpInterest.SelectedItemId == 0) { Toast.MakeText(this, "Please Select Interest", ToastLength.Long).Show(); return; } if (txtGroupDesc.Text == "") { txtGroupDesc.RequestFocus(); txtGroupDesc.SetError("Group Description is empty", icon_error); return; } if (!string.IsNullOrEmpty(filePath)) { uploadMedia(filePath, mediaType); } else { var model = new GroupRequestViewModel { Name = txtGroupName.Text, Description = txtGroupDesc.Text, GroupType = (GroupType)grouptype, InterestId = Convert.ToInt32(drpInterestList[drpInterest.SelectedItemPosition].Value), IsPrivate = privategroup.Checked }; Intent intent = new Intent(this, typeof(SelectGroupContactActivity)); intent.PutExtra("GroupObject", JsonConvert.SerializeObject(model)); StartActivity(intent); } try { //if (txtGroupName.Text== "") //{ // txtGroupDesc.RequestFocus(); // txtGroupDesc.SetError("Group Name is empty", icon_error); //} // if (txtGroupDesc.Text == "") // { // txtGroupDesc.RequestFocus(); // txtGroupDesc.SetError("Group Description is empty", icon_error); //} // if (drpInterest.SelectedItem.ToString() == null) // { // Toast.MakeText(this, "Please Select Interest", ToastLength.Long).Show(); // } } catch (Exception ex) { } }
public SelectGroupContactViewController(IntPtr handle) : base(handle) { this.groupmodel = groupmodel; }
private async Task PostGroupData() { try { if (groupmodel != null && ContactList.Count > 0) { List <GroupMemberViewModel> ListGroupMemberViewModel = new List <GroupMemberViewModel>(); for (int i = 0; i < ContactList.Count; i++) { if (ContactList[i].isSelected()) { var _objGroupMemberViewModel = new GroupMemberViewModel { MemberId = ContactList[i].ContactId, MemberName = ContactList[i].ConatactName }; ListGroupMemberViewModel.Add(_objGroupMemberViewModel); } } var _objGroupRequestModel = new GroupRequestViewModel { Name = groupmodel.Name, Description = groupmodel.Description, InterestId = groupmodel.InterestId, MemberCount = ListGroupMemberViewModel.Count, Visibility = 1, IsPrivate = groupmodel.IsPrivate, GroupType = groupmodel.GroupType, Members = ListGroupMemberViewModel, UserId = CommonHelper.GetUserId(), PictureUrl = groupmodel.PictureUrl }; BTProgressHUD.Show("Create Group", maskType: ProgressHUD.MaskType.Black); var result = await new GroupChatService().CreateGroup(_objGroupRequestModel); if (result.Status == 1) { var modelGroup = JsonConvert.DeserializeObject <GroupResponseViewModel>(result.Response.ToString()); await _objChatSignalRService.GroupCreate(modelGroup); GroupRepository.SaveGroupCreated(modelGroup); foreach (var member in modelGroup.Members) { GroupRepository.SaveorUpdateGroupMember(member, modelGroup.GroupId); } BTProgressHUD.Dismiss(); //this.DismissViewController(true, null); UIStoryboard storyboard = this.Storyboard; RootViewController viewController = (RootViewController) storyboard.InstantiateViewController("RootViewController"); this.PresentViewController(viewController, true, null); } BTProgressHUD.Dismiss(); } } catch (System.Exception ex) { BTProgressHUD.Dismiss(); Crashes.TrackError(ex); } }