private void AddNewUsers() { userDetails = new List<User> (); newUserCount = 0; toBeGrabbed = newUsersToAdd.Count; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetSpecificCompleted += Service_UserGetSpecificDone; service.UserGetSpecificAsync (AndroidData.CurrentUser.AccountID, newUsersToAdd [newUserCount], new Guid (AndroidData.ServiceAuthToken)); }
private void resetPass(object sender, EventArgs e, string email) { if (ValidateEmailAddress (email)) { Toast.MakeText (c, Resource.String.passwordRecoveryRequestingResetCode, ToastLength.Short).Show (); this.emailAddress = email; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); /*service.UserGetResetTokenCompleted += Service_UserGetResetTokenCompleted; service.UserGetResetTokenAsync (emailAddress, new Guid (AndroidData.ServiceAuthToken));*/ service.AuthenticationTokenGetCompleted += Service_AuthenticationTokenGetCompleted; service.AuthenticationTokenGetAsync (AndroidData.NewDeviceID); } }
private void loginNewPass(object sender, EventArgs e, string pass, string verify) { if (this.ValidateFields(pass, verify)) { RunOnUiThread(() => Toast.MakeText(c, Resource.String.resetResetting, ToastLength.Short).Show()); password = pass.Trim(); token.Trim(); email.Trim(); #if DEBUG System.Diagnostics.Debug.WriteLine("sending email {0}, token {1}, password {2}, ServiceAuthToken {3}", email, token, password, AndroidData.ServiceAuthToken); #endif LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserPasswordResetCompleted += Service_UserPasswordResetCompleted; service.UserPasswordResetAsync(email, token, password, new Guid(AndroidData.ServiceAuthToken)); } }
private void startUserLogin(ISocialProviderManager provider) { parent.RunOnUiThread(() => Toast.MakeText(c, Resource.String.commonLoggingIn, ToastLength.Short).Show()); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.AuthenticationTokenGetCompleted += Service_AuthenticationTokenGetCompleted; service.AuthenticationTokenGetAsync(AndroidData.NewDeviceID, provider); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.ComposeMessageMain); readOnly = base.Intent.GetBooleanExtra("readonly", false); dbm = wowZapp.LaffOutOut.Singleton.dbm; mmg = wowZapp.LaffOutOut.Singleton.mmg; Guid profPic = Guid.Empty; UserDB user = null; ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader); TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, header.Context); context = header.Context; Header.headertext = Application.Context.Resources.GetString(Resource.String.messageCreateMessageTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; imgProfilePic = FindViewById<ImageView>(Resource.Id.imgProfilePic); imgProfilePic.SetBackgroundResource(Resource.Drawable.emptybackground); hasMoved = regenerate = false; this.thumbImageWidth = (int)ImageHelper.convertDpToPixel(80f, context); this.thumbImageHeight = (int)ImageHelper.convertDpToPixel(100f, context); btnSend = FindViewById<Button>(Resource.Id.btnSend); btnBack = FindViewById<ImageButton>(Resource.Id.btnBack); btnBack.Tag = 0; btnHome = FindViewById<ImageButton>(Resource.Id.btnHome); btnHome.Tag = 1; btnPlay = FindViewById<ImageView>(Resource.Id.imgPlay); btnPlay.Click += new EventHandler(btnPlay_Click); txtFullname = FindViewById<TextView>(Resource.Id.txtAuthorName); txtMessage = FindViewById<TextView>(Resource.Id.txtMainMessage); LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder); ImageButton[] buttons = new ImageButton[2]; buttons [0] = btnBack; buttons [1] = btnHome; ImageHelper.setupButtonsPosition(buttons, bottom, context); if (ComposeMessageMainUtil.contentPackID == null) ComposeMessageMainUtil.contentPackID = new int[7]; for (int i = 0; i < 6; ++i) ComposeMessageMainUtil.contentPackID [i] = -1; txtMessage.Click += delegate { int n = 0, t = -1; for (n = 0; n < ComposeMessageMainUtil.currentPosition.Length; ++n) { if (ComposeMessageMainUtil.currentPosition [n] == 0) { t = n; break; } } if (n == ComposeMessageMainUtil.currentPosition.Length) { for (n = 0; n < ComposeMessageMainUtil.currentPosition.Length; ++n) { if (ComposeMessageMainUtil.msgSteps [n].StepType == MessageStep.StepTypes.Text) { if (ComposeMessageMainUtil.msgSteps [n].MessageText == txtMessage.Text) { t = n; break; } } } if (t == -1) RunOnUiThread(() => Toast.MakeText(context, Application.Context.GetString(Resource.String.errorNoSpaceForText), ToastLength.Short).Show()); } else { RunOnUiThread(delegate { Intent it = new Intent(this, typeof(ComposeTextMessageActivity)); it.PutExtra("text", txtMessage.Text != Application.Context.Resources.GetString(Resource.String.composeTextMessagelblMessage) ? ComposeMessageMainUtil.msgSteps [t].MessageText : string.Empty); it.PutExtra("CurrentStep", base.Intent.GetIntExtra("CurrentStep", 1)); StartActivity(it); }); } }; imgSteps = new ImageView[6]; imgSets = new bool[6]; imgSteps [0] = FindViewById<ImageView>(Resource.Id.imgStep1); imgSteps [0].Tag = 0; imgSteps [1] = FindViewById<ImageView>(Resource.Id.imgStep2); imgSteps [1].Tag = 1; imgSteps [2] = FindViewById<ImageView>(Resource.Id.imgStep3); imgSteps [2].Tag = 2; imgSteps [3] = FindViewById<ImageView>(Resource.Id.imgStep4); imgSteps [3].Tag = 3; imgSteps [4] = FindViewById<ImageView>(Resource.Id.imgStep5); imgSteps [4].Tag = 4; imgSteps [5] = FindViewById<ImageView>(Resource.Id.imgStep6); imgSteps [5].Tag = 5; for (int z = 0; z < 6; ++z) imgSets [z] = true; bool multi = false; if (ComposeMessageMainUtil.messageDB != null) { if (ComposeMessageMainUtil.messageDB.MessageRecipientDBList != null) { int n = 0; for (int j = 0; j < ComposeMessageMainUtil.currentPosition.Length; ++j) ComposeMessageMainUtil.currentPosition [j] = 0; regenerateIcons(); foreach (MessageStepDB mesg in ComposeMessageMainUtil.messageDB.MessageStepDBList) { #if DEBUG Console.WriteLine("MessageStepDB item = {0}", mesg); #endif MessageStep mSt = MessageStepDB.ConvertFromMessageStepDB(mesg); ComposeMessageMainUtil.msgSteps.Add(mSt); ComposeMessageMainUtil.currentPosition [n] = 1; } } } if (readOnly) { user = dbm.GetUserWithAccountID(ComposeMessageMainUtil.messageDB.FromAccountID.ToString()); if (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count > 1) multi = true; if (user.Picture.Length == 0) profPic = user.AccountID; else loadProfilePicture(user, imgProfilePic); } else { user = UserDB.ConvertFromUser(AndroidData.CurrentUser); if (AndroidData.CurrentUser.Picture.Length == 0) profPic = AndroidData.CurrentUser.AccountID; else loadProfilePicture(user, imgProfilePic); } imgProfilePic.Tag = new Java.Lang.String("profilepic_" + user.AccountID); string name = user.FirstName + " " + user.LastName; if (multi == true) { if (ComposeMessageMainUtil.messageDB == null) name += " and " + (Contacts.SelectContactsUtil.selectedContacts.Count - 1).ToString() + (Contacts.SelectContactsUtil.selectedContacts.Count - 1 > 1 ? " others" : "other"); else name += " and " + (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count - 1).ToString() + (ComposeMessageMainUtil.messageDB.MessageRecipientDBList.Count - 1 > 1 ? " others" : "other"); } float fontSize = txtFullname.TextSize; txtFullname.SetTextSize(Android.Util.ComplexUnitType.Dip, ImageHelper.getNewFontSize(fontSize, context)); txtFullname.Text = name; fontSize = txtMessage.TextSize; txtMessage.SetTextSize(Android.Util.ComplexUnitType.Dip, ImageHelper.getNewFontSize(fontSize, context)); if (readOnly == false) { for (int n = 0; n < 6; ++n) { if (imgSets [n]) { int step = new int(); step = n; imgSteps [step].Click -= (object s, EventArgs e) => { imgClickEvent(s, e, 9, step);}; imgSteps [step].Click += (object s, EventArgs e) => { imgClickEvent(s, e, 9, step);}; } imgSteps [n].SetOnLongClickListener(this); } ReloadMessageSteps(); } else { this.SetButtonImagesForMessageSteps(); header.Text = Application.Context.Resources.GetString(Resource.String.messageReadMessage); btnSend.Visibility = ViewStates.Invisible; ImageView a1 = FindViewById<ImageView>(Resource.Id.arrow1); ImageView a2 = FindViewById<ImageView>(Resource.Id.arrow2); ImageView a3 = FindViewById<ImageView>(Resource.Id.arrow3); ImageView a4 = FindViewById<ImageView>(Resource.Id.arrow4); a1.Visibility = a2.Visibility = a3.Visibility = a4.Visibility = ViewStates.Invisible; } co = 0; btnBack.Click += delegate { for (int i = 0; i < 6; ++i) ComposeMessageMainUtil.currentPosition [i] = 0; for (int i = 0; i < 7; ++i) ComposeMessageMainUtil.contentPackID [i] = -1; ComposeMessageMainUtil.message = null; ComposeMessageMainUtil.messageDB = null; ComposeMessageMainUtil.msgSteps = null; ComposeMessageMainUtil.pollSteps = null; Finish(); }; btnHome.Click += delegate { Intent i = new Intent(this, typeof(Main.HomeActivity)); i.AddFlags(ActivityFlags.ClearTop); StartActivity(i); }; btnSend.Click += delegate { SendMessage(); Finish(); }; if (profPic != Guid.Empty) { Guid finder = profPic != Guid.Empty ? profPic : AndroidData.CurrentUser.AccountID; LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, finder, new Guid(AndroidData.ServiceAuthToken)); } }
private void CreatePreviewUI() { int m = 0; isConversation = false; header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader); Header.headertext = Application.Context.Resources.GetString (Resource.String.messageListHeaderViewTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; listWrapper.RemoveAllViewsInLayout (); Dictionary<string, MessageInfo> latestMessages = new Dictionary<string, MessageInfo> (); Dictionary<string, string> unreadMessageCounts = new Dictionary<string, string> (); string ownerAccountId = AndroidData.CurrentUser.AccountID.ToString (); foreach (ConversationInfo eachConversationInfo in this.conversationItems.Values) { MessageInfo latestMessage = eachConversationInfo.GetLatestMessage (); string messageCountStr = eachConversationInfo.Messages .Count (s => s.Value.Message.MessageRecipientDBList.Count (t => t.AccountGuid == ownerAccountId && !t.IsRead) > 0) .ToString (); latestMessages.Add (eachConversationInfo.ConversationID, latestMessage); unreadMessageCounts.Add (eachConversationInfo.ConversationID, messageCountStr); } if (getGuid != null) getGuid.Clear (); RunOnUiThread (delegate { foreach (KeyValuePair<string, MessageInfo> eachMessage in latestMessages) { eachMessage.Value.Message.MessageRecipientDBList = eachMessage.Value.Message.MessageRecipientDBList.Where (x => x != null).ToList (); string messager = string.Empty; string tmpName = string.Empty; ImageView random = null; LinearLayout.LayoutParams randomParams = null; LinearLayout layout = new LinearLayout (context); LinearLayout.LayoutParams layoutparams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); layoutparams.SetMargins (0, 0, 0, (int)ImageHelper.convertDpToPixel (10f, context)); layout.LayoutParameters = layoutparams; layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity (GravityFlags.Center); layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context)); ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context)); if (eachMessage.Key != null) { UserDB who = null; if (eachMessage.Value.MessageUser != null) who = eachMessage.Value.MessageUser; else who = null; if (who.AccountGuid == AndroidData.CurrentUser.AccountID.ToString ()) who = dbm.GetUserWithAccountID (eachMessage.Value.Message.MessageRecipientDBList [0].AccountGuid); if (who == null) { #if DEBUG System.Diagnostics.Debug.WriteLine ("UserDB = null for {0}, bugging out", latestMessages); #endif m++; } else { profilepic.Tag = new Java.Lang.String ("profilepic_" + who.AccountID); profilepic.SetImageResource (Resource.Drawable.defaultuserimage); layout.AddView (profilepic); if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) { List<UserDB> imageList = new List<UserDB> (); foreach (MessageRecipientDB human in eachMessage.Value.Message.MessageRecipientDBList) { imageList.Add (dbm.GetUserWithAccountID (human.AccountGuid)); } RunOnUiThread (delegate { createMultipleForContact (imageList); if (multipleContact != null) profilepic.SetImageBitmap (multipleContact); else profilepic.SetImageResource (Resource.Drawable.defaultuserimage); }); } else { if (who.Picture.Length == 0 && who.HasProfileImage) getGuid.Add (who.AccountID); else { if (who.Picture.Length > 0) this.LoadUserImage (who, profilepic); else profilepic.SetImageResource (Resource.Drawable.defaultuserimage); } } LinearLayout layout2 = new LinearLayout (context); layout2.Orientation = Orientation.Vertical; layout2.SetGravity (GravityFlags.Left); using (TextView name = new TextView (context)) { name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (25f, context)); name.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (20f, context), 0); name.Gravity = GravityFlags.Left; name.SetTextColor (Color.White); name.TextSize = 16f; tmpName = who.FirstName + " " + who.LastName; if (eachMessage.Value.Message.MessageRecipientDBList.Count > 1) { if (eachMessage.Value.Message.MessageRecipientDBList.Count == 1 || eachMessage.Value.Message.MessageRecipientDBList.Count - 1 == 1) tmpName += " 1 other"; else tmpName += " " + string.Format ("{0} others", eachMessage.Value.Message.MessageRecipientDBList.Count - 1); } name.Text = tmpName; layout2.AddView (name); } if (eachMessage.Value.Message.MessageStepDBList.Count == 1 && eachMessage.Value.Message.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) { using (TextView txtMessage = new TextView (context)) { using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context))) { txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0); txtMessage.LayoutParameters = txtMessageParams; } txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context)); txtMessage.Gravity = GravityFlags.CenterVertical; if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID) txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright); else txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft); txtMessage.TextSize = 16f; for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) { messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = ""; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); txtMessage.SetHeight (nolines); txtMessage.SetTextColor (Android.Graphics.Color.Black); txtMessage.Text = messager; txtMessage.ContentDescription = eachMessage.Key; txtMessage.Click += ConversationItem_Clicked; layout2.AddView (txtMessage); } } else { int text = 0; for (int tt = 0; tt < eachMessage.Value.Message.MessageStepDBList.Count; ++tt) { if (eachMessage.Value.Message.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text) text++; } LinearLayout layout3 = new LinearLayout (context); LinearLayout.LayoutParams layout3params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); layout3params.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context)); layout3.LayoutParameters = layout3params; layout3.Orientation = Orientation.Horizontal; layout3.SetGravity (GravityFlags.Left); layout3.ContentDescription = eachMessage.Key; layout3.Click += ConversationLayItem_Clicked; layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); layout3.SetVerticalGravity (GravityFlags.CenterVertical); layout3.SetMinimumHeight (30); layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); int end = eachMessage.Value.Message.MessageStepDBList.Count > 3 ? 3 : eachMessage.Value.Message.MessageStepDBList.Count; for (int i = 0; i < end; ++i) { switch (eachMessage.Value.Message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: if (text == 1) { using (TextView txtMessage = new TextView (context)) { using (LinearLayout.LayoutParams txtMessageParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context))) { txtMessageParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, 0, 0); txtMessage.LayoutParameters = txtMessageParams; } txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (20f, context), (int)ImageHelper.convertDpToPixel (10f, context)); txtMessage.Gravity = GravityFlags.CenterVertical; if (eachMessage.Value.Message.FromAccountID == AndroidData.CurrentUser.AccountID) txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidright); else txtMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft); txtMessage.TextSize = 16f; for (int e = 0; e < eachMessage.Value.Message.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (eachMessage.Value.Message.MessageStepDBList [e].MessageText)) { messager = eachMessage.Value.Message.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); txtMessage.SetHeight (nolines); txtMessage.SetTextColor (Android.Graphics.Color.Black); txtMessage.Text = messager; txtMessage.ContentDescription = eachMessage.Key; txtMessage.Click += ConversationItem_Clicked; layout2.AddView (txtMessage); } } else { if (text > 1) { using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icotext); layout3.AddView (random); } } } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icoanimation); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icocomicons); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icocomix); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icoemoticons); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icopolls); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icosoundfx); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icovideo); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { using (randomParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { randomParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (5f, context), 0); random.LayoutParameters = randomParams; } random.ContentDescription = eachMessage.Key; random.Click += ConversationPicItem_Clicked; random.SetBackgroundResource (Resource.Drawable.icovoice); layout3.AddView (random); } break; } } using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.ContentDescription = eachMessage.Value.Message.MessageGuid; random.Click += PlayButton_Clicked; layout3.AddView (random); } layout2.AddView (layout3); } LinearLayout layout4 = new LinearLayout (context); layout4.Orientation = Orientation.Vertical; layout4.SetGravity (GravityFlags.Right); using (TextView noMessages = new TextView (context)) { noMessages.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (240f, context), (int)ImageHelper.convertDpToPixel (20f, context)); noMessages.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); noMessages.SetTextColor (Color.White); noMessages.TextSize = 12f; noMessages.Text = unreadMessageCounts [eachMessage.Key] + " messages unread"; noMessages.Gravity = GravityFlags.Right; layout4.AddView (noMessages); } layout2.AddView (layout4); layout.AddView (layout2); listWrapper.AddView (layout); m++; } } } }); if (getGuid.Count > 0) { cpUI = 0; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken)); } }
private void createUser(object s, EventArgs e) { if (ValidateEntries(firstName.Text, lastName.Text, email.Text, password.Text) != false) { RunOnUiThread(delegate { progress = ProgressDialog.Show(context, Application.Context.Resources.GetString(Resource.String.loginRegistrationLOL), Application.Context.Resources.GetString(Resource.String.loginRegistrationMessage)); }); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.AuthenticationTokenGetCompleted += Service_AuthenticationTokenGetCompleted; service.AuthenticationTokenGetAsync(AndroidData.NewDeviceID); } else { EnableAll(); } }
private void cont_Click() { if (selectedContacts.Count > 0) { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContactsSearchListCompleted += Service_ContactsSearchListCompleted; List<LOLConnectSearchCriteria> searchCriteria = new List<LOLConnectSearchCriteria>(); this.selectedContacts.ForEach(sc => { Contact.ContactOAuth scAuth = default(Contact.ContactOAuth); for (int i = 0; i < sc.ContactOAuths.Count; i++) { if (sc.ContactOAuths [i].OAuthType == this.networkType) { scAuth = sc.ContactOAuths [i]; break; }//end if }//end for searchCriteria.Add(new LOLConnectSearchCriteria() { FirstName = sc.ContactUser.FirstName ?? string.Empty, LastName = sc.ContactUser.LastName ?? string.Empty, EmailAddress = sc.ContactUser.EmailAddress ?? string.Empty, OAuthID = scAuth.OAuthID, OAuthType = scAuth.OAuthType }); }); service.ContactsSearchListAsync(searchCriteria, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } else { RunOnUiThread(delegate { GeneralUtils.Alert(context, Application.Context.GetString(Resource.String.commonError), Application.Context.GetString(Resource.String.contactsNoneSelected)); }); } }
private void SendInvites(List<Contact> toContactsList) { int count = 0; RunOnUiThread(delegate { dialog = new ProgressDialog(context); dialog.SetMessage(Application.Context.GetString(Resource.String.invitePBMessage)); dialog.SetTitle(Application.Context.GetString(Resource.String.invitePBTitle)); dialog.SetProgressStyle(ProgressDialogStyle.Horizontal); dialog.Max = toContactsList.Count; dialog.Progress = 0; dialog.Show(); }); switch (this.networkType) { case AccountOAuth.OAuthTypes.FaceBook: foreach (Contact eachContact in toContactsList) { try { string oauthID = string.Empty; for (int i = 0; i < eachContact.ContactOAuths.Count; i++) { if (eachContact.ContactOAuths [i].OAuthType == AccountOAuth.OAuthTypes.FaceBook) { oauthID = eachContact.ContactOAuths [i].OAuthID; break; } } #if(DEBUG) this.Provider.PostToFeed("Testing, nevermind. http://www.example.com", oauthID); #else this.Provider.PostToFeed (string.Format ( Application.Context.GetString (Resource.String.inviteFacebookPostMessageFormat), LOLConstants.LinkLOLAppWebsiteUrl), oauthID); #endif RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); } catch (Exception ex) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception inviting user: {0} {1}\n{2}--{3}", eachContact.ContactUser.FirstName, eachContact.ContactUser.LastName, ex.Message, ex.StackTrace); #endif } } break; case AccountOAuth.OAuthTypes.Google: case AccountOAuth.OAuthTypes.YouTube: if (toContactsList.Count > 0) { List<LOLConnectInviteEmail> emailInvites = new List<LOLConnectInviteEmail>(); emailInvites = toContactsList .Select(s => { return new LOLConnectInviteEmail() { ContactName = string.Format("{0} {1}", s.ContactUser.FirstName, s.ContactUser.LastName), EmailAddress = s.ContactUser.EmailAddress, OAuthType = this.networkType }; }) .ToList(); //RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); RunOnUiThread(() => Toast.MakeText(context, Application.Context.GetString(Resource.String.commonSendInvite), ToastLength.Short).Show()); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContactsSendInviteEmailCompleted += Service_ContactsSendInviteEmailCompleted; service.ContactsSendInviteEmailAsync(emailInvites); }//end if break; case AccountOAuth.OAuthTypes.LinkedIn: if (toContactsList.Count > 0) { try { LLinkedInManager lMan = (LLinkedInManager)this.Provider; lMan.PostToFeed( StringUtils.CreateLinkedInXMLMessage(Application.Context.GetString(Resource.String.inviteLinkedInPostMessage), LOLConstants.LinkLOLAppWebsiteUrl, AndroidData.CurrentUser, lMan.GetUserProfileUrl()), string.Empty); RunOnUiThread(delegate { dialog.Progress = (int)(++count / toContactsList.Count); }); } catch (Exception ex) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception creating LinkedIn activity: {0}--{1}", ex.Message, ex.StackTrace); #endif } } break; } RunOnUiThread(delegate { if (dialog != null) dialog.Dismiss(); }); }
private void LogoutWithClear(bool withClear) { wowZapp.LaffOutOut.Singleton.DisableMessageTimer(); if (scroller != null) { scroller.Stop(); } wowZapp.LaffOutOut.Singleton.ReceivedMessages -= AppDelegate_ReceivedMessages; LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserLogOutCompleted += Service_UserLogOutCompleted; service.UserLogOutAsync(AndroidData.NewDeviceID, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), withClear); }
private void AddNewUsers(List<User> users) { User user = new User(); user = users [counter]; #if DEBUG System.Diagnostics.Debug.WriteLine("Users to add : {0}", user.FirstName + " " + user.LastName); #endif RunOnUiThread(delegate { ModalNewContact = new Dialog(this, Resource.Style.lightbox_dialog); ModalNewContact.SetContentView(Resource.Layout.ModalNewContacts); ((Button)ModalNewContact.FindViewById(Resource.Id.btnAccept)).Click += delegate { if (user.Picture.Length > 0) { Contacts.ContactsUtil.contactFilenames.Add(user.AccountID.ToString()); System.IO.File.WriteAllBytes(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, user.AccountID.ToString()), user.Picture); } DismissModalDialog(); counter++; ContactDB contact = new ContactDB(); contact.Blocked = false; contact.ContactAccountID = user.AccountID; contact.OwnerAccountID = AndroidData.CurrentUser.AccountID; contact.ContactUser = user; contacts.Add(contact); if (counter < users.Count) AddNewUsers(users); else { DismissModalDialog(); returnToSender(); } }; ((Button)ModalNewContact.FindViewById(Resource.Id.btnDecline)).Click += delegate { DismissModalDialog(); counter++; if (counter < users.Count) AddNewUsers(users); else { DismissModalDialog(); returnToSender(); } }; ((TextView)ModalNewContact.FindViewById(Resource.Id.txtContactName)).Text = user.FirstName + " " + user.LastName; modalImage = ((ImageView)ModalNewContact.FindViewById(Resource.Id.imgContact)); if (Contacts.ContactsUtil.contactFilenames.Contains(user.AccountID.ToString())) { Bitmap bm = BitmapFactory.DecodeFile(System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, user.AccountID.ToString())); System.IO.MemoryStream ms = new System.IO.MemoryStream(); bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] img = ms.ToArray(); displayImage(img, modalImage); } else { if (user.Picture.Length == 0) RunOnUiThread(() => modalImage.SetBackgroundResource(Resource.Drawable.defaultuserimage)); else { if (user.Picture.Length == 0) { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, user.AccountID, new Guid(AndroidData.ServiceAuthToken)); } else { Bitmap bm = BitmapFactory.DecodeResource(this.Resources, Resource.Drawable.defaultuserimage); System.IO.MemoryStream ms = new System.IO.MemoryStream(); bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] img = ms.ToArray(); displayImage(img, modalImage); } } } ModalNewContact.Show(); }); }
private void getContentPackItems() { RunOnUiThread(() => ShowLightboxDialog(Application.Resources.GetString(Resource.String.contentGrabbingYourPack))); LOLConnectClient connect = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); contentPackItems = GetAllLocalContentPackItems(true).ToDictionary(s => Convert.ToString(s.ContentPackItemID), s => ContentPackItemDB.ConvertFromContentPackItemDB(s)); if (contentPackItems.Count != 0) DisplayContentPacks(contentPackItems); List<int> excludeContentPackItemsIDs = new List<int>(); excludeContentPackItemsIDs = contentPackItems.Values.Select(s => s.ContentPackItemID).ToList(); connect.ContentPackGetPackItemsLightCompleted += new EventHandler<ContentPackGetPackItemsLightCompletedEventArgs>(connect_ContentPackGetPackItemsLightCompleted); connect.ContentPackGetPackItemsLightAsync(contentPackID, ContentPackItem.ItemSize.Tiny, excludeContentPackItemsIDs, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); }
private void LoadContactsFromDB() { if (contactsDB != null) contactsDB.Clear(); if (listWrapper != null) RunOnUiThread(() => listWrapper.RemoveAllViews()); RunOnUiThread(() => ShowLightboxDialog(Application.Resources.GetString(Resource.String.manageContactsRetrievingContacts))); contactsDB = db.GetAllContactsForOwner(AndroidData.CurrentUser.AccountID.ToString()); if (contactsDB.Count > 0) sortContacts(); int m = 0; //RunOnUiThread (delegate { foreach (ContactDB eachContact in contactsDB) { eachContact.LastMessageSent = db.GetLastMessageDateTimeForUser(eachContact.ContactAccountGuid, true); LinearLayout layout = new LinearLayout(context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity(GravityFlags.Center); layout.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), (int)ImageHelper.convertDpToPixel(10f, context)); ImageView profilepic = new ImageView(context); profilepic.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(imageSize [0], context), (int)ImageHelper.convertDpToPixel(imageSize [1], context)); profilepic.Tag = new Java.Lang.String("profilepic_" + eachContact.ContactAccountID.ToString()); if (ContactsUtil.contactFilenames.Contains(eachContact.ContactAccountID.ToString())) { string file = System.IO.Path.Combine(wowZapp.LaffOutOut.Singleton.ImageDirectory, eachContact.ContactAccountID.ToString()); FileInfo f = new FileInfo(file); long s1 = f.Length; if (s1 > 0 && s1 != 2) { using (Bitmap bm = BitmapFactory.DecodeFile (file)) { using (MemoryStream ms = new MemoryStream ()) { bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] image = ms.ToArray(); displayImage(image, profilepic); } } } } else { if (eachContact.ContactUser.Picture.Length == 0) { profilePicsToBeGrabbed.Add(eachContact.ContactAccountID); } else { if (eachContact.ContactUser.Picture.Length > 0 && eachContact.ContactUser.Picture.Length != 2) displayImage(eachContact.ContactUser.Picture, profilepic); else RunOnUiThread(() => profilepic.SetImageDrawable(Application.Context.Resources.GetDrawable(Resource.Drawable.defaultuserimage))); } } RunOnUiThread(() => layout.AddView(profilepic)); TextView text = new TextView(context); text.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(260f, context), (int)ImageHelper.convertDpToPixel(40f, context)); text.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0); text.Gravity = GravityFlags.CenterVertical; text.TextSize = 16f; text.SetTextColor(Android.Graphics.Color.White); if (eachContact.ContactUser.FirstName != "" || eachContact.ContactUser.LastName != "") { text.Text = eachContact.ContactUser.FirstName + " " + eachContact.ContactUser.LastName; } else { text.Text = eachContact.ContactUser.EmailAddress; } int contactId = new int(); contactId = m; layout.Clickable = true; layout.Click += delegate { handleContactClick(text, contactId); }; RunOnUiThread(delegate { layout.AddView(text); listWrapper.AddView(layout); }); m++; } RunOnUiThread(() => DismissLightboxDialog()); if (profilePicsToBeGrabbed.Count > 0) { profilePicsGrabIndex = 0; LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [0], new Guid(AndroidData.ServiceAuthToken)); } }
private void userlogin() { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserLoginCompleted += Service_UserLoginCompleted; service.UserLoginAsync(AndroidData.NewDeviceID, DeviceDeviceTypes.Android, LOLConstants.DefaultGuid, string.Empty, string.Empty, AccountOAuth.OAuthTypes.LOL, email.Text, password.Text, new Guid(AndroidData.ServiceAuthToken)); }
private void startLogin(object s, EventArgs e) { if (ValidateEmailField(email.Text)) { RunOnUiThread(() => Toast.MakeText(c, Resource.String.commonLoggingIn, ToastLength.Short).Show()); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.AuthenticationTokenGetCompleted += Service_AuthTokenCompleted; service.AuthenticationTokenGetAsync(AndroidData.NewDeviceID); } }
private void PlayMessage(MessageDB message) { voiceFiles.Clear (); contentPackItems.Clear (); pollSteps.Clear (); MessageInfo messageInfo = this.MessageItems [message.MessageID]; ContentState dlState = new ContentState (message); contentPackItems = getLocalContentPackItems (dlState.ContentPackIDQ.ToList ()) .ToDictionary (s => s.ContentPackItemID, s => ContentPackItemDB.ConvertFromContentPackItemDB (s)); if (messageInfo.HasContentInfo) { RunOnUiThread (delegate { if (progress != null) progress.Dismiss (); this.PlayUnsentMessage (messageInfo.ContentInfo); }); } else { Dictionary<Guid, Dictionary<int, string>> localVoiceFiles = getLocalVoiceFiles (new List<Pair<Guid, List<int>>> () { new Pair<Guid, List<int>>(dlState.Message.MessageID, dlState.VoiceIDQ.ToList()) }); if (!localVoiceFiles.TryGetValue (dlState.Message.MessageID, out voiceFiles)) voiceFiles = new Dictionary<int, string> (); pollSteps = getLocalPollingStepsForMessage (dlState.Message.MessageGuid) .ToDictionary (s => s.StepNumber, s => PollingStepDB.ConvertFromPollingStepDB (s)); dlState.RemoveExistingItems (contentPackItems.Keys.ToList (), voiceFiles.Keys.ToList (), pollSteps.Keys.ToList ()); if (dlState.HasContentForDownload) { #if DEBUG System.Diagnostics.Debug.WriteLine ("dlState has content for download"); #endif if (dlState.HasContentPackItems) { #if DEBUG System.Diagnostics.Debug.WriteLine ("dlState has contentpackitems for download"); #endif LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContentPackGetItemCompleted += Service_ContentPackGetItemCompleted; service.ContentPackGetItemAsync (dlState.ContentPackIDQ.Peek (), ContentPackItem.ItemSize.Small, AndroidData.CurrentUser.AccountID, new Guid (AndroidData.ServiceAuthToken), dlState); } else if (dlState.HasVoiceRecordings) { #if DEBUG System.Diagnostics.Debug.WriteLine ("dlState has voicerecordings for download"); #endif LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.MessageGetStepDataCompleted += Service_MessageGetStepData; service.MessageGetStepDataAsync (dlState.Message.MessageID, dlState.VoiceIDQ.Peek (), new Guid (AndroidData.ServiceAuthToken), dlState); } else if (dlState.HasPollingSteps) { RunOnUiThread (delegate { #if DEBUG System.Diagnostics.Debug.WriteLine ("dlState has pollingsteps for download"); #endif LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.PollingStepGetCompleted += Service_PollingStepGetCompleted; service.PollingStepGetAsync (dlState.Message.MessageID, dlState.PollingIDQ.Peek (), AndroidData.CurrentUser.AccountID, new Guid (AndroidData.ServiceAuthToken), dlState); }); } } else RunOnUiThread (delegate { StartPlayMessage (message); }); } }
private void createNewUsers() { newUsersToAdd = UnknownUser.unknownUsers.Count; if (newUsersToAdd == 0) end(); counter = 0; LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetSpecificCompleted += Service_UserGetSpecificDone; service.UserGetSpecificAsync(AndroidData.CurrentUser.AccountID, UnknownUser.unknownUsers [counter], new Guid(AndroidData.ServiceAuthToken)); }
private void blockcontact_Click(object sender, EventArgs e) { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); RunOnUiThread(() => Toast.MakeText(context, (EditContactUtil.UserContact.Blocked ? Resource.String.editContactBlocking : Resource.String.editContactUnblocking), ToastLength.Short).Show()); service.ContactsSaveCompleted += Service_ContactsSaveCompleted; service.ContactsSaveAsync(ContactDB.ConvertFromContactDB(EditContactUtil.UserContact), new Guid(AndroidData.ServiceAuthToken)); }
private void returnToSender() { counter = 0; Contact contact = new Contact(); contact = ContactDB.ConvertFromContactDB(contacts [counter]); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContactsSaveCompleted += Service_ContactsSaveCompleted; service.ContactsSaveAsync(contact, new Guid(AndroidData.ServiceAuthToken)); }
private void deletecontact_Click(object sender, EventArgs e) { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); RunOnUiThread(delegate { Toast.MakeText(context, Resource.String.editContactDeleting, ToastLength.Short).Show(); }); Contact toDelete = ContactDB.ConvertFromContactDB(EditContactUtil.UserContact); service.ContactsDeleteCompleted += Service_ContactsDeleteCompleted; service.ContactsDeleteAsync(toDelete.ContactID, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); }
private void validateReset(object sender, EventArgs e, string code) { if (ValidateField (code)) { RunOnUiThread (() => Toast.MakeText (c, Resource.String.verificationCodeSendingVerificationCode, ToastLength.Short).Show ()); this.verifyCode = code; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserValidateResetTokenCompleted += Service_UserValidateResetTokenCompleted; service.UserValidateResetTokenAsync (this.email, this.verifyCode, new Guid (AndroidData.ServiceAuthToken)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.EditContact); TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewloginHeader); RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, header.Context); context = header.Context; Header.headertext = Application.Context.Resources.GetString(Resource.String.editContactTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; TextView name = FindViewById<TextView>(Resource.Id.txtContactName); name.Text = EditContactUtil.UserContact.ContactUser.FirstName + " " + EditContactUtil.UserContact.ContactUser.LastName; contactpic = FindViewById<ImageView>(Resource.Id.imgContactPic); contactpic.Tag = new Java.Lang.String("profilepic_1"); dbm = wowZapp.LaffOutOut.Singleton.dbm; blockcontact = FindViewById<Button>(Resource.Id.btnBlockUser); Button deletecontact = FindViewById<Button>(Resource.Id.btnDeleteUser); ImageButton uniback = FindViewById<ImageButton>(Resource.Id.btnUniBack); LinearLayout bottom = FindViewById<LinearLayout>(Resource.Id.bottomHolder); uniback.Click += delegate { Finish(); }; blockcontact.Text = Application.Context.Resources.GetString(EditContactUtil.UserContact.Blocked ? Resource.String.editContactUnblock : Resource.String.editContactBlock); blockcontact.Click += new EventHandler(blockcontact_Click); deletecontact.Click += new EventHandler(deletecontact_Click); float size = 100f; if (wowZapp.LaffOutOut.Singleton.resizeFonts) size *= wowZapp.LaffOutOut.Singleton.bigger; xSize = (int)ImageHelper.convertDpToPixel(size, context); ySize = xSize; if (ContactsUtil.contactFilenames.Contains(EditContactUtil.UserContact.ContactAccountGuid)) { #if DEBUG System.Diagnostics.Debug.WriteLine("using cache"); #endif using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, EditContactUtil.UserContact.ContactAccountGuid))) { using (MemoryStream ms = new MemoryStream ()) { bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] image = ms.ToArray(); displayImage(image, contactpic); } } } else { if (EditContactUtil.UserContact.ContactUser.Picture.Length > 0) { #if DEBUG System.Diagnostics.Debug.WriteLine("grabbing"); #endif LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync(AndroidData.CurrentUser.AccountID, EditContactUtil.UserContact.ContactAccountID, new Guid(AndroidData.ServiceAuthToken)); } else { System.Diagnostics.Debug.WriteLine("no pic"); using (Bitmap bm = BitmapFactory.DecodeResource (this.Resources, Resource.Drawable.defaultuserimage)) { using (MemoryStream ms = new MemoryStream ()) { bm.Compress(Bitmap.CompressFormat.Jpeg, 80, ms); byte[] image = ms.ToArray(); displayImage(image, contactpic); } } } } }
private void SaveFoundContacts() { RunOnUiThread(() => { Toast.MakeText(context, Resource.String.chooseFriendsAddingSelectedContacts, ToastLength.Short); }); AccountOAuth accountOAuth = new AccountOAuth(); try { this.Provider.GetUserInfoObject(accountOAuth); } catch (Exception ex) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Error retrieving user info object."); #endif string m = string.Format("{0} {1}", Application.Context.GetString(Resource.String.errorSavingContacts), ex.Message); RunOnUiThread(() => GeneralUtils.Alert(context, Application.Context.GetString(Resource.String.commonError), m)); return; } LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.AccountOAuthCreateCompleted += this.Service_AccountOAuthCreateCompleted; service.AccountOAuthCreateAsync(AndroidData.CurrentUser.AccountID, accountOAuth.OAuthType, accountOAuth.OAuthID, accountOAuth.OAuthToken, new Guid(AndroidData.ServiceAuthToken)); }
private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false) { message.Reverse (); contact.Reverse (); int m = 0; string messager = ""; bool dd = false; if (message != null && contact != null) { if (clear == false) RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ()); string othername = string.Empty; for (int i = 0; i < contact.Count; ++i) { if (string.IsNullOrEmpty (nameTitle)) othername = contact [i].FirstName + " " + contact [i].LastName; else othername = nameTitle; if (isMe != othername) { RunOnUiThread (delegate { Header.headertext = othername; Header.fontsize = 36f; ImageHelper.fontSizeInfo (header.Context); header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; }); break; } } if (contact.Count > 1) { string toReturn = ""; List<UserDB> sortedList = new List<UserDB> (); sortedList = contact.OrderBy (s => s.LastName).OrderBy (s => s.FirstName).ToList (); foreach (UserDB eachItem in sortedList) toReturn += string.Format ("{0} {1}, ", eachItem.FirstName, eachItem.LastName); int last = toReturn.LastIndexOf (", "); toReturn = toReturn.Remove (last); RunOnUiThread (delegate { using (LinearLayout btnlayout = new LinearLayout (context)) { btnlayout.Orientation = Android.Widget.Orientation.Vertical; btnlayout.SetGravity (GravityFlags.Center); btnlayout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); btnlayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context)); using (TextView name = new TextView(context)) { name.Text = toReturn; name.SetTextSize (Android.Util.ComplexUnitType.Dip, 18f); name.SetTextColor (Color.Black); btnlayout.AddView (name); } using (Button showAll = new Button (context)) { showAll.Gravity = GravityFlags.CenterVertical; showAll.Text = Application.Context.Resources.GetString (Resource.String.messageShowAllInConversation); showAll.Click += (object sender, EventArgs e) => { showParticipants (sender, e, contact); }; showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context)); showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context)); showAll.SetBackgroundResource (Resource.Drawable.button); btnlayout.AddView (showAll); } listWrapper.AddView (btnlayout); } }); } if (getGuid != null) getGuid.Clear (); RunOnUiThread (delegate { foreach (MessageDB messages in message) { string name = contact [m].FirstName + " " + contact [m].LastName; ImageView random = null; LinearLayout layout = new LinearLayout (context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.SetGravity (GravityFlags.CenterVertical); layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context)); LinearLayout layout2 = new LinearLayout (context); layout2.Orientation = Orientation.Vertical; layout2.SetGravity (GravityFlags.Center); if (name == isMe) layout.AddView (contactUserInterface (messages, contact [m], true)); else layout.AddView (contactUserInterface (messages, contact [m], false)); /*ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context)); if (contact == null) profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); else { profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID); profilepic.SetImageResource (Resource.Drawable.defaultuserimage); layout.AddView (profilepic); if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage) getGuid.Add (contact [m].AccountID); else { if (contact [m].Picture.Length > 0) LoadUserImage (contact [m], profilepic); else profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); } TextView name = new TextView (context); name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (230f, context), (int)ImageHelper.convertDpToPixel (40f, context)); name.Gravity = GravityFlags.Center; name.SetTextColor (Color.White); name.TextSize = 16f; layout2.AddView (name); if (messages.MessageStepDBList.Count == 1 && messages.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) { TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; if (name == isMe) text.SetBackgroundResource (Resource.Drawable.bubblesolidright); else text.SetBackgroundResource (Resource.Drawable.bubblesolidleft); text.TextSize = 16f; for (int e = 0; e < messages.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) { messager = messages.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); text.SetHeight (nolines); text.SetTextColor (Android.Graphics.Color.Black); text.Text = messager; layout2.Clickable = true; layout2.AddView (text); } else {*/ LinearLayout layout3 = new LinearLayout (context); layout3.Orientation = Orientation.Horizontal; if (name == isMe) layout3.SetGravity (GravityFlags.Right); else layout3.SetGravity (GravityFlags.Left); layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr); layout3.SetVerticalGravity (GravityFlags.CenterVertical); layout3.SetMinimumHeight (30); layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); if (name != isMe) { using (random = new ImageView (context)) { random.Tag = m; random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.ContentDescription = messages.MessageGuid; random.Click += PlayButton_Clicked; layout3.AddView (random); } } int textt = 0; for (int tt = 0; tt < messages.MessageStepDBList.Count; ++tt) { if (messages.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text) textt++; } for (int i = 0; i < messages.MessageStepDBList.Count; ++i) { switch (messages.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: if (textt == 1) { TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; if (name == isMe) text.SetBackgroundResource (Resource.Drawable.bubblesolidright); else text.SetBackgroundResource (Resource.Drawable.bubblesolidleft); text.TextSize = 16f; for (int e = 0; e < messages.MessageStepDBList.Count; ++e) { if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) { messager = messages.MessageStepDBList [e].MessageText; break; } } if (string.IsNullOrEmpty (messager)) messager = "No text message found"; int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context)); text.SetHeight (nolines); text.SetTextColor (Android.Graphics.Color.Black); text.Text = messager; layout2.Clickable = true; layout2.AddView (text); } else { if (textt > 1) { using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.textmsg); layout3.AddView (random); } } } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.drawicon); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicon); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.comicmsgs); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.emoticonmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.pollmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.soundfxmsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.videomsg); layout3.AddView (random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.voicemsg); layout3.AddView (random); } break; } } if (name == isMe) { using (random = new ImageView (context)) { random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context)); random.SetBackgroundResource (Resource.Drawable.playblack); random.Click += (object ss, EventArgs ee) => { random_Click (ss, ee, message); }; layout3.AddView (random); } } layout2.AddView (layout3); layout.AddView (layout2); listWrapper.AddView (layout); if (m + 1 < contact.Count) m++; } //} }); if (getGuid.Count > 0) { cpUI = 0; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken)); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.AboutMe); string currentUserName = AndroidData.CurrentUser.FirstName + " " + AndroidData.CurrentUser.LastName; genders = new string[] { "Unknown", "Male", "Female", "Alien", "Monster" }; int d = 1, m = 1, yr = 1901; currentGender = AndroidData.CurrentUser.UserGender; ImageView btns = FindViewById<ImageView>(Resource.Id.imgNewLoginHeader); TextView header = FindViewById<TextView>(Resource.Id.txtFirstScreenHeader); context = header.Context; RelativeLayout relLayout = FindViewById<RelativeLayout>(Resource.Id.relativeLayout1); ImageHelper.setupTopPanel(btns, header, relLayout, context); Header.headertext = Application.Context.Resources.GetString(Resource.String.mainTitle); Header.fontsize = 36f; ImageHelper.fontSizeInfo(header.Context); header.SetTextSize(Android.Util.ComplexUnitType.Dip, Header.fontsize); header.Text = Header.headertext; ImageView myPic = FindViewById<ImageView>(Resource.Id.imgMe); if (AndroidData.CurrentUser.Picture.Length == 0) myPic.SetBackgroundResource(Resource.Drawable.defaultuserimage); else MD5Check = generateMD5(); fullName = FindViewById<TextView>(Resource.Id.txtFullName); fullName.Text = currentUserName; screenName = FindViewById<TextView>(Resource.Id.txtScreenName); screenName.Text = AndroidData.CurrentUser.UserName; emailAddress = FindViewById<TextView>(Resource.Id.txtEmail); emailAddress.Text = AndroidData.CurrentUser.EmailAddress; gender = FindViewById<TextView>(Resource.Id.txtGender); switch (currentGender) { case User.Gender.Alien: gender.Text = genders [3]; break; case User.Gender.Female: gender.Text = genders [2]; break; case User.Gender.Male: gender.Text = genders [1]; break; case User.Gender.Monster: gender.Text = genders [4]; break; case User.Gender.Unknown: gender.Text = genders [0]; break; } password = FindViewById<TextView>(Resource.Id.txtPassword); string pw = ""; for (int n = 0; n < AndroidData.CurrentUser.Password.Length; ++n) pw += "*"; password.Text = pw; birthday = FindViewById<TextView>(Resource.Id.txtDOB); birthday.Text = AndroidData.CurrentUser.DateOfBirth.ToShortDateString(); profDesc = FindViewById<TextView>(Resource.Id.txtProfile); profDesc.Text = AndroidData.CurrentUser.Description; CheckBox quest1 = FindViewById<CheckBox>(Resource.Id.checkedProQ1); quest1.Checked = AndroidData.CurrentUser.AllowLocationSearch; CheckBox quest2 = FindViewById<CheckBox>(Resource.Id.checkedProQ2); quest2.Checked = AndroidData.CurrentUser.ShowLocation; CheckBox quest3 = FindViewById<CheckBox>(Resource.Id.checkedProQ3); quest3.Checked = AndroidData.CurrentUser.AllowSearch; Button btnPicChange = FindViewById<Button>(Resource.Id.btnPicChange); Button btnChangeName = FindViewById<Button>(Resource.Id.btnChangeName); Button btnScreenName = FindViewById<Button>(Resource.Id.btnScreenName); Button btnEmail = FindViewById<Button>(Resource.Id.btnEmail); Button btnGender = FindViewById<Button>(Resource.Id.btnGender); Button btnPassword = FindViewById<Button>(Resource.Id.btnPassword); Button btnDOB = FindViewById<Button>(Resource.Id.btnDOB); Button btnProfDesc = FindViewById<Button>(Resource.Id.btnProfDesc); Button btnCancel = FindViewById<Button>(Resource.Id.btnCancel); Button btnOK = FindViewById<Button>(Resource.Id.btnAccept); ImageButton btnBack = FindViewById<ImageButton>(Resource.Id.btnBack); btnPicChange.Click += delegate { generateModal(0); }; btnChangeName.Click += delegate { generateModal(1); }; btnScreenName.Click += delegate { generateModal(2); }; btnEmail.Click += delegate { generateModal(3); }; btnGender.Click += delegate { generateModal(4); }; btnPassword.Click += delegate { generateModal(5); }; btnDOB.Click += delegate { generateModal(6); }; btnProfDesc.Click += delegate { generateModal(7); }; btnCancel.Click += delegate { Finish(); }; btnBack.Click += delegate { Intent i = new Intent(this, typeof(Main.HomeActivity)); i.AddFlags(ActivityFlags.ClearTop); StartActivity(i); }; btnOK.Click += delegate { if (checkText(fullName.Text, screenName.Text, emailAddress.Text, password.Text, profDesc.Text)) { string[] nameSplit = new string[2]; if (fullName.Text != currentUserName) { nameSplit = fullName.Text.Split(' '); AndroidData.CurrentUser.FirstName = nameSplit [0]; AndroidData.CurrentUser.LastName = nameSplit [1]; essentialHasAltered = true; } if (screenName.Text != AndroidData.CurrentUser.UserName) { AndroidData.CurrentUser.UserName = screenName.Text; nonessesentialHasAltered = true; } if (emailAddress.Text != AndroidData.CurrentUser.EmailAddress) { AndroidData.CurrentUser.EmailAddress = emailAddress.Text; essentialHasAltered = true; } if (password.Text != AndroidData.CurrentUser.Password) { AndroidData.CurrentUser.Password = password.Text; essentialHasAltered = true; } if (profDesc.Text != AndroidData.CurrentUser.Description) { AndroidData.CurrentUser.Description = profDesc.Text; nonessesentialHasAltered = true; } if (birthday.Text != AndroidData.CurrentUser.DateOfBirth.ToString()) { string[] splitter = new string[3]; splitter = birthday.Text.Split('/'); d = Convert.ToInt32(splitter [0]); m = Convert.ToInt32(splitter [1]); yr = Convert.ToInt32(splitter [2]); nonessesentialHasAltered = true; } if (quest1.Checked != AndroidData.CurrentUser.ShowLocation) { AndroidData.CurrentUser.ShowLocation = quest1.Checked; nonessesentialHasAltered = true; } if (quest2.Checked != AndroidData.CurrentUser.AllowLocationSearch) { AndroidData.CurrentUser.AllowLocationSearch = quest2.Checked; nonessesentialHasAltered = true; } if (quest3.Checked != AndroidData.CurrentUser.AllowSearch) { AndroidData.CurrentUser.AllowSearch = quest3.Checked; nonessesentialHasAltered = true; } if (quest1.Checked && quest2.Checked) AndroidData.GeoLocationEnabled = true; else AndroidData.GeoLocationEnabled = false; if (imageChanged) { imageHasAltered = true; } switch (gender.Text) { case "Unknown": AndroidData.CurrentUser.UserGender = User.Gender.Unknown; break; case "Male": AndroidData.CurrentUser.UserGender = User.Gender.Male; break; case "Female": AndroidData.CurrentUser.UserGender = User.Gender.Female; break; case "Alien": AndroidData.CurrentUser.UserGender = User.Gender.Alien; break; case "Monster": AndroidData.CurrentUser.UserGender = User.Gender.Monster; break; } if (essentialHasAltered || imageHasAltered || nonessesentialHasAltered) { LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); if (essentialHasAltered) { service.UserUpdateCompulsoryDetailsCompleted += Service_UpdateCompulsoryCompleted; service.UserUpdateCompulsoryDetailsAsync(AndroidData.CurrentUser.AccountID, AndroidData.CurrentUser.FirstName, AndroidData.CurrentUser.LastName, AndroidData.CurrentUser.EmailAddress, password.Text, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } if (imageHasAltered) { byte[] myNewPic = File.ReadAllBytes(AndroidData.imageFileName); service.UserUpdateImageCompleted += Service_UpdateImageCompleted; service.UserUpdateImageAsync(AndroidData.CurrentUser.AccountID, myNewPic, new Guid(AndroidData.ServiceAuthToken)); } if (nonessesentialHasAltered) { DateTime t = new DateTime(yr, m, d); service.UserUpdateRestDetailsCompleted += Service_UpdateRestCompleted; service.UserUpdateRestDetailsAsync(AndroidData.CurrentUser.AccountID, t, screenName.Text, profDesc.Text, AndroidData.CurrentUser.ShowLocation, AndroidData.CurrentUser.AllowLocationSearch, AndroidData.CurrentUser.AllowSearch, AndroidData.CurrentUser.UserGender, new Guid(AndroidData.ServiceAuthToken) ); } } } }; }
public void Service_MessageGetNewCompleted(object sender, MessageGetNewCompletedEventArgs e) { LOLMessageClient service = (LOLMessageClient)sender; service.MessageGetNewCompleted -= Service_MessageGetNewCompleted; if (null == e.Error) { Message[] result = e.Result.ToArray(); #if(DEBUG) System.Diagnostics.Debug.WriteLine("Received {0} new messages!", result.Length); #endif List<Message> msgList = new List<Message>(); Queue<Guid> userQ = new Queue<Guid>(); foreach (Message eachMessage in result) { if (eachMessage.Errors.Count > 0) { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Error retrieving new messages: {0}", StringUtils.CreateErrorMessageFromMessageGeneralErrors(eachMessage.Errors)); #endif } else { msgList.Add(eachMessage); if (!dbm.CheckUserExists(eachMessage.FromAccountID.ToString())) { userQ.Enqueue(eachMessage.FromAccountID); } } } // Insert the messages to the database List<MessageDB> msgListForDB = new List<MessageDB>(); msgList.ForEach(s => msgListForDB.Add(MessageDB.ConvertFromMessage(s))); dbm.InsertOrUpdateMessages(msgListForDB); // Trigger the event only if the app is active. #if DEBUG System.Diagnostics.Debug.WriteLine("IsAppActive = {0}, msgList.Count = {1}", AndroidData.IsAppActive, msgList.Count); #endif if (AndroidData.IsAppActive == true && msgList.Count > 0) { if (null != this.ReceivedMessages) { this.ReceivedMessages(this, new IncomingMessageEventArgs(msgList)); }//end if }//end if if (userQ.Count > 0) { LOLConnectClient clientService = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); clientService.UserGetSpecificCompleted += Service_UserGetSpecificCompleted; clientService.UserGetSpecificAsync(AndroidData.CurrentUser.AccountID, userQ.Peek(), new Guid(AndroidData.ServiceAuthToken), userQ); } else this.isMsgInProgress = false; } else { this.isMsgInProgress = false; #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception receiving message! {0}--{1}", e.Error.Message, e.Error.StackTrace); #endif }//end if else }
private void AddUserAsContact() { RunOnUiThread (delegate { Toast.MakeText (context, Resource.String.contactsAddingContact, ToastLength.Short).Show (); }); Contact contact = new Contact (); contact.Blocked = false; contact.ContactAccountID = UserFrom.AccountID; contact.OwnerAccountID = AndroidData.CurrentUser.AccountID; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContactsSaveCompleted += Service_ContactsSaveCompleted; service.ContactsSaveAsync (contact, new Guid (AndroidData.ServiceAuthToken)); }
private void ShowModalPreviewDialog(int itemId) { isPreview = true; ProgressBar pb = null; ImageButton ib = null; ModalPreviewDialog = new Dialog(this, Resource.Style.lightbox_dialog); if (packType == LOLCodeLibrary.GenericEnumsContentPackType.Emoticon) { ModalPreviewDialog.SetContentView(Resource.Layout.ModalPreviewGIFDialog); if (wowZapp.LaffOutOut.Singleton.resizeFonts) { layouts [0] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout1)); layouts [1] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout2)); layouts [3] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout3)); layouts [2] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout4)); previewWebImage = ((WebView)ModalPreviewDialog.FindViewById(Resource.Id.webPreview)); } ((WebView)ModalPreviewDialog.FindViewById(Resource.Id.webPreview)).VerticalScrollBarEnabled = false; ((WebView)ModalPreviewDialog.FindViewById(Resource.Id.webPreview)).HorizontalScrollBarEnabled = false; ((WebView)ModalPreviewDialog.FindViewById(Resource.Id.webPreview)).LoadDataWithBaseURL(null, "<body style=\"margin:0;padding:0;background:#8e8f8f;\"><div style=\"margin:10px;\">Loading...</div></body>", "text/html", "UTF-8", null); LOLConnectClient connect = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); connect.ContentPackItemGetDataCompleted += new EventHandler<ContentPackItemGetDataCompletedEventArgs>(connect_ContentPackItemGetDataCompleted); connect.ContentPackItemGetDataAsync(result [itemId].ContentPackItemID, ContentPackItem.ItemSize.Small, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } else { ModalPreviewDialog.SetContentView(Resource.Layout.ModalPreviewDialog); pb = ((ProgressBar)ModalPreviewDialog.FindViewById(Resource.Id.timerBar)); ib = ((ImageButton)ModalPreviewDialog.FindViewById(Resource.Id.playButton)); if (packType != LOLCodeLibrary.GenericEnumsContentPackType.Comicon && packType != LOLCodeLibrary.GenericEnumsContentPackType.SoundFX) pb.Visibility = ib.Visibility = ViewStates.Invisible; else ib.Click += delegate { playAudio(pb, packType); }; if (wowZapp.LaffOutOut.Singleton.resizeFonts) { layouts [0] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout1)); layouts [1] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout2)); layouts [3] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout3)); layouts [2] = ((LinearLayout)ModalPreviewDialog.FindViewById(Resource.Id.linearLayout4)); previewImage = ((ImageView)ModalPreviewDialog.FindViewById(Resource.Id.imgItemPic)); } using (MemoryStream stream = new MemoryStream (result [itemId].ContentPackItemIcon)) { using (Android.Graphics.Drawables.Drawable draw = Android.Graphics.Drawables.Drawable.CreateFromStream (stream, "Profile")) { ((ImageView)ModalPreviewDialog.FindViewById(Resource.Id.imgItemPic)).SetImageDrawable(draw); } } } ((TextView)ModalPreviewDialog.FindViewById(Resource.Id.txtItemTitle)).Text = result [itemId].ContentItemTitle; ((Button)ModalPreviewDialog.FindViewById(Resource.Id.btnAdd)).Click += delegate { if (!isAnimation) { MessageStep msgStep = new MessageStep(); switch (packType) { case LOLCodeLibrary.GenericEnumsContentPackType.Comicon: msgStep.StepType = MessageStep.StepTypes.Comicon; break; case LOLCodeLibrary.GenericEnumsContentPackType.Comix: msgStep.StepType = MessageStep.StepTypes.Comix; break; case LOLCodeLibrary.GenericEnumsContentPackType.Emoticon: msgStep.StepType = MessageStep.StepTypes.Emoticon; break; case LOLCodeLibrary.GenericEnumsContentPackType.SoundFX: msgStep.StepType = MessageStep.StepTypes.SoundFX; break; } ComposeMessageMainUtil.contentPackID [currentStep] = msgStep.ContentPackItemID = ContentPackItemsUtil.contentPackItemID = result [itemId].ContentPackItemID; if (currentStep > ComposeMessageMainUtil.msgSteps.Count) { msgStep.StepNumber = ComposeMessageMainUtil.msgSteps.Count + 1; ComposeMessageMainUtil.msgSteps.Add(msgStep); } else { msgStep.StepNumber = currentStep; ComposeMessageMainUtil.msgSteps [currentStep - 1] = msgStep; } ContentPackItemsUtil.content = result [itemId].ContentPackItemIcon; if (currentStep == 1) { DismissModalPreviewDialog(); isSet = true; sendBack(); } else { DismissModalPreviewDialog(); isSet = true; isPreview = false; sendBack(); } } else { DismissModalPreviewDialog(); isSet = true; sendBack(); } }; ((Button)ModalPreviewDialog.FindViewById(Resource.Id.btnCancel)).Click += delegate { DismissModalPreviewDialog(); }; ModalPreviewDialog.Show(); if (packType == LOLCodeLibrary.GenericEnumsContentPackType.Comicon || packType == LOLCodeLibrary.GenericEnumsContentPackType.SoundFX) { LOLConnectClient connect = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); connect.ContentPackItemGetDataCompleted += new EventHandler<ContentPackItemGetDataCompletedEventArgs>(connect_ContentPackItemGetDataCompleted); connect.ContentPackItemGetDataAsync(result [itemId].ContentPackItemID, ContentPackItem.ItemSize.Small, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } }
private void showParticipants(object s, EventArgs e, List<UserDB> contacts) { contactsDialog = new Dialog (this, Resource.Style.lightbox_dialog); contactsDialog.SetContentView (Resource.Layout.ModalContactsConversation); LinearLayout mainLayout = ((LinearLayout)contactsDialog.FindViewById (Resource.Id.contactMainLayout)); Context localContext = mainLayout.Context; List<Guid> profilePicsToBeGrabbed = new List<Guid> (); RunOnUiThread (delegate { for (int n = 0; n < contacts.Count; n++) { LinearLayout layout = new LinearLayout (context); layout.Orientation = Android.Widget.Orientation.Horizontal; layout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); layout.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (10f, context)); ImageView profilepic = new ImageView (context); profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (60f, context), (int)ImageHelper.convertDpToPixel (60f, context)); profilepic.Tag = new Java.Lang.String ("profilepic_" + contacts [n].AccountID); if (contacts [n].HasProfileImage == true && contacts [n].Picture.Length == 0) { profilePicsToBeGrabbed.Add (contacts [n].AccountID); } else { if (contacts [n].Picture.Length > 0) LoadUserImage (contacts [n], profilepic); else profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage)); } layout.AddView (profilepic); TextView text = new TextView (context); text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (235f, context), (int)ImageHelper.convertDpToPixel (40f, context)); text.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); text.Gravity = GravityFlags.CenterVertical; text.TextSize = 16f; text.SetTextColor (Android.Graphics.Color.White); if (contacts [n].FirstName != "" || contacts [n].LastName != "") { text.Text = contacts [n].FirstName + " " + contacts [n].LastName; } else { text.Text = contacts [n].EmailAddress; } layout.AddView (text); mainLayout.AddView (layout); } }); ((Button)contactsDialog.FindViewById (Resource.Id.btnCancel)).Click += delegate { DismissModalPreviewDialog (); }; if (profilePicsToBeGrabbed.Count > 0) { cpUI = 0; LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, profilePicsToBeGrabbed [0], new Guid (AndroidData.ServiceAuthToken)); } contactsDialog.Show (); }
public void locationUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (network.checkForNetwork) { Intent i = new Intent(context, typeof(geolocation)); context.StartActivity(i); LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); Task.Factory.StartNew(() => { Task<LOLAccountManagement.GeneralError> task = service.CallAsyncMethod<LOLAccountManagement.GeneralError, UserUpdateLocationCompletedEventArgs>((s, h, b) => { if (b) { s.UserUpdateLocationCompleted += h; } else { s.UserUpdateLocationCompleted -= h; }//end if else }, (s) => { s.UserUpdateLocationAsync(AndroidData.CurrentUser.AccountID, AndroidData.GeoLocation [0], AndroidData.GeoLocation [1], new Guid(AndroidData.ServiceAuthToken)); }); try { LOLAccountManagement.GeneralError result = task.Result; if (result.ErrorType != LOLCodeLibrary.ErrorsManagement.SystemTypesErrorMessage.NoErrorDetected) { #if DEBUG Console.WriteLine("Error updating user's location! {0}", result.ErrorType); #endif } } catch (Exception ex) { #if DEBUG Console.WriteLine("Exception updating user's location. {0}--{1}", ex.Message, ex.StackTrace); #endif } finally { service.Close(); } }); } }