Exemplo n.º 1
0
 public override void UpdateItems()
 {
     try {
         ItemSource.UpdateItems();
     } catch (Exception e) {
         SafeElement.LogSafeError(ItemSource, e, "UpdateItems");
     }
 }
Exemplo n.º 2
0
        public override bool SupportsItem(Item item)
        {
            item = ProxyItem.Unwrap(item);

            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(false);
            }

            try {
                return(Act.SupportsItem(item));
            } catch (Exception e) {
                SafeElement.LogSafeError(Act, e, "SupportsItem");
            }
            return(false);
        }
Exemplo n.º 3
0
        public override bool SupportsModifierItemForItems(IEnumerable <Item> items, Item modItem)
        {
            items   = ProxyItem.Unwrap(items);
            modItem = ProxyItem.Unwrap(modItem);

            if (!SupportedModifierItemTypes.Any(type => type.IsInstanceOfType(modItem)))
            {
                return(false);
            }

            try {
                return(Act.SupportsModifierItemForItems(items, modItem));
            } catch (Exception e) {
                SafeElement.LogSafeError(Act, e, "SupportsModifierItemForItems");
            }
            return(false);
        }
Exemplo n.º 4
0
        public override IEnumerable <Item> ChildrenOfItem(Item item)
        {
            IEnumerable <Item> children = null;

            item = ProxyItem.Unwrap(item);

            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(Enumerable.Empty <Item> ());
            }

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                children = ItemSource.ChildrenOfItem(item).ToArray();
            } catch (Exception e) {
                children = null;
                SafeElement.LogSafeError(ItemSource, e, "ChildrenOfItem");
            } finally {
                children = children ?? Enumerable.Empty <Item> ();
            }
            return(children);
        }
Exemplo n.º 5
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            IEnumerable <Item> results = null;

            items    = ProxyItem.Unwrap(items);
            modItems = ProxyItem.Unwrap(modItems);

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                results = Act.Perform(items, modItems);
                if (results != null)
                {
                    results = results.ToArray();
                }
            } catch (Exception e) {
                results = null;
                SafeElement.LogSafeError(Act, e, "Perform");
            } finally {
                results = results ?? Enumerable.Empty <Item> ();
            }
            return(results);
        }
Exemplo n.º 6
0
        public override IEnumerable <Item> DynamicModifierItemsForItem(Item item)
        {
            IEnumerable <Item> modItems = null;

            item = ProxyItem.Unwrap(item);

            // This is a duplicate check, so we may want to remove it.
            if (!SupportedItemTypes.Any(type => type.IsInstanceOfType(item)))
            {
                return(Enumerable.Empty <Item> ());
            }

            try {
                // Strictly evaluate the IEnumerable before we leave the try block.
                modItems = Act.DynamicModifierItemsForItem(item).ToArray();
            } catch (Exception e) {
                modItems = null;
                SafeElement.LogSafeError(Act, e, "DynamicModifierItemsForItem");
            } finally {
                modItems = modItems ?? Enumerable.Empty <Item> ();
            }
            return(modItems);
        }