示例#1
0
        /// <summary>
        /// Run the next iteration of this batch operation
        /// </summary>
        public void runBatchOp(CswNbtObjClassBatchOp BatchNode)
        {
            try
            {
                if (BatchNode != null && BatchNode.OpNameValue == CswEnumNbtBatchOpName.MultiButtonClick)
                {
                    BatchNode.start();

                    MultiButtonClickBatchData BatchData = new MultiButtonClickBatchData(BatchNode.BatchData.Text);
                    if (BatchData.MultiNodeIds.Count > 0)
                    {
                        String        NodeIdStr   = BatchData.MultiNodeIds.First.ToString();
                        CswPrimaryKey MultiNodePk = new CswPrimaryKey();
                        MultiNodePk.FromString(NodeIdStr);

                        CswNbtMetaDataNodeTypeProp NodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp(BatchData.NodeTypePropId);
                        if (Int32.MinValue != MultiNodePk.PrimaryKey && null != NodeTypeProp)
                        {
                            CswNbtObjClass.NbtButtonData ButtonData = new CswNbtObjClass.NbtButtonData(NodeTypeProp);
                            CswNbtNode MultiNode = _CswNbtResources.Nodes[MultiNodePk];
                            if (MultiNode != null)
                            {
                                MultiNode.ObjClass.triggerOnButtonClick(ButtonData);
                            }
                        }
                        // Setup for next iteration
                        BatchData.MultiNodeIds.RemoveAt(0);
                        BatchNode.BatchData.Text    = BatchData.ToString();
                        BatchNode.PercentDone.Value = getPercentDone(BatchNode);
                    }
                    else
                    {
                        BatchNode.finish();
                    }
                    BatchNode.postChanges(false);
                }
            }
            catch (Exception ex)
            {
                BatchNode.error(ex);
            }
        } // runBatchOp()
示例#2
0
        /// <summary>
        /// Create a new batch operation to handle clicking an objectclass button for multiple nodes
        /// </summary>
        /// <param name="MultiNodeIds">NodeIds with which ObjectClassButtonClick logic should be applied</param>
        /// <param name="NodeTypePropId">PropId of the ObjectClassButton</param>
        public CswNbtObjClassBatchOp makeBatchOp(Collection <CswPrimaryKey> MultiNodeIds, Int32 NodeTypePropId)
        {
            MultiButtonClickBatchData BatchData = new MultiButtonClickBatchData(string.Empty);

            BatchData.MultiNodeIds   = _pkArrayToJArray(MultiNodeIds);
            BatchData.StartingCount  = MultiNodeIds.Count();
            BatchData.NodeTypePropId = NodeTypePropId;

            CswNbtObjClassBatchOp BatchNode = CswNbtBatchManager.makeNew(_CswNbtResources, _BatchOpName, BatchData.ToString());

            return(BatchNode);
        }