コード例 #1
0
        public string InsertOrUpdateTag(IContactTag tag)
        {
            string result = String.Empty;

            lock (_tags)
            {
                var target = _tags.FirstOrDefault(x => x.Key == tag.Key);

                if (target == null)
                {
                    target = ContactTag.GetLocalObject(tag);
                    result = target.Key = Guid.NewGuid().ToString("D");

                    _tags.Add(target);
                }
                else
                {
                    _tags.Remove(target);
                    _tags.Add(ContactTag.GetLocalObject(tag));
                }
            }

            FlushDb();

            return(result);
        }
コード例 #2
0
        public TagLocal(IContactTag source, AddressBookLocal addressBook, ContactsManager contactsManager)
            : this(-1, addressBook, contactsManager)
        {
            Key = source.Key;

            UpdateFrom(source);
        }
コード例 #3
0
        public void UpdateFrom(IContactTag source)
        {
            Name       = source.Name;
            Color      = source.Color;
            VersionKey = source.VersionKey == null ? String.Empty : source.VersionKey.ToString();
            Key        = source.Key;

            IsChanged = false;
        }
コード例 #4
0
        private static ContactTag CreateFromContactTag(IContactTag tag)
        {
            var result = new ContactTag()
            {
                Color = tag.Color,
                Key   = tag.Key,
                Name  = tag.Name
            };

            result.SetVersionKey(tag.VersionKey);

            return(result);
        }
コード例 #5
0
ファイル: AddressBookService.cs プロジェクト: modernstar/core
 public string InsertOrUpdateTag(IContactTag tag)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
ファイル: GoogleAddressBook.cs プロジェクト: modernstar/core
 public string InsertOrUpdateTag(IContactTag tag)
 {
     return(string.Empty);
 }
コード例 #7
0
        public static ContactTag GetLocalObject(IContactTag tag)
        {
            var result = tag as ContactTag;

            return(result ?? CreateFromContactTag(tag));
        }