コード例 #1
0
        /// <summary>
        /// Adds a new contact or updates an existing contact. Called by ContactPage.
        /// </summary>
        /// <param name="contact">New Contact</param>
        /// <returns>Result of operation</returns>
        public MLResult SaveContact(MLContactsContact contact)
        {
            Log("Saving...");

            ulong    requestHandle = 0;
            MLResult result;

            if (!string.IsNullOrEmpty(contact.ID))
            {
                Debug.LogFormat("Updating existing contact with id = {0}", contact.ID);
                result = MLContacts.UpdateContact(contact, out requestHandle);
            }
            else
            {
                Debug.LogFormat("Saving new contact with name = {0}", contact.Name);
                result = MLContacts.AddContact(contact, out requestHandle);
            }

            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: ContactsExample failed to save contact. Reason: {0}", result);
                Log(string.Format("<color=red>Failed to save contact. {0}</color>", result));
            }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Adds a new contact or updates an existing contact.
        /// Called by ContactPageVisualizer.
        /// </summary>
        /// <param name="contact">The new contact to save.</param>
        public MLResult SaveContact(MLContacts.Contact contact)
        {
            ulong    requestHandle = 0;
            MLResult result;

            if (!string.IsNullOrEmpty(contact.ID))
            {
                Debug.LogFormat("Updating existing contact with id = {0}", contact.ID);
                result = MLContacts.UpdateContact(contact, out requestHandle);
            }
            else
            {
                Debug.LogFormat("Saving new contact with name = {0}", contact.Name);
                result = MLContacts.AddContact(contact, out requestHandle);
            }

            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLContactsBehavior failed to save contact. Reason: {0}", result);
            }

            return(result);
        }