在自定义按钮操作中显示处理图标



我有一个过程,该过程被屏幕上的按钮激活 - 但我想知道如何使其像过程按钮一样工作,旋转轮的发生和绿色复选框出现在最后。我有以下代码,我在pxlongoperation中包装了这些代码。启动(...)如下(在这里评论了pxlongoperation,因为它似乎没有做任何事情):

 public PXAction<APInvoice> CreatePOBillings;
   // [PXButton(CommitChanges = true)]
    [PXProcessButton]
    [PXUIField(DisplayName = "Create PO Billings", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Update)]
    protected void createPOBillings()
    {
        int i = 0;
        try
        {
            //This wraps the whole process into a 'PXLongOperation' function that will create the spinning 'busy' wheel at the top toolbar...
            //PXLongOperation.StartOperation(this, delegate()
            //{
                var apinvoice = (APInvoice)Base.Document.Current;
                if (apinvoice == null) return;
                string RefNbr = apinvoice.RefNbr;
                //Run the stored procedure which will get the records to create the Project Transactions.  This will populate the table 'xCreatePOBilings':
                var pars = new PXSPParameter[] { new PXSPInParameter("@p_RefNbr", RefNbr) }; //, new PXSPOutParameter("p2", outp2) };
                var results = PXDatabase.Execute("xspMarketingPOBilling", pars);
                //Get the dataset from the xCreatePOBillings table which was populated from the stored procedure above:
                PXResultset<xCreatePOBillings> res = PXSelect<xCreatePOBillings,
                                                     Where<xCreatePOBillings.ponbr, Equal<Required<xCreatePOBillings.ponbr>>>
                                                    ,OrderBy<Asc<xCreatePOBillings.ponbr
                                                            ,Asc<xCreatePOBillings.destProject
                                                            ,Asc<xCreatePOBillings.startDate>>>>>.Select(Base, RefNbr);
                //Create the graph for the Project Transactions screen:
                RegisterEntry graph = PXGraph.CreateInstance<RegisterEntry>();
                //Create a new cache object for the header of Project Transactions:
                PMRegister pmreg = new PMRegister();
                pmreg.Module = "PM";
                graph.Document.Insert(pmreg);
                //Define the cache for the Project Transactions screen's grid records:
                PMTran pmtrn;
                foreach (PXResult<xCreatePOBillings> rec in res)
                {
                   ....
                   graph.Actions.PressSave();
             //});

如果可能的话,最好的方法是什么?

当在BLC扩展类中调用静态PXLongOperation.StartOperation方法时,作为第一个参数,它只能接受Base属性而不是this关键字:

PXLongOperation.StartOperation(Base, delegate()
{
   ...
}

最新更新