示例#1
0
        public void Delete(Property property)
        {
            Property cachedProperty = properties.FirstOrDefault(x => x.Name == property.Name);

            if (cachedProperty != null)
            {
                properties.Remove(cachedProperty);
                PropertyRemoved?.Invoke(cachedProperty);
            }
        }
        public static void OnPropertyRemoved(int tag, ref Maid currentMaid, int id)
        {
            StatusChangedEventArgs args = new StatusChangedEventArgs
            {
                Tag             = (MaidChangeType)tag,
                CallerMaid      = currentMaid,
                ID              = id,
                Value           = -1,
                BlockAssignment = false
            };

            PropertyRemoved?.Invoke(null, args);
        }
示例#3
0
 public void RemoveProperty(TilePos position, string key)
 {
     try
     {
         var objectToSetProperty = GetObjectAt(position);
         objectToSetProperty.Properties.Remove(key);
         PropertyRemoved.CallEvent(position, key);
     }
     catch (NullReferenceException)
     {
         throw new ObjectNotFoundException();
     }
 }
        public void TestMethodBinaryLayoutModification_RemovedProperty()
        {
            BinarySerializer serializer = new BinarySerializer(new UnknowTestTypeResolver());
            int exptectedId             = 7;

            #region byte generation code
            // Name property must be uncommented in PropertyRemoved
            //PropertyRemoved removedPropertyObj = new PropertyRemoved();
            //removedPropertyObj.ID = exptectedId;
            //removedPropertyObj.Name = "test";

            //byte[] result = serializer.Serialize(removedPropertyObj, null);
            //string resultBytesStr = string.Join(",", result);
            #endregion

            // Binary meta and payload data of PropertyExtended instance without Name property
            byte[] data = new byte[] { 180, 32, 156, 29, 4, 1, 17, 66, 83, 65, 71, 46, 73, 79, 67, 84, 97, 108, 107, 46, 84, 101, 115, 116, 59, 66, 83, 65, 71, 46, 73, 79, 67, 84, 97, 108, 107, 46, 84, 101, 115, 116, 46, 84, 101, 115, 116, 79, 98, 106, 101, 99, 116, 115, 46, 67, 104, 97, 110, 103, 101, 100, 76, 97, 121, 111, 117, 116, 46, 80, 114, 111, 112, 101, 114, 116, 121, 82, 101, 109, 111, 118, 101, 100, 2, 0, 3, 0, 3, 0, 0, 0, 2, 73, 68, 0, 2, 0, 2, 0, 0, 0, 4, 78, 97, 109, 101, 1, 1, 7, 0, 0, 0, 3, 4, 116, 101, 115, 116 };

            PropertyRemoved resultObject = (PropertyRemoved)serializer.Deserialize(data, null);

            Assert.Equal(exptectedId, resultObject.ID);
        }
示例#5
0
 public void Delete(Property property)
 {
     if (property.Name == null)
     {
         properties.Clear();
         groups.Clear();
     }
     else
     {
         Property cachedProperty = properties.FirstOrDefault(x => x.Name == property.Name);
         if (cachedProperty != null)
         {
             properties.Remove(cachedProperty);
             PropertyRemoved?.Invoke(cachedProperty);
             Group group = GetOrAddGroup(cachedProperty.GroupName);
             group.Delete(property);
             if (group.Properties.Count == 0)
             {
                 groups.Remove(group.Name);
                 GroupRemoved?.Invoke(group);
             }
         }
     }
 }
示例#6
0
 private void OnPropertyRemoved(Property property)
 {
     PropertyRemoved?.Invoke(this, property);
     property.UntypedValueChanged -= Property_OnUntypedValueChanged;
 }
示例#7
0
 protected virtual void OnPropertyRemoved(PropertyRemovedEventArgs e)
 {
     PropertyRemoved?.Invoke(this, e);
 }
 protected void OnPropertyCacheRemoved(PropertyCacheRemovedEventArgs <PropertyType> args)
 => PropertyRemoved?.Invoke(this, args);