Esempio n. 1
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            var GetMessageInfoDelegate = new Func <string, string, EmailMessage>(GetMessageInfo);

            context.UserState = GetMessageInfoDelegate;
            return(GetMessageInfoDelegate.BeginInvoke(ItemId.Get(context), MailboxEmail.Get(context), callback, state));
        }
Esempio n. 2
0
        protected override Boolean Execute(CodeActivityContext context)
        {
            Boolean      result    = false;
            IItemSupport extension = context.GetExtension <IItemSupport>();

            if (extension != null)
            {
                result = extension.UpdatePendingInventory(OrderId.Get(context),
                                                          ItemId.Get(context), Quantity.Get(context));
            }
            return(result);
        }
Esempio n. 3
0
        protected override IAsyncResult BeginExecute(
            AsyncCodeActivityContext context,
            AsyncCallback callback, object state)
        {
            InventoryLookupAsyncArgs parameters = new InventoryLookupAsyncArgs
            {
                ItemId       = ItemId.Get(context),
                WarehouseId  = WarehouseId.Get(context),
                RequestedQty = RequestedQty.Get(context),
            };

            Func <InventoryLookupAsyncArgs, Int32> asyncWork =
                args => Lookup(args);

            context.UserState = asyncWork;
            return(asyncWork.BeginInvoke(parameters, callback, state));
        }
Esempio n. 4
0
        protected override int Execute(CodeActivityContext context)
        {
            Int32 availableInventory            = 0;
            Int32 warehouseId                   = WarehouseId.Get(context);
            Dictionary <Int32, Int32> warehouse = null;

            if (_warehouses.TryGetValue(warehouseId, out warehouse))
            {
                Int32 itemId = ItemId.Get(context);
                if (warehouse.TryGetValue(itemId, out availableInventory))
                {
                    Int32 requestedQty = RequestedQty.Get(context);
                    if (availableInventory > requestedQty)
                    {
                        availableInventory = requestedQty;
                    }
                }
            }
            return(availableInventory);
        }
Esempio n. 5
0
        /// <summary>
        /// Get a property by the given id for the given item.
        /// </summary>
        protected override int GetProperty(uint itemId, int propId, out object property)
        {
            switch (propId)
            {
            case (int)__VSHPROPID.VSHPROPID_FirstChild:
            case (int)__VSHPROPID.VSHPROPID_FirstVisibleChild:
            {
                if (!IsReferencesContainer(itemId))
                {
                    // Base call
                    var rc         = base.GetProperty(itemId, propId, out property);
                    var nextPropId = (propId == (int)__VSHPROPID.VSHPROPID_FirstChild)
                                                 ? __VSHPROPID.VSHPROPID_NextSibling
                                                 : __VSHPROPID.VSHPROPID_NextVisibleSibling;

                    // Filter out JarReferences
                    while (ErrorHandler.Succeeded(rc))
                    {
                        var childId = ItemId.Get(property);
                        if (childId.IsNil)
                        {
                            break;
                        }
                        if (!referencesList.IsJarReference(childId.Value))
                        {
                            return(VSConstants.S_OK);
                        }

                        // Get next
                        rc = base.GetProperty(childId.Value, (int)nextPropId, out property);
                    }

                    // No first child found
                    property = VSConstants.VSITEMID_NIL;
                    return(VSConstants.S_OK);
                }
                else
                {
                    // Return the first reference child
                    property = referencesList.GetFirstChild().Value;
                    return(VSConstants.S_OK);
                }
            }

            case (int)__VSHPROPID.VSHPROPID_NextSibling:
            case (int)__VSHPROPID.VSHPROPID_NextVisibleSibling:
            {
                if (!referencesList.Contains(itemId))
                {
                    // Request for item that is not in the references node.
                    var rc = base.GetProperty(itemId, propId, out property);

                    // Filter out JarReferences
                    while (ErrorHandler.Succeeded(rc))
                    {
                        var childId = ItemId.Get(property);
                        if (childId.IsNil)
                        {
                            break;
                        }
                        if (!referencesList.IsJarReference(childId.Value))
                        {
                            return(VSConstants.S_OK);
                        }

                        // Get next
                        rc = base.GetProperty(childId.Value, propId, out property);
                    }

                    // No first child found
                    property = VSConstants.VSITEMID_NIL;
                    return(VSConstants.S_OK);
                }
                else
                {
                    // We're in references; return the next reference
                    property = referencesList.GetNextSibling(itemId).Value;
                    return(VSConstants.S_OK);
                }
            }

            case (int)__VSHPROPID.VSHPROPID_Parent:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    if (referenceContainerItemId.HasValue)
                    {
                        property = referenceContainerItemId.Value;
                        return(VSConstants.S_OK);
                    }
                    property = VSConstants.VSITEMID_NIL;
                    return(VSConstants.S_OK);
                }
            }
            break;

            case (int)__VSHPROPID.VSHPROPID_ParentHierarchy:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    property = null;
                    return(VSConstants.S_OK);
                }
            }
            break;

            case (int)__VSHPROPID.VSHPROPID_ParentHierarchyItemid:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    property = VSConstants.VSITEMID_NIL;
                    return(VSConstants.S_OK);
                }
            }
            break;

            case (int)__VSHPROPID.VSHPROPID_IconHandle:
            case (int)__VSHPROPID.VSHPROPID_OpenFolderIconHandle:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    // Get our own jar icon
                    property = ImageHandler.GetIconHandle(0);
                    return(VSConstants.S_OK);
                }
            }
            break;

            case (int)__VSHPROPID.VSHPROPID_IconIndex:
            case (int)__VSHPROPID.VSHPROPID_OpenFolderIconIndex:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    // Force using the IconHandle property
                    property = null;
                    return(VSConstants.E_NOTIMPL);
                }
            }
            break;

            case (int)__VSHPROPID.VSHPROPID_OverlayIconIndex:
            {
                if (referencesList.IsJarReference(itemId))
                {
                    // No overlay
                    property = VSOVERLAYICON.OVERLAYICON_NONE;
                    return(VSConstants.S_OK);
                }
            }
            break;

            case (int)__VSHPROPID2.VSHPROPID_PropertyPagesCLSIDList:
            {
                // Get a semicolon-delimited list of clsids of the configuration-independent property pages.
                ErrorHandler.ThrowOnFailure(base.GetProperty(itemId, propId, out property));
                var list = ((string)property).Split(';').ToList();
                list.RemoveAll(x => x != BuildPropertyPageGuid);
                list.Insert(0, new Guid(GuidList.Strings.guidDot42AndroidPropertyPage).ToString("B"));
                property = string.Join(";", list);
                return(VSConstants.S_OK);
            }

            case (int)__VSHPROPID2.VSHPROPID_CfgPropertyPagesCLSIDList:
            {
                // Get a semicolon-delimited list of clsids of the configuration-dependent property pages.
                ErrorHandler.ThrowOnFailure(base.GetProperty(itemId, propId, out property));
                var list = ((string)property).Split(';').ToList();
                list.RemoveAll(x => x != BuildPropertyPageGuid);

                property = string.Join(";", list);
                return(VSConstants.S_OK);
            }
            }
            return(base.GetProperty(itemId, propId, out property));
        }