Ejemplo n.º 1
0
        public override void OnEnter()
        {
            if (string.IsNullOrEmpty(label.Value))
            {
                NativeUI.Alert("Invalid phone number's label", "Phone number's label can't be empty");
                Finish();
                return;
            }

            if (string.IsNullOrEmpty(phoneNumber.Value))
            {
                NativeUI.Alert("Invalid phone number", "Phone number can't be empty");
                Finish();
                return;
            }
            AddedPhoneNumbersObject temp = (AddedPhoneNumbersObject)phoneNumbersObject.Value;

            List <StringStringKeyValuePair> addedPhoneNumbers = temp.AddedPhoneNumbers;

            if (addedPhoneNumbers == null)
            {
                addedPhoneNumbers = new List <StringStringKeyValuePair>();
            }
            addedPhoneNumbers.Add(new StringStringKeyValuePair(label.Value, phoneNumber.Value));

            temp.AddedPhoneNumbers      = addedPhoneNumbers;
            phoneNumbersObjectOut.Value = temp;
            phoneNumbersObject.Value    = temp;
            NativeUI.Alert("Success", "New phone number has been added.");
            Finish();
        }
Ejemplo n.º 2
0
        public override void OnEnter()
        {
            DateTime?birthday = null;

            if (!string.IsNullOrEmpty(birthdayInput.Value))
            {
                DateTime parseBirthday;
                if (DateTime.TryParseExact(birthdayInput.Value, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out parseBirthday))
                {
                    birthday = parseBirthday;
                }
                else
                {
                    errorMsg.Value = "Can't convert birthday to yyyy-MM-dd format.";
                    Fsm.Event(eventTarget, isNotSuccessEvent);
                }
            }

            AddedPhoneNumbersObject addedPhoneNumbersTemp = (AddedPhoneNumbersObject)phoneNumbersObject.Value;

            AddedEmailsObject addedEmailsTemp = (AddedEmailsObject)emailsObject.Value;

            List <StringStringKeyValuePair> addedEmails = addedEmailsTemp.AddedEmails != null ? addedEmailsTemp.AddedEmails : new List <StringStringKeyValuePair>();

            List <StringStringKeyValuePair> addedPhoneNumbers = addedPhoneNumbersTemp.AddedPhoneNumbers != null ? addedPhoneNumbersTemp.AddedPhoneNumbers : new List <StringStringKeyValuePair>();

            Texture2D avatarImage = (Texture2D)avatarImageInput.Value;

            //var avatar = avatarImage != null ? (Texture2D)avatarImage : null;

            Contact contact = new Contact()
            {
                FirstName    = firstName.Value,
                MiddleName   = middleName.Value,
                LastName     = lastName.Value,
                Company      = company.Value,
                Birthday     = birthday,
                Emails       = addedEmails.Select(email => new KeyValuePair <string, string>(email.Key, email.Value)).ToArray(),
                PhoneNumbers = addedPhoneNumbers.Select(phoneNumber => new KeyValuePair <string, string>(phoneNumber.Key, phoneNumber.Value)).ToArray(),
                Photo        = avatarImage
            };

            string error = DeviceContacts.AddContact(contact);

            if (string.IsNullOrEmpty(error))
            {
                Fsm.Event(eventTarget, isSuccessEvent);
            }
            else
            {
                errorMsg.Value = error;
                Fsm.Event(eventTarget, isNotSuccessEvent);
            }
        }
Ejemplo n.º 3
0
        public override void OnEnter()
        {
            StringStringCollectionView collectionView   = collectionViewGameObject.Value.GetComponent <StringStringCollectionView>();
            AddedPhoneNumbersObject    tempPhoneNumbers = (AddedPhoneNumbersObject)phoneNumbersObject.Value;

            if ((collectionView != null) && (tempPhoneNumbers.AddedPhoneNumbers != null))
            {
                collectionView.Show(tempPhoneNumbers.AddedPhoneNumbers, "Phone Numbers");
                Finish();
            }
            Finish();
        }