コード例 #1
0
        private void RaiseLanguageRemoveInteractionRequest(GeneralLanguage selectedItem)
        {
            var confirmation = new ConditionalConfirmation
            {
                Title   = "Remove confirmation".Localize(null, LocalizationScope.DefaultCategory),
                Content = string.Format("Are you sure you want to remove Language '{0}'?".Localize(), selectedItem.LanguageCode)
            };

            LanguageCommonConfirmRequest.Raise(confirmation,
                                               (x) =>
            {
                if (x.Confirmed)
                {
                    if (AddedItems.Contains(selectedItem))
                    {
                        AddedItems.Remove(selectedItem);
                    }
                    else
                    {
                        if (UpdatedItems.Contains(selectedItem))
                        {
                            UpdatedItems.Remove(selectedItem);
                        }
                        RemovedItems.Add(selectedItem);
                    }
                    InnerItems.Remove(selectedItem);
                }
            });
        }
コード例 #2
0
 public void Remove(T item)
 {
     if (AddedItems.Contains(item))
     {
         AddedItems.Remove(item);
     }
     else
     {
         if (UpdatedItems.Contains(item))
         {
             UpdatedItems.Remove(item);
         }
         RemovedItems.Add(item);
     }
     InnerItems.Remove(item);
     item.PropertyChanged -= OnPropertyChanged;
 }
コード例 #3
0
        /// <summary>
        ///     Removes a user defined <see cref="Item"/> from the Connector Plugin's data structure.
        /// </summary>
        /// <remarks>
        ///     <para>If an Item being removed has child Items, all children are also removed.</para>
        /// </remarks>
        /// <param name="fqn">The Item to remove.</param>
        /// <returns>A Result containing the result of the operation.</returns>
        public Result RemoveItem(string fqn)
        {
            logger.EnterMethod(xLogger.Params(fqn));
            logger.Info("Removing user defined Item '" + fqn + "...");

            Result retVal = new Result <Item>();

            // check to see if the specified Item has been added previously
            if (AddedItems.ContainsKey(fqn))
            {
                // try to find the matching Item instance
                Item foundItem = Find(fqn);

                if (foundItem != default(Item))
                {
                    // leverage the Item's parent to remove it from the model. The RemoveChild() method in Item will recursively
                    // remove all children.
                    foundItem.Parent.RemoveChild(foundItem);
                }
                else
                {
                    retVal.AddWarning("The Item '" + fqn + "' was not found in the Item data structure, but exists in the list of added items.  It will be removed from the list.");
                }

                // remove the item from the AddedItems list
                AddedItems.Remove(fqn);
            }
            else
            {
                retVal.AddError("The Item '" + fqn + "' does not exist in the list of added Items.");
            }

            retVal.LogResult(logger);
            logger.ExitMethod(retVal);
            return(retVal);
        }