/// <summary> /// Update core data associated with the SDK MNode object /// </summary> /// <param name="megaNode">Node to update</param> /// <param name="externalUpdate">Indicates if is an update external to the app. For example from an `onNodesUpdate`</param> public override async void Update(MNode megaNode, bool externalUpdate = false) { base.Update(megaNode, externalUpdate); this.FolderLocation = SdkService.MegaSdk.getNodePath(megaNode); var outShares = SdkService.MegaSdk.getOutShares(megaNode); var outSharesSize = outShares.size(); if (outSharesSize == 1) { var contact = SdkService.MegaSdk.getContact(outShares.get(0).getUser()); var contactAttributeRequestListener = new GetUserAttributeRequestListenerAsync(); var firstName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(contact, (int)MUserAttrType.USER_ATTR_FIRSTNAME, contactAttributeRequestListener)); var lastName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(contact, (int)MUserAttrType.USER_ATTR_LASTNAME, contactAttributeRequestListener)); OnUiThread(() => { this.ContactsText = (string.IsNullOrWhiteSpace(firstName) || string.IsNullOrWhiteSpace(lastName)) ? contact.getEmail() : string.Format("{0} {1}", firstName, lastName); }); } else { OnUiThread(() => this.ContactsText = string.Format( ResourceService.UiResources.GetString("UI_NumberOfContacts"), outSharesSize)); } }
/// <summary> /// Gets the user last name attribute /// </summary> public static async void GetUserLastname() { var userAttributeRequestListener = new GetUserAttributeRequestListenerAsync(); var lastname = await userAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getOwnUserAttribute((int)MUserAttrType.USER_ATTR_LASTNAME, userAttributeRequestListener)); UiService.OnUiThread(() => UserData.Lastname = lastname); }
public static async Task <string> GetContactLastName(MUser contact) { var contactAttributeRequestListener = new GetUserAttributeRequestListenerAsync(); var lastName = await contactAttributeRequestListener.ExecuteAsync(() => { SdkService.MegaSdk.getUserAttribute( contact, (int)MUserAttrType.USER_ATTR_LASTNAME, contactAttributeRequestListener); }); return(lastName); }
/// <summary> /// Update core data associated with the SDK MNode object /// </summary> /// <param name="megaNode">Node to update</param> /// <param name="externalUpdate">Indicates if is an update external to the app. For example from an `onNodesUpdate`</param> public override async void Update(MNode megaNode, bool externalUpdate = false) { base.Update(megaNode, externalUpdate); var owner = SdkService.MegaSdk.getUserFromInShare(megaNode); var contactAttributeRequestListener = new GetUserAttributeRequestListenerAsync(); var firstName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(owner, (int)MUserAttrType.USER_ATTR_FIRSTNAME, contactAttributeRequestListener)); var lastName = await contactAttributeRequestListener.ExecuteAsync(() => SdkService.MegaSdk.getUserAttribute(owner, (int)MUserAttrType.USER_ATTR_LASTNAME, contactAttributeRequestListener)); OnUiThread(() => { this.Owner = string.IsNullOrWhiteSpace(firstName) && string.IsNullOrWhiteSpace(lastName) ? owner.getEmail() : string.Format("{0} {1}", firstName, lastName); }); }