Exemplo n.º 1
0
            public bool TryGetValue(string key, out object?value)
            {
                if (ApplicationDataContainerInterop.TryGetValue(_locality, key, out var innervalue))
                {
                    value = DataTypeSerializer.Deserialize(innervalue);
                    return(true);
                }

                value = null;
                return(false);
            }
Exemplo n.º 2
0
 public void Add(string key, object value)
 {
     if (ContainsKey(key))
     {
         throw new ArgumentException("An item with the same key has already been added.");
     }
     if (value != null)
     {
         ApplicationDataContainerInterop.SetValue(_locality, key, DataTypeSerializer.Serialize(value));
         MapChanged?.Invoke(this, null);
     }
 }
Exemplo n.º 3
0
            public IEnumerator <KeyValuePair <string, object> > GetEnumerator()
            {
                List <KeyValuePair <string, object> > kvps = new List <KeyValuePair <string, object> >();

                for (int index = 0; index < Count; index++)
                {
                    var key   = ApplicationDataContainerInterop.GetKeyByIndex(_locality, index);
                    var value = ApplicationDataContainerInterop.GetValueByIndex(_locality, index);
                    kvps.Add(new KeyValuePair <string, object>(key, value));
                }

                return(kvps.GetEnumerator());
            }
Exemplo n.º 4
0
 public object?this[string key]
 {
     get
     {
         if (ApplicationDataContainerInterop.TryGetValue(_locality, key, out var value))
         {
             return(DataTypeSerializer.Deserialize(value));
         }
         return(null);
     }
     set
     {
         if (value != null)
         {
             ApplicationDataContainerInterop.SetValue(_locality, key, DataTypeSerializer.Serialize(value));
         }
         else
         {
             Remove(key);
         }
     }
 }
Exemplo n.º 5
0
            public bool Remove(string key)
            {
                var ret = ApplicationDataContainerInterop.Remove(_locality, key);

                return(ret);
            }
Exemplo n.º 6
0
 public bool ContainsKey(string key)
 => ApplicationDataContainerInterop.ContainsKey(_locality, key);
Exemplo n.º 7
0
 public void Clear()
 {
     ApplicationDataContainerInterop.Clear(_locality);
 }