Example #1
0
        public async Task <string> GetTaggedRemoteId(ContactStore store, string remoteId)
        {
            var taggedRemoteId     = String.Empty;
            var extendedProperties = await store.LoadExtendedPropertiesAsync();

            if (extendedProperties.ContainsKey(ContactStoreKey))
            {
                taggedRemoteId = string.Format("{0}_{1}", extendedProperties[ContactStoreKey], remoteId);
            }

            return(taggedRemoteId);
        }
    public async Task<string> GetTaggedRemoteId(ContactStore store, string remoteId)
    {
      var taggedRemoteId = String.Empty;
      var extendedProperties = await store.LoadExtendedPropertiesAsync();

      if (extendedProperties.ContainsKey(ContactStoreKey))
      {
        taggedRemoteId = string.Format("{0}_{1}", extendedProperties[ContactStoreKey], remoteId);
      }

      return taggedRemoteId;
    }
Example #3
0
 public async Task SetRemoteIdGuid(ContactStore store)
 {
     IDictionary<string, object> properties;
     properties = await store.LoadExtendedPropertiesAsync().AsTask<IDictionary<string, object>>();
     if (!properties.ContainsKey(ContactStoreLocalInstanceIdKey))
     {
         // the given store does not have a local instance id so set one against store extended properties
         Guid guid = Guid.NewGuid();
         properties.Add(ContactStoreLocalInstanceIdKey, guid.ToString());
         System.Collections.ObjectModel.ReadOnlyDictionary<string, object> readonlyProperties = new System.Collections.ObjectModel.ReadOnlyDictionary<string, object>(properties);
         await store.SaveExtendedPropertiesAsync(readonlyProperties).AsTask();
     }
 }
 public async Task TrySetRemoteIdGuid(ContactStore store)
 {
   var extendedProperties = await store.LoadExtendedPropertiesAsync().AsTask();
   if (!extendedProperties.ContainsKey(ContactStoreKey))
   {
     // the given store does not have a local instance id so set one against store extended properties
     var guid = Guid.NewGuid();
     extendedProperties.Add(ContactStoreKey, guid.ToString());
     
     var readonlyProperties = new ReadOnlyDictionary<string, object>(extendedProperties);
     await store.SaveExtendedPropertiesAsync(readonlyProperties);
   }
 }
Example #5
0
        public async Task TrySetRemoteIdGuid(ContactStore store)
        {
            var extendedProperties = await store.LoadExtendedPropertiesAsync().AsTask();

            if (!extendedProperties.ContainsKey(ContactStoreKey))
            {
                // the given store does not have a local instance id so set one against store extended properties
                var guid = Guid.NewGuid();
                extendedProperties.Add(ContactStoreKey, guid.ToString());

                var readonlyProperties = new ReadOnlyDictionary <string, object>(extendedProperties);
                await store.SaveExtendedPropertiesAsync(readonlyProperties);
            }
        }
Example #6
0
        public async Task SetRemoteIdGuid(ContactStore store)
        {
            IDictionary <string, object> properties;

            properties = await store.LoadExtendedPropertiesAsync().AsTask();

            if (!properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                var guid = Guid.NewGuid();
                properties.Add(ContactStoreLocalInstanceIdKey, guid.ToString());
                var readonlyProperties = new ReadOnlyDictionary <string, object>(properties);
                await store.SaveExtendedPropertiesAsync(readonlyProperties).AsTask();
            }
        }
Example #7
0
        public async Task SetRemoteIdGuid(ContactStore store)
        {
            IDictionary <string, object> properties;

            properties = await store.LoadExtendedPropertiesAsync().AsTask <IDictionary <string, object> >();

            if (!properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                // the given store does not have a local instance id so set one against store extended properties
                Guid guid = Guid.NewGuid();
                properties.Add(ContactStoreLocalInstanceIdKey, guid.ToString());
                System.Collections.ObjectModel.ReadOnlyDictionary <string, object> readonlyProperties = new System.Collections.ObjectModel.ReadOnlyDictionary <string, object>(properties);
                await store.SaveExtendedPropertiesAsync(readonlyProperties).AsTask();
            }
        }
Example #8
0
        public async Task <string> GetTaggedRemoteId(ContactStore store, string remoteId)
        {
            var taggedRemoteId = string.Empty;

            IDictionary <string, object> properties;

            properties = await store.LoadExtendedPropertiesAsync().AsTask();

            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                taggedRemoteId = string.Format("{0}_{1}", properties[ContactStoreLocalInstanceIdKey], remoteId);
            }

            return(taggedRemoteId);
        }
Example #9
0
        public async Task<string> GetTaggedRemoteId(ContactStore store, string remoteId)
        {
            string taggedRemoteId = string.Empty;

            System.Collections.Generic.IDictionary<string, object> properties;
            properties = await store.LoadExtendedPropertiesAsync().AsTask<System.Collections.Generic.IDictionary<string, object>>();
            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                taggedRemoteId = string.Format("{0}_{1}", properties[ContactStoreLocalInstanceIdKey], remoteId);
            }
            else
            {
                // handle error condition
            }

            return taggedRemoteId;
        }
Example #10
0
        /// <summary>
        /// Prepends the supplied remote ID with the GUID for the application in order to make sure
        /// that the remote ID is unique across all applications.
        /// </summary>
        /// <param name="store">The app's contact store. The remote ID Guid is stored in the store's
        /// extended properties collection.</param>
        /// <param name="remoteId">The remote ID to be prepended with the app's GUID.</param>
        /// <returns></returns>
        public async Task <string> GetTaggedRemoteId(ContactStore store, string remoteId)
        {
            string taggedRemoteId = string.Empty;

            System.Collections.Generic.IDictionary <string, object> properties;
            properties = await store.LoadExtendedPropertiesAsync().AsTask <System.Collections.Generic.IDictionary <string, object> >();

            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                taggedRemoteId = string.Format("{0}_{1}", properties[ContactStoreLocalInstanceIdKey], remoteId);
            }
            else
            {
                // handle error condition
            }
            return(taggedRemoteId);
        }
    public async Task<string> GetUntaggedRemoteId(ContactStore store, string taggedRemoteId)
    {
      var remoteId = String.Empty;

      var properties = await store.LoadExtendedPropertiesAsync();
      if (properties.ContainsKey(ContactStoreKey))
      {
        var localInstanceId = properties[ContactStoreKey] as String;
        
        if (!String.IsNullOrEmpty(localInstanceId) &&
            taggedRemoteId.Length > localInstanceId.Length + 1)
        {
          remoteId = taggedRemoteId.Substring(localInstanceId.Length + 1);
        }
      }

      return remoteId;
    }
Example #12
0
        public async Task <string> GetUntaggedRemoteId(ContactStore store, string taggedRemoteId)
        {
            var remoteId = String.Empty;

            var properties = await store.LoadExtendedPropertiesAsync();

            if (properties.ContainsKey(ContactStoreKey))
            {
                var localInstanceId = properties[ContactStoreKey] as String;

                if (!String.IsNullOrEmpty(localInstanceId) &&
                    taggedRemoteId.Length > localInstanceId.Length + 1)
                {
                    remoteId = taggedRemoteId.Substring(localInstanceId.Length + 1);
                }
            }

            return(remoteId);
        }
Example #13
0
        public async Task <string> GetUntaggedRemoteId(ContactStore store, string taggedRemoteId)
        {
            var remoteId = string.Empty;

            IDictionary <string, object> properties;

            properties = await store.LoadExtendedPropertiesAsync().AsTask();

            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                var localInstanceId = properties[ContactStoreLocalInstanceIdKey] as string;
                if (taggedRemoteId.Length > localInstanceId.Length + 1)
                {
                    remoteId = taggedRemoteId.Substring(localInstanceId.Length + 1);
                }
            }

            return(remoteId);
        }
Example #14
0
        public async Task<string> GetUntaggedRemoteId(ContactStore store, string taggedRemoteId)
        {
            string remoteId = string.Empty;

            System.Collections.Generic.IDictionary<string, object> properties;
            properties = await store.LoadExtendedPropertiesAsync().AsTask<System.Collections.Generic.IDictionary<string, object>>();
            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                string localInstanceId = properties[ContactStoreLocalInstanceIdKey] as string;
                if (taggedRemoteId.Length > localInstanceId.Length + 1)
                {
                    remoteId = taggedRemoteId.Substring(localInstanceId.Length + 1);
                }
            }
            else
            {
                // handle error condition
            }

            return remoteId;
        }
Example #15
0
        public async Task <string> GetUntaggedRemoteId(ContactStore store, string taggedRemoteId)
        {
            string remoteId = string.Empty;

            System.Collections.Generic.IDictionary <string, object> properties;
            properties = await store.LoadExtendedPropertiesAsync().AsTask <System.Collections.Generic.IDictionary <string, object> >();

            if (properties.ContainsKey(ContactStoreLocalInstanceIdKey))
            {
                string localInstanceId = properties[ContactStoreLocalInstanceIdKey] as string;
                if (taggedRemoteId.Length > localInstanceId.Length + 1)
                {
                    remoteId = taggedRemoteId.Substring(localInstanceId.Length + 1);
                }
            }
            else
            {
                // handle error condition
            }

            return(remoteId);
        }