示例#1
0
        public void RemoveAt(int index)
        {
            WizardPanel panel = m_Panels[index];

            m_Panels.Remove(panel);

            if (RemovePanel != null)
            {
                RemovePanel(panel);
            }
        }
示例#2
0
 public bool FreeCachedFile(string filename)
 {
     if (_files.Contains(filename))
     {
         _currentBufferSize -= _files[filename].Length;
         _files.Remove(filename);
         EnsureCapacity();
         _freeFiles.Remove(filename);
         return(true);
     }
     _freeFiles.Remove(filename);
     return(false);
 }
示例#3
0
        /// <summary>
        /// Converts an existing AttributeChange to a new AttributeChange of type 'delete'
        /// </summary>
        /// <param name="csentry">The CSEntryChange to apply the AttributeChange to</param>
        /// <param name="attribute">The attribute to create the AttributeChange for</param>
        /// <param name="existingChange">The existing attribute change that was found on the CSEntryChange</param>
        private static void ConvertAttributeChangeToDelete(this KeyedCollection <string, AttributeChange> attributeChanges, ObjectModificationType objectModificationType, AcmaSchemaAttribute attribute, AttributeChange existingChange)
        {
            switch (objectModificationType)
            {
            case ObjectModificationType.Add:
                attributeChanges.Remove(existingChange);
                break;

            case ObjectModificationType.Delete:
                throw new DeletedObjectModificationException();

            case ObjectModificationType.Replace:
                attributeChanges.Remove(existingChange);
                break;

            case ObjectModificationType.Update:
                switch (existingChange.ModificationType)
                {
                case AttributeModificationType.Add:
                    attributeChanges.Remove(existingChange);
                    break;

                case AttributeModificationType.Delete:
                    break;

                case AttributeModificationType.Replace:
                    attributeChanges.Remove(existingChange);
                    Logger.WriteLine("Removed " + existingChange.Name);
                    attributeChanges.Add(AttributeChange.CreateAttributeDelete(attribute.Name));
                    Logger.WriteLine("Added " + attribute.Name);
                    break;

                case AttributeModificationType.Update:
                    attributeChanges.Remove(existingChange);
                    attributeChanges.Add(AttributeChange.CreateAttributeDelete(attribute.Name));
                    break;

                case AttributeModificationType.Unconfigured:
                default:
                    break;
                }

                break;

            case ObjectModificationType.Unconfigured:
            case ObjectModificationType.None:
            default:
                throw new UnknownOrUnsupportedModificationTypeException(objectModificationType);
            }
        }
示例#4
0
        /// <summary>
        /// Converts an AttributeChange of type 'delete' to a new AttributeChange of type 'update'
        /// </summary>
        /// <param name="csentry">The CSEntryChange to apply the AttributeChange to</param>
        /// <param name="attribute">The attribute to create the AttributeChange for</param>
        /// <param name="valueChanges">The value changes to apply</param>
        /// <param name="existingChange">The existing attribute change that was found on the CSEntryChange</param>
        private static void ConvertAttributeChangeUpdateFromDelete(this KeyedCollection <string, AttributeChange> attributeChanges, ObjectModificationType objectModificationType, AcmaSchemaAttribute attribute, IList <ValueChange> valueChanges, AttributeChange existingChange)
        {
            attributeChanges.Remove(existingChange);
            IList <object> valueAdds = valueChanges.Where(t => t.ModificationType == ValueModificationType.Add).Select(t => t.Value).ToList();

            switch (objectModificationType)
            {
            case ObjectModificationType.Add:
                throw new InvalidOperationException("The attribute change type is not valid for the object modification type");

            case ObjectModificationType.Delete:
                throw new DeletedObjectModificationException();

            case ObjectModificationType.Replace:
                throw new InvalidOperationException("The attribute change type is not valid for the object modification type");

            case ObjectModificationType.Update:
                attributeChanges.Add(AttributeChange.CreateAttributeReplace(attribute.Name, valueAdds));
                break;

            case ObjectModificationType.None:
            case ObjectModificationType.Unconfigured:
            default:
                throw new UnknownOrUnsupportedModificationTypeException(objectModificationType);
            }
        }
示例#5
0
        /// <summary>
        /// Converts an existing AttributeChange to a new AttributeChange of type 'replace'
        /// </summary>
        /// <param name="csentry">The CSEntryChange to apply the AttributeChange to</param>
        /// <param name="attribute">The attribute to create the AttributeChange for</param>
        /// <param name="values">The values to assign</param>
        /// <param name="existingChange">The existing attribute change that was found on the CSEntryChange</param>
        private static void ConvertAttributeChangeToReplace(this KeyedCollection <string, AttributeChange> attributeChanges, ObjectModificationType objectModificationType, AcmaSchemaAttribute attribute, IList <object> values, AttributeChange existingChange)
        {
            TypeConverter.ThrowOnAnyInvalidDataType(values);

            attributeChanges.Remove(existingChange);

            switch (objectModificationType)
            {
            case ObjectModificationType.Add:
                attributeChanges.Add(AttributeChange.CreateAttributeAdd(attribute.Name, values));
                break;

            case ObjectModificationType.Delete:
                throw new DeletedObjectModificationException();

            case ObjectModificationType.Replace:
                attributeChanges.Add(AttributeChange.CreateAttributeAdd(attribute.Name, values));
                break;

            case ObjectModificationType.Update:
                attributeChanges.Add(AttributeChange.CreateAttributeReplace(attribute.Name, values));
                break;

            case ObjectModificationType.Unconfigured:
            case ObjectModificationType.None:
            default:
                break;
            }
        }
示例#6
0
        /// <summary>
        /// Converts an AttributeChange of type 'update' to a new AttributeChange of type 'update'
        /// </summary>
        /// <param name="csentry">The CSEntryChange to apply the AttributeChange to</param>
        /// <param name="attribute">The attribute to create the AttributeChange for</param>
        /// <param name="valueChanges">The value changes to apply</param>
        /// <param name="existingChange">The existing attribute change that was found on the CSEntryChange</param>
        private static void ConvertAttributeChangeUpdateFromUpdate(this KeyedCollection <string, AttributeChange> attributeChanges, ObjectModificationType objectModificationType, AcmaSchemaAttribute attribute, IList <ValueChange> valueChanges, AttributeChange existingChange)
        {
            IList <ValueChange> mergedList = MergeValueChangeLists(attribute, existingChange.ValueChanges, valueChanges);

            attributeChanges.Remove(existingChange);

            switch (objectModificationType)
            {
            case ObjectModificationType.Add:
                throw new InvalidOperationException("The attribute change type is not valid for the object modification type");

            case ObjectModificationType.Delete:
                throw new DeletedObjectModificationException();

            case ObjectModificationType.Replace:
                throw new InvalidOperationException("The attribute change type is not valid for the object modification type");

            case ObjectModificationType.Update:
                attributeChanges.Add(AttributeChange.CreateAttributeUpdate(attribute.Name, mergedList));
                break;

            case ObjectModificationType.None:
            case ObjectModificationType.Unconfigured:
            default:
                throw new UnknownOrUnsupportedModificationTypeException(objectModificationType);
            }
        }
示例#7
0
 /// <summary>
 /// Removes a variable from the document.
 /// </summary>
 public bool Remove(SpssVariable variable)
 {
     if (variable == null)
     {
         throw new ArgumentNullException("variable");
     }
     EnsureAuthoringDictionary();
     try
     {
         variable.RemoveFromCollection(this);
     }
     catch (ArgumentException)
     {
         return(false);
     }
     variables.Remove(variable);
     variablesLookup.Remove(variable.Name);
     return(true);
 }
        public void Remove(String name)
        {
            lock (_serializedItemsLock) {
                if (_serializedItems != null)
                {
                    _serializedItems.Remove(name);
                }

                BaseRemove(name);
                _dirty = true;
            }
        }
示例#9
0
 public static void AddOrReplaceAttributeChange(this KeyedCollection <string, AttributeChange> attributeChanges, AttributeChange newAttributeChange)
 {
     if (!attributeChanges.Contains(newAttributeChange.Name))
     {
         attributeChanges.Add(newAttributeChange);
     }
     else
     {
         attributeChanges.Remove(newAttributeChange.Name);
         attributeChanges.Add(newAttributeChange);
     }
 }
示例#10
0
        private static void RemoveAttributeChangeIfEmpty(this KeyedCollection <string, AttributeChange> attributeChanges, string attributeName)
        {
            if (attributeChanges.Contains(attributeName))
            {
                AttributeChange change = attributeChanges[attributeName];

                if (change.ValueChanges.Count == 0 && change.ModificationType != AttributeModificationType.Delete)
                {
                    attributeChanges.Remove(attributeName);
                }
            }
        }
        public async void DoRefresh()
        {
            Exception exception = null;

            try
            {
                IEnumerable <Server> newServers = await _serverList.Refresh();

                ISet <ServerObservable> removedServers = new HashSet <ServerObservable>(_servers.Values);
                foreach (Server serverData in newServers)
                {
                    ServerObservable server = Mapper.Map <Server, ServerObservable>(serverData);

                    if (_servers.Contains(server.Key))
                    {
                        ServerObservable existingServer = _servers[serverData.Address];
                        Mapper.Map(server, existingServer);
                    }
                    else
                    {
                        _servers.Add(server);
                    }
                    removedServers.Remove(server);
                }

                foreach (ServerObservable serverData in removedServers)
                {
                    _servers.Remove(serverData.Key);
                }

                DoPingAll();
            }
            catch (Exception e) { exception = e; }

            if (exception != null)
            {
                await _popupService.ShowMessageBox("Error refreshing server list",
                                                   "Could not refresh the server list. " + exception.Message, MessageBoxImage.Error);
            }
        }
示例#12
0
        /// <summary>
        /// Converts an AttributeChange of type 'add' to a new AttributeChange of type 'update'
        /// </summary>
        /// <param name="csentry">The CSEntryChange to apply the AttributeChange to</param>
        /// <param name="attribute">The attribute to create the AttributeChange for</param>
        /// <param name="valueChanges">The value changes to apply</param>
        /// <param name="existingChange">The existing attribute change that was found on the CSEntryChange</param>
        private static void ConvertAttributeChangeUpdateFromAdd(this KeyedCollection <string, AttributeChange> attributeChanges, ObjectModificationType objectModificationType, AcmaSchemaAttribute attribute, IList <ValueChange> valueChanges, AttributeChange existingChange)
        {
            IList <ValueChange> mergedList = MergeValueChangeLists(attribute, existingChange.ValueChanges, valueChanges);

            //if (mergedList.Count == 0)
            //{
            //    return;
            //}

            //if (mergedList.ContainsSameElements(attributeChanges[attribute.Name].ValueChanges) && attributeChanges[attribute.Name].ModificationType == AttributeModificationType.Update)
            //{
            //    return;
            //}

            attributeChanges.Remove(existingChange);

            switch (objectModificationType)
            {
            case ObjectModificationType.Add:
                attributeChanges.Add(AttributeChange.CreateAttributeAdd(attribute.Name, mergedList.Where(t => t.ModificationType == ValueModificationType.Add).Select(t => t.Value).ToList()));
                break;

            case ObjectModificationType.Delete:
                throw new DeletedObjectModificationException();

            case ObjectModificationType.Replace:
                attributeChanges.Add(AttributeChange.CreateAttributeAdd(attribute.Name, mergedList.Where(t => t.ModificationType == ValueModificationType.Add).Select(t => t.Value).ToList()));
                break;

            case ObjectModificationType.Update:
                attributeChanges.Add(AttributeChange.CreateAttributeAdd(attribute.Name, mergedList.Where(t => t.ModificationType == ValueModificationType.Add).Select(t => t.Value).ToList()));
                break;

            case ObjectModificationType.None:
            case ObjectModificationType.Unconfigured:
            default:
                throw new UnknownOrUnsupportedModificationTypeException(objectModificationType);
            }
        }
示例#13
0
        public StateManager CreateManager(Combat.Character character, ReadOnlyList <String> filepaths)
        {
            if (character == null)
            {
                throw new ArgumentNullException("character");
            }
            if (filepaths == null)
            {
                throw new ArgumentNullException("filepaths");
            }

            KeyedCollection <Int32, State> states = new KeyedCollection <Int32, State>(x => x.Number);

            foreach (String filepath in filepaths)
            {
                ReadOnlyKeyedCollection <Int32, State> loadedstates = GetStates(filepath);
                foreach (State state in loadedstates)
                {
                    if (states.Contains(state.Number) == true)
                    {
                        states.Remove(state.Number);
                    }
                    states.Add(state);
                }
            }

            foreach (State state in m_internalstates)
            {
                if (states.Contains(state.Number) == false)
                {
                    states.Add(state);
                }
            }

            return(new StateManager(this, character, new ReadOnlyKeyedCollection <Int32, State>(states)));
        }
示例#14
0
        public StateManager CreateManager(Combat.Character character, ReadOnlyList<String> filepaths)
        {
            if (character == null) throw new ArgumentNullException("character");
            if (filepaths == null) throw new ArgumentNullException("filepaths");

            KeyedCollection<Int32, State> states = new KeyedCollection<Int32, State>(x => x.Number);

            foreach (String filepath in filepaths)
            {
                ReadOnlyKeyedCollection<Int32, State> loadedstates = GetStates(filepath);
                foreach (State state in loadedstates)
                {
                    if (states.Contains(state.Number) == true) states.Remove(state.Number);
                    states.Add(state);
                }
            }

            foreach (State state in m_internalstates)
            {
                if (states.Contains(state.Number) == false) states.Add(state);
            }

            return new StateManager(this, character, new ReadOnlyKeyedCollection<Int32, State>(states));
        }
示例#15
0
        public StateManager CreateManager(Combat.Character character, ReadOnlyList <string> filepaths)
        {
            if (character == null)
            {
                throw new ArgumentNullException(nameof(character));
            }
            if (filepaths == null)
            {
                throw new ArgumentNullException(nameof(filepaths));
            }

            var states = new KeyedCollection <int, State>(x => x.Number);

            foreach (var filepath in filepaths)
            {
                var loadedstates = GetStates(filepath);
                foreach (var state in loadedstates)
                {
                    if (states.Contains(state.Number))
                    {
                        states.Remove(state.Number);
                    }
                    states.Add(state);
                }
            }

            foreach (var state in _internalstates)
            {
                if (states.Contains(state.Number) == false)
                {
                    states.Add(state);
                }
            }

            return(new StateManager(this, character, new ReadOnlyKeyedCollection <int, State>(states)));
        }
示例#16
0
 public void RemovePlugin(string key)
 {
     _Plugins.Remove(key);
     _PluginsLoaded.Remove(key);
 }
 public void Update(FeedItem item)
 {
     LastUpdatedTime = item.LastUpdatedTime;
     Summary = item.Summary;
     Title = item.Title;
     Categories = item.Categories;
     var previousLinksAux = new KeyedCollection<Uri, SubscriptionItemLink>(x => x.Uri, Links);
     foreach (var currentLink in item.Links)
     {
         if (previousLinksAux.Contains(currentLink.Uri))
         {
             var previousLink = previousLinksAux[currentLink.Uri];
             if (previousLink.IsDownloaded && previousLink.Length != currentLink.Length)
             {
                 previousLink.Length = currentLink.Length;
                 previousLink.MarkAsNotDownloaded();
             }
             previousLink.MediaType = currentLink.MediaType;
             previousLink.RelationshipType = currentLink.RelationshipType;
             previousLink.Title = currentLink.Title;
             previousLinksAux.Remove(currentLink.Uri);
         }
         else
         {
             var newLink = CreateLink(currentLink);
             Links.Add(newLink);
         }
     }
     foreach (var previousLink in previousLinksAux)
         previousLink.Deleted = true;
 }
示例#18
0
 public void RemovePlugin(PluginBase plugin)
 {
     _Plugins.RemoveByKey(plugin.GetType().FullName);
     _PluginsLoaded.Remove(plugin);
 }