Exemple #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;
    }
 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);
   }
 }
Exemple #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);
            }
        }
Exemple #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();
            }
        }
Exemple #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();
            }
        }
Exemple #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);
        }
        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;
        }
Exemple #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;
    }
Exemple #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);
        }
Exemple #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);
        }
        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;
        }
Exemple #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);
        }