void FBGraphRequeest(AccessToken token, string userId) { ShowLoadingView(Constants.STR_LOGIN_LOADING); var requestCallback = new FacebookRequestCallback <JSONObject> { HandleSuccess = requestResult => { var user = new User(); var email = requestResult.OptString("email"); user.Firstname = requestResult.OptString("first_name"); user.Lastname = requestResult.OptString("last_name"); user.Email = requestResult.OptString("email"); user.Password = requestResult.OptString("email"); user.Type = Constants.TAG_VISIBLE_SPECIFIC; ParseLogin(user); }, HandleCancel = () => { }, HandleError = loginError => { } }; Bundle requestParams = new Bundle(); requestParams.PutString("fields", "id,name,email,first_name,last_name,picture"); GraphRequest graphRequest = GraphRequest.NewMeRequest(token, requestCallback); graphRequest.Parameters = requestParams; graphRequest.ExecuteAsync(); }
public async Task <ProfileResponse> GetProfile() { taskCompletion = new TaskCompletionSource <GraphResponse>(); ProfileResponse profileResponse = null; GraphCallback graphCallback = new GraphCallback(); graphCallback.RequestCompleted += GraphCallback_RequestCompleted; var graphRequest = new GraphRequest( AccessToken.CurrentAccessToken, "me", null, HttpMethod.Get, graphCallback ); graphRequest.ExecuteAsync(); var graphResponse = await taskCompletion.Task; profileResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <ProfileResponse>(graphResponse.RawResponse); return(profileResponse); }
/* * /// <summary> * /// Gets the profile information. * /// </summary> * /// <param name="token">The token.</param> * /// <returns>Task<UserProfile>.</returns> * public async Task<UserProfile> GetProfileInfo(string token) * { * UserProfile userProfile; * var taskCompletionSource = new TaskCompletionSource<UserProfile>(); * var parameters = new Bundle(); * parameters.PutString("fields", "name,email,picture.type(large)"); * var client = new WebClient(); * var response = new Response() * { * HandleSuccess = (respose) => * { * userProfile = new UserProfile * { * Name = respose.JSONObject.GetString("name"), * Email = respose.JSONObject.GetString("email"), * ProfilePictureUrl = * respose.JSONObject.GetJSONObject("picture").GetJSONObject("data").GetString("url") * }; * * var pictureUrl = respose.JSONObject.GetJSONObject("picture").GetJSONObject("data").GetString("url"); * * // Download user profile picture * var pictureData = client.DownloadData(pictureUrl); * userProfile.ProfilePicture = pictureData; * * * taskCompletionSource.SetResult(userProfile); * } * }; * * * var graphRequest = new GraphRequest(AccessToken.CurrentAccessToken, * "/" + AccessToken.CurrentAccessToken.UserId, parameters, HttpMethod.Get, response); * graphRequest.ExecuteAsync(); * return await taskCompletionSource.Task; * } */ public async Task <bool> PostToFacebook(string statusUpdate, byte[] media) { if (AccessToken.CurrentAccessToken == null || string.IsNullOrEmpty(AccessToken.CurrentAccessToken.UserId)) { return(false); } var taskCompletionSource = new TaskCompletionSource <bool>(); var parameters = new Bundle(); parameters.PutString("message", statusUpdate); parameters.PutByteArray("picture", media); var response = new Response() { HandleSuccess = (respose) => { taskCompletionSource.SetResult(true); } }; var graphRequest = new GraphRequest(AccessToken.CurrentAccessToken, media != null ? "/me/photos" : "/me/feed", parameters, HttpMethod.Post, response); graphRequest.ExecuteAsync(); return(await taskCompletionSource.Task); }
void RequestUserData(Dictionary <string, object> fieldsDictionary) { string[] fields = new string[] { }; var extraParams = string.Empty; if (fieldsDictionary != null && fieldsDictionary.ContainsKey("fields")) { fields = fieldsDictionary["fields"] as string[]; if (fields.Length > 0) { extraParams = $"?fields={string.Join(",", fields)}"; } } if (AccessToken.CurrentAccessToken != null) { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", string.Join(",", fields)); request.Parameters = parameters; request.ExecuteAsync(); } else { var fbResponse = new FBEventArgs <string>(null, FacebookActionStatus.Canceled, "User cancelled facebook operation"); _onUserData.Invoke(CrossFacebookClient.Current, fbResponse); _userDataTcs?.TrySetResult(new FacebookResponse <string>(fbResponse)); } }
private void GetUserInfoViaGraphRequest() { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,first_name,last_name,email,birthday,gender,picture,link"); request.Parameters = parameters; request.ExecuteAsync(); }
private void SendRequest() { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }
private void PullUserProfileAsync() { var parameters = new Android.OS.Bundle(); parameters.PutString("fields", "id,name,email,gender"); GraphRequest request = new GraphRequest(AccessToken.CurrentAccessToken, "me", parameters, HttpMethod.Get, this); request.ExecuteAsync(); }
private void SetFacebookData(LoginResult loginResult) { GraphRequest graphRequest = GraphRequest.NewMeRequest(loginResult.AccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,email,first_name,last_name,picture"); graphRequest.Parameters = parameters; graphRequest.ExecuteAsync(); }
public void OnSuccess(Java.Lang.Object result) { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }
private void GetFacebookData() { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle param = new Bundle(); param.PutString("fields", "id,name,email"); request.Parameters = param; request.ExecuteAsync(); }
public async void GetUserInfo() { GraphCallback graphCallBack = new GraphCallback(); graphCallBack.RequestCompleted -= GraphCallBack_RequestCompleted; graphCallBack.RequestCompleted += GraphCallBack_RequestCompleted; var request = new GraphRequest(AccessToken.CurrentAccessToken, "/me", null, HttpMethod.Get, graphCallBack); await Task.Run(() => { request.ExecuteAsync(); }); }
public void VerifyPermissions(string[] permissions = null, Action <ChallengesFacebookShareResponseType> viewModelResponse = null, object param = null) { //var token = AccessToken.CurrentAccessToken; ViewModelResponse = viewModelResponse; Param = param; if (Xamarin.Facebook.AccessToken.CurrentAccessToken != null) { var request = new GraphRequest(AccessToken.CurrentAccessToken, "/me/permissions", null, HttpMethod.Get, this); request.ExecuteAsync(); } }
private void ConfigurateFacebookData() { GraphRequest oGraphRequest = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,birthday,email,address"); oGraphRequest.Parameters = parameters; oGraphRequest.ExecuteAsync(); oICallbackManager = CallbackManagerFactory.Create(); btnLogin.RegisterCallback(oICallbackManager, this); }
// public IGraphRequest NewRequest(FbAccessToken token, string path, string parameters, string httpMethod = default(string), string version = default(string)) { // // Initialize (token, path, httpMethod, version); // // var bundle = new Bundle(); // bundle.PutString("fields", parameters); // _request.Parameters = bundle; // // return this; // } public Task <IGraphResponse> ExecuteAsync() { TaskCompletionSource <IGraphResponse> tcs = new TaskCompletionSource <IGraphResponse> (); ((GraphCallback)_request.Callback).RequestCompleted += (object sender, GraphResponseEventArgs e) => { DroidGraphResponse resp = new DroidGraphResponse(e.Response); tcs.SetResult(resp); }; _request.ExecuteAsync(); return(tcs.Task); }
public void OnSuccess(Java.Lang.Object result) { var loginResult = result as Xamarin.Facebook.Login.LoginResult; Bundle parameters = new Bundle(); parameters.PutString("fields", "email"); GraphRequest request = GraphRequest.NewMeRequest(loginResult.AccessToken, new GraphJSONCallback(loginResult, this)); request.Parameters = parameters; request.ExecuteAsync(); }
public void OnSuccess(Java.Lang.Object p0) { // Facebook Email address LoginResult loginResult = (LoginResult)p0; _graphCBHandler = new GraphCBHandler(_fba); _fba.SetAccessToken(loginResult.AccessToken.Token); GraphRequest request = GraphRequest.NewMeRequest(loginResult.AccessToken, _graphCBHandler); Bundle parameters = new Bundle(); parameters.PutString("fields", "email"); request.Parameters = (parameters); request.ExecuteAsync(); }
public Task <FacebookUserInfo> GetUserInfo() { var _taskCompletionSource = new TaskCompletionSource <FacebookUserInfo>(); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,first_name,last_name,email"); GraphRequest graphRequestData = new GraphRequest(); GraphRequest userInfoGraphRequest = new GraphRequest(AccessToken.CurrentAccessToken, "me", parameters, graphRequestData.HttpMethod, new GetUserInfoCallback(_taskCompletionSource), graphRequestData.Version); userInfoGraphRequest.ExecuteAsync(); return(_taskCompletionSource.Task); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += MProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); SetContentView(Resource.Layout.Main); Button faceBookButton = FindViewById <Button>(Resource.Id.button); mTxtFirstName = FindViewById <TextView>(Resource.Id.txtFirstName); mTxtLastName = FindViewById <TextView>(Resource.Id.txtLastName); mTxtName = FindViewById <TextView>(Resource.Id.txtName); mProfilePic = FindViewById <ProfilePictureView>(Resource.Id.profilePic); mBtnShared = FindViewById <ShareButton>(Resource.Id.btnShare); mBtnGetEmail = FindViewById <Button>(Resource.Id.btnGetEmail); LoginButton button = FindViewById <LoginButton>(Resource.Id.login_button); button.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); button.RegisterCallback(mCallBackManager, this); mBtnGetEmail.Click += (o, e) => { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }; ShareLinkContent content = new ShareLinkContent.Builder().Build(); mBtnShared.ShareContent = content; }
/// <summary> /// Get user data from facebook /// </summary> /// <param name="callback"></param> public void GetUserData(IFacebookDataCallback callback) { FacebookDataCallback = callback; AccessToken accessToken = AccessToken.CurrentAccessToken; FacebookResult = new FacebookResult(); FacebookResult.Token = accessToken.Token; Bundle parameters = new Bundle(); parameters.PutString("fields", FacebookService.Fields); GraphRequest graphRequest = GraphRequest.NewMeRequest(accessToken, this); graphRequest.Parameters = parameters; graphRequest.ExecuteAsync(); }
public async Task <FeedResponse> GetFeed() { taskCompletion = new TaskCompletionSource <GraphResponse>(); FeedResponse feedResponse = null; GraphCallback graphCallback = new GraphCallback(); graphCallback.RequestCompleted += GraphCallback_RequestCompleted; var graphRequest = new GraphRequest(AccessToken.CurrentAccessToken, $"/me/feed", null, HttpMethod.Get, graphCallback); graphRequest.ExecuteAsync(); var graphResponse = await taskCompletion.Task; graphCallback.RequestCompleted -= GraphCallback_RequestCompleted; feedResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <FeedResponse>(graphResponse.RawResponse); return(feedResponse); }
public Task <bool> PostText(string message) { if (tcsText != null) { tcsText.TrySetResult(false); tcsText = null; } tcsText = new TaskCompletionSource <bool>(); var token = AccessToken.CurrentAccessToken?.Token; if (string.IsNullOrWhiteSpace(token)) { tcsText.TrySetResult(false); } else { bool hasRights; if (!HasPublishPermission()) { hasRights = RequestPublishPermissions(new[] { "publish_actions" }).Result; } else { hasRights = true; } if (hasRights) { //TODO Login here var bundle = new Bundle(); bundle.PutString("message", message); GraphRequest request = new GraphRequest(AccessToken.CurrentAccessToken, "me/feed", bundle, HttpMethod.Post, this); request.ExecuteAsync(); } else { tcsText.TrySetResult(hasRights); } } return(tcsText.Task); }
public async Task <Uri> GetPicture(string id) { taskCompletion = new TaskCompletionSource <GraphResponse>(); Uri uri = null; GraphCallback graphCallback = new GraphCallback(); graphCallback.RequestCompleted += GraphCallback_RequestCompleted; var graphRequest = new GraphRequest(AccessToken.CurrentAccessToken, $"/{id}?fields=picture.type(large)", null, HttpMethod.Get, graphCallback); graphRequest.ExecuteAsync(); var graphResponse = await taskCompletion.Task; graphCallback.RequestCompleted -= GraphCallback_RequestCompleted; uri = new Uri(Newtonsoft.Json.JsonConvert.DeserializeObject <PictureResponse>(graphResponse.RawResponse).picture.data.url); return(uri); }
void mProfileTracker_mOnProfileChanged(object sender, OnProfileChangedEventArgs e) { if (e.mProfile != null) { GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "email"); request.Parameters = parameters; request.ExecuteAsync(); nom.Text = e.mProfile.FirstName; prenom.Text = e.mProfile.LastName; pseudo.Text = e.mProfile.Name; } else { } }
void mProfileTracker_mOnProfileChanged(object sender, OnProfileChangedEventArgs e) { LoginManager.Instance.LogInWithReadPermissions(this, new List <string> { "user_friends", "public_profile" }); if (e.mProfile != null) { try { var sc = new SocialLoginData(); sc.scFirstName = e.mProfile.FirstName; sc.scLastName = e.mProfile.LastName; sc.scUserName = e.mProfile.FirstName + e.mProfile.LastName; sc.scSocialId = e.mProfile.Id; facebookpicture = "http://graph.facebook.com/" + e.mProfile.Id + "/picture?type=large"; sc.scProfileImgUrl = facebookpicture; sc.scEmail = email ?? ""; sc.scSource = "facebook"; sc.scAccessUrl = "http://facebook.com/profile.php?id=" + e.mProfile.Id; sc.scSocialOauthToken = AccessToken.CurrentAccessToken.Token; sc.scAccount = AccessToken.CurrentAccessToken.UserId; GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,email,picture"); request.Parameters = parameters; request.ExecuteAsync(); StartRegistration(sc); } catch (Java.Lang.Exception ex) { } } }
internal void GetOwnName() { var callback = new GraphJSONObjectCallback { HandleSuccess = obj => { var intent = new Intent(FacebookOwnNameReceiver.ActionKey); intent.PutExtra(FacebookOwnNameReceiver.ExtraResult, (int)Result.Success); intent.PutExtra(FacebookOwnNameReceiver.ExtraName, obj.GetString("name")); activity.SendBroadcast(intent); }, HandleError = error => { var intent = new Intent(FacebookOwnNameReceiver.ActionKey); intent.PutExtra(FacebookOwnNameReceiver.ExtraResult, (int)Result.Error); intent.PutExtra(FacebookOwnNameReceiver.ExtraError, error.ToString()); activity.SendBroadcast(intent); } }; GraphRequest request = GraphRequest.NewMeRequest(token, callback); request.ExecuteAsync(); }
void RequestData(Dictionary <string, object> pDictionary) { //string path,Bundle parameters = null,HttpMethod method = null,string version = null string path = $"{pDictionary["path"]}"; string version = $"{pDictionary["version"]}"; Dictionary <string, string> parameters = pDictionary["parameters"] as Dictionary <string, string>; FacebookHttpMethod?method = pDictionary["method"] as FacebookHttpMethod?; var currentTcs = _requestTcs; var _onEvent = _onRequestData; var httpMethod = HttpMethod.Get; if (method != null) { switch (method) { case FacebookHttpMethod.Get: httpMethod = HttpMethod.Get; break; case FacebookHttpMethod.Post: httpMethod = HttpMethod.Post; _onEvent = _onPostData; currentTcs = _postTcs; break; case FacebookHttpMethod.Delete: httpMethod = HttpMethod.Delete; _onEvent = _onDeleteData; currentTcs = _deleteTcs; break; } } if (string.IsNullOrEmpty(path)) { var fbResponse = new FBEventArgs <string>(null, FacebookActionStatus.Error, "Graph query path not specified"); _onEvent?.Invoke(CrossFacebookClient.Current, fbResponse); currentTcs?.TrySetResult(new FacebookResponse <string>(fbResponse)); return; } if (AccessToken.CurrentAccessToken != null) { GraphRequest request = new GraphRequest(AccessToken.CurrentAccessToken, path); request.Callback = this; request.HttpMethod = httpMethod; if (parameters != null) { Bundle bundle = new Bundle(); foreach (var p in parameters) { if (!string.IsNullOrEmpty(p.Key) && !string.IsNullOrEmpty(p.Value)) { bundle.PutString($"{p.Key}", $"{p.Value}"); } } request.Parameters = bundle; } if (!string.IsNullOrEmpty(version)) { request.Version = version; } request.ExecuteAsync(); } else { var fbResponse = new FBEventArgs <string>(null, FacebookActionStatus.Unauthorized, "Facebook operation not authorized, be sure you requested the right permissions"); _onEvent?.Invoke(CrossFacebookClient.Current, fbResponse); currentTcs?.TrySetResult(new FacebookResponse <string>(fbResponse)); } }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e) { base.OnElementChanged(e); if (e.OldElement != null || this.Element == null) { return; } loginButton = new LoginButton(Forms.Context); loginButton.LoginBehavior = LoginBehavior.NativeWithFallback; //Implement FacebookCallback with LoginResult type to handle Callback's result var loginCallback = new FacebookCallback <LoginResult> { HandleSuccess = loginResult => { /* * If login success, We can now retrieve our needed data and build our * FacebookEventArgs parameters */ FacebookButton facebookButton = (FacebookButton)e.NewElement; FacebookEventArgs fbArgs = new FacebookEventArgs(); if (loginResult.AccessToken != null) { fbArgs.UserId = loginResult.AccessToken.UserId; fbArgs.AccessToken = loginResult.AccessToken.Token; var expires = loginResult.AccessToken.Expires; //TODO better way to retrive Java.Util.Date and cast it to System.DateTime type fbArgs.TokenExpiration = new DateTime(expires.Year, expires.Month, expires.Day, expires.Hours, expires.Minutes, expires.Seconds); Bundle param = new Bundle(); param.PutString("fields", "first_name,last_name,email,birthday,picture"); var request = new GraphRequest(loginResult.AccessToken, "/me/acounts", param, HttpMethod.Get); request.ExecuteAsync(); /*((connection, result, error) => * { * var userInfo = result as NSDictionary; * nameLabel.Text = userInfo["first_name"].ToString(); * * ((App)App.Current).settings.AccessToken = fbArgs.AccessToken; * ((App)App.Current).settings.BirthDay = DateTime.Parse(userInfo["birthday"].ToString()); * ((App)App.Current).settings.Email = userInfo["email"].ToString(); * ((App)App.Current).settings.ExpirinDate = fbArgs.TokenExpiration; * ((App)App.Current).settings.Name = userInfo["first_name"].ToString() + " " + userInfo["last_name"].ToString(); * ((App)App.Current).settings.Imagem = userInfo["picture"].ToString(); * * var picture = userInfo["picture"] as NSDictionary; * picture = picture["data"] as NSDictionary; * * ((App)App.Current).settings.Imagem = picture["url"].ToString(); * ((App)App.Current).settingsViewModel.Gravar(); * ((App)App.Current).NavigateToHome(); * });*/ } /* * Pass the parameters into Login method in the FacebookButton * object and handle it on Xamarin.Forms side */ facebookButton.Login(facebookButton, fbArgs); }, HandleCancel = () => { //Handle any cancel the user has perform Console.WriteLine("User cancel de login operation"); }, HandleError = loginError => { //Handle any error happends here Console.WriteLine("Operation throws an error: " + loginError.Cause.Message); } }; LoginManager.Instance.RegisterCallback(MainActivity.CallbackManager, loginCallback); //Set the LoginButton as NativeControl SetNativeControl(loginButton); }
protected override void OnCreate(Bundle bundle) { //NOTE*** you have decodebitmapfromstream and decoderesource and decodebytearray //def don't need them all base.OnCreate(bundle); //problem getting view to load with fb login button //make fresh activity and try copying xml and code there. //async it's another activity we shouldnt get the bother from fb login through a dialog' FacebookSdk.SdkInitialize(this.ApplicationContext); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); mBtnSignIn = FindViewById <Button>(Resource.Id.btnSignIn); mTxtImgChoiceInfo = FindViewById <TextView>(Resource.Id.txtOr); mBtnSignup = FindViewById <Button>(Resource.Id.btnSignUp); mProgressBar = FindViewById <ProgressBar>(Resource.Id.progressBar1); mTxtBase64String = FindViewById <TextView>(Resource.Id.txtViewImgBase64); mImgUploadedPhoto = FindViewById <ImageView>(Resource.Id.imgUploadedPhoto); mTxtTestCross = FindViewById <TextView>(Resource.Id.txtImgPath); mBtnOpenGallery = FindViewById <Button>(Resource.Id.btnOpenGallery); mBtnConverttoBase = FindViewById <Button>(Resource.Id.btnConverttoBase64); mBtnConverttoImg = FindViewById <Button>(Resource.Id.btnConverttoImg); mTblImgStrings = FindViewById <TableLayout>(Resource.Id.tblBaseStrings); mBtnGetEmail = FindViewById <Button>(Resource.Id.btnGetEmail); //string[] mImgBaseStrings = new string[] { }; //List<string> mImgBaseStrings = new List<string>(); mProfileTracker = new MyProfileTracker(); mProfileTracker.mOnProfileChanged += mProfileTracker_mOnProfileChanged; mProfileTracker.StartTracking(); mProfilePic = FindViewById <ProfilePictureView>(Resource.Id.profilePicMain); mBtnFbLogin = FindViewById <LoginButton>(Resource.Id.btnFbLoginMain); mTest = FindViewById <TextView>(Resource.Id.txtTest); mBtnFbLogin.SetReadPermissions(new List <string> { "public_profile", "user_friends", "email" }); mCallBackManager = CallbackManagerFactory.Create(); mBtnFbLogin.RegisterCallback(mCallBackManager, this); mBtnGetEmail.Click += (o, e) => { System.Diagnostics.Debug.Write("welllllllllllllllll"); GraphRequest request = GraphRequest.NewMeRequest(AccessToken.CurrentAccessToken, this); Bundle parameters = new Bundle(); parameters.PutString("fields", "id,name,age_range,email"); request.Parameters = parameters; request.ExecuteAsync(); }; mBtnSignIn.Click += (object sender, EventArgs e) => { //pull up dialog //finish matching up login dialog, some of the code here is to do with signup as its copied from elsewhere FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialogue_Login signInDialog = new dialogue_Login(); signInDialog.Show(transaction, "dialog fragment"); signInDialog.mOnLoginComplete += SignInDialog_mOnSignInComplete; System.Diagnostics.Debug.Write("BTN SIGNIN CLICKED"); //Went with a fully-fledged function(name on line above) as it'd be quite a bit to write inside of a lambda expression //signInDialog.mOnLoginComplete += (object theSender, OnLoginEventArgs e) => //{ //} }; mBtnSignup.Click += (object sender, EventArgs e) => { //pull up dialog //this is used to pull up the dialog from the activity FragmentTransaction transaction = FragmentManager.BeginTransaction(); dialogue_SignUp signUpDialog = new dialogue_SignUp(); signUpDialog.Show(transaction, "dialog fragment"); //signUpDialog.mOnSignUpComplete += signUpDialog_mOnSignUpComplete; signUpDialog.mOnSignUpComplete += SignUpDialog_mOnSignUpComplete; }; mBtnOpenGallery.Click += delegate { var imageIntent = new Intent(); imageIntent.SetType("image/*"); imageIntent.SetAction(Intent.ActionGetContent); StartActivityForResult( Intent.CreateChooser(imageIntent, "Select photo"), 0); }; mBtnConverttoBase.Click += MBtnConverttoBase_Click; mBtnConverttoImg.Click += MBtnConverttoImg_Click; mImgUploadedPhoto.Click += (object sender, EventArgs e) => { Bitmap bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.mail4_small); //Convert to byte array MemoryStream memStream = new MemoryStream(); bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100, memStream); byte[] byteArray = memStream.ToArray(); var intent = new Intent(this, typeof(FullscreenImage)); intent.SetType("image/*"); intent.SetAction(Intent.ActionGetContent); intent.PutExtra("MyImg", byteArray); StartActivity(intent); }; }