Beispiel #1
0
        /// <summary>
        /// Handler when Contacts API successfully adds a new contact.
        /// This is called from the add/edit contact page.
        /// </summary>
        /// <param name="operationResult">Result of operation</param>
        /// <param name="requestHandle">Handle of the request</param>
        private void HandleOnContactAdded(MLContactsOperationResult operationResult, ulong requestHandle)
        {
            _contactPage.Populate(operationResult.Contact);

            _needToReloadContacts = true;
            Log("<color=green>Contact added</color>");
        }
Beispiel #2
0
        /// <summary>
        /// Handler when Contacts API fails any operation.
        /// </summary>
        /// <param name="operationResult">Result of operation</param>
        /// <param name="requestHandle">Handle of the request</param>
        private void HandleOnOperationFailed(MLContactsOperationResult operationResult, ulong requestHandle)
        {
            string reason = "unspecified failure";

            switch (operationResult.Status)
            {
            case MLContactsOperationStatus.Duplicate:
                reason = "A contact, with the same details, already exist.";
                break;

            case MLContactsOperationStatus.Fail:
                reason = "An internal error has occurred.";
                break;

            case MLContactsOperationStatus.NotFound:
                reason = "The contact does not exist.";
                break;

            case MLContactsOperationStatus.Success:
                // this case should never be reached in this callback.
                break;
            }

            Debug.LogErrorFormat("Error: ContactsExample encountered an error from an operation. {0}", reason);
            Log(string.Format("<color=red>Operation Failed. {0}</color>", reason));
        }
Beispiel #3
0
 /// <summary>
 /// Handler when Contacts API successfully removes a contact.
 /// This is called from the list contacts page.
 /// </summary>
 /// <param name="operationResult">Result of operation</param>
 /// <param name="requestHandle">Handle of the request</param>
 private void HandleOnContactDeleted(MLContactsOperationResult operationResult, ulong requestHandle)
 {
     LoadContactsFromAPI();
     Log("<color=green>Contact deleted</color>");
 }