protected internal virtual void HintJobExecutor(JobEntity job) { JobExecutor jobExecutor = context.Impl.Context.ProcessEngineConfiguration.JobExecutor; if (!jobExecutor.IsActive) { return; } JobExecutorContext jobExecutorContext = context.Impl.Context.JobExecutorContext; ITransactionListener transactionListener = null; if (!job.Suspended && job.Exclusive && jobExecutorContext != null && jobExecutorContext.ExecutingExclusiveJob && AreInSameProcessInstance(job, jobExecutorContext.CurrentJob)) { // lock job & add to the queue of the current processor DateTime currentTime = ClockUtil.CurrentTime; job.LockExpirationTime = new DateTime(currentTime.Ticks + jobExecutor.LockTimeInMillis); job.LockOwner = jobExecutor.LockOwner; transactionListener = new ExclusiveJobAddedNotification(job.Id, jobExecutorContext); } else { // notify job executor: transactionListener = new MessageAddedNotification(jobExecutor); } context.Impl.Context.CommandContext.TransactionContext.AddTransactionListener(TransactionJavaStatus.Committed, transactionListener); }
public bool InterceptActionPress() { TransactionBox boxComponent = null; bool intercepted = false; ITransactionListener listener = null; if (boxComponents != null) { for (int i = 0; i < boxComponents.Length; i++) { boxComponent = boxComponents[i]; if (boxComponent != null) { if (boxComponent.ReactToActionPress()) { intercepted = true; listener = boxSourceListeners[i]; if (listener != null) { listener.AdvanceTransaction(); } } } } } return(intercepted); }
//6.5 public virtual void AddTransactionListener(TransactionJavaStatus transactionState, ITransactionListener transactionListener) { if (StateTransactionListeners == null) { StateTransactionListeners = new Dictionary <TransactionJavaStatus, IList <ITransactionListener> >(); } var transactionListeners = StateTransactionListeners.ContainsKey(transactionState) ? StateTransactionListeners[transactionState] : null; if (transactionListeners == null) { transactionListeners = new List <ITransactionListener>(); StateTransactionListeners[transactionState] = transactionListeners; } transactionListeners.Add(transactionListener); }
//This method is called when a player clicks on the IAP Promo //A developer will add the hooks to their purchasing system here to complete the purchase public void Purchase(string productID, ITransactionListener listener, IDictionary <string, object> extras) { // When ThirdPartyPurchasing succeeds: listener.OnTransactionComplete(new TransactionDetails { currency = "USD", price = 1.99m, productId = "100bronzeCoins", transactionId = "", //Transaction ID from successful puchase receipt = "{\n\"data\": \"{\\\"Store\\\":\\\"fake\\\",\\\"TransactionID\\\":\\\"ce7bb1ca-bd34-4ffb-bdee-83d2784336d8\\\",\\\"Payload\\\":\\\"{ \\\\\\\"this\\\\\\\": \\\\\\\"is a fake receipt\\\\\\\" }\\\"}\"\n}" }); //When ThirdPartyPurchasing fails: //Fill in appropriate details from Purchasing system listener.OnTransactionError(new TransactionErrorDetails { transactionError = TransactionError.NetworkError, exceptionMessage = "Test exception message", store = Store.GooglePlay, storeSpecificErrorCode = "Example: Google Play lost connection", }); }
/// <summary> /// /// </summary> /// <param name="transactionState"></param> /// <param name="transactionListener"></param> public virtual void AddTransactionListener(TransactionState transactionState, ITransactionListener transactionListener) { if (stateTransactionListeners == null) { stateTransactionListeners = new Dictionary <TransactionState, IList <ITransactionListener> >(); } IList <ITransactionListener> transactionListeners = stateTransactionListeners[transactionState]; if (transactionListeners == null) { transactionListeners = new List <ITransactionListener>(); stateTransactionListeners[transactionState] = transactionListeners; } transactionListeners.Add(transactionListener); }
protected internal virtual void AddTransactionListener(ActivitiListener activitiListener, ITransactionListener transactionListener) { ITransactionContext transactionContext = Context.TransactionContext; if (TransactionDependentExecutionListenerFields.ON_TRANSACTION_BEFORE_COMMIT.Equals(activitiListener.OnTransaction)) { transactionContext.AddTransactionListener(TransactionState.COMMITTING, transactionListener); } else if (TransactionDependentExecutionListenerFields.ON_TRANSACTION_COMMITTED.Equals(activitiListener.OnTransaction)) { transactionContext.AddTransactionListener(TransactionState.COMMITTED, transactionListener); } else if (TransactionDependentExecutionListenerFields.ON_TRANSACTION_ROLLED_BACK.Equals(activitiListener.OnTransaction)) { transactionContext.AddTransactionListener(TransactionState.ROLLED_BACK, transactionListener); } }
public virtual void AddTransactionListener(TransactionJavaStatus transactionState, ITransactionListener transactionListener) { throw new NotImplementedException(); //Transaction transaction = Transaction; //CommandContext commandContext = Context.CommandContext; //try //{ // transaction.RegisterSynchronization(new TransactionStateSynchronization(transactionState, transactionListener, commandContext)); //} //catch (Exception e) //{ // throw Log.ExceptionWhileInteractingWithTransaction("registering synchronization", e); //} }
public virtual void AddTransactionListener(ITransactionListener listener) { _transactionListeners = new List4(_transactionListeners, listener); }
public bool CreateTransaction(GameObject sourceObject, ITransactionListener sourceListener, float sourceDistance, int maxValue, int currentValue, int currentValueStep, bool investing, bool tryAbove, GameObject wsGaugeModel) { GameObject boxObject = null; TransactionBox boxComponent = null; Vector2 boxDimensions = Vector2.zero; Vector2 boxOffset = Vector2.zero; Vector3 boxPosition = Vector3.zero; bool boxPositionValid = false; GameObject boxTailObject = null; SpriteRenderer boxTailRenderer = null; Vector2 tailOffset = Vector2.zero; /*halmeida - if there is already a transaction with the sourceObject, we remove it immediately, before * creating a new one with the specified values.*/ RemoveTransaction(sourceObject); if ((transactionBoxParent != null) && (symbolDatabase != null) && (sourceObject != null) && (sourceListener != null)) { boxObject = new GameObject("TransactionBox"); boxComponent = boxObject.AddComponent <TransactionBox>(); boxComponent.SetBoxLimits(boxLimits.x, boxLimits.y); boxComponent.SetEssentials(symbolDatabase, bodySprite, "TO REPLACE", 0f, TextBox.TextAlignment.AlignMiddle, false, BOX_OPENING_SPEED); boxComponent.SetOrnamentGauge(wsGaugeModel); boxComponent.SetParameters(maxValue, currentValue, currentValueStep, investing); boxTailObject = new GameObject("TransactionBoxTail"); boxTailRenderer = boxTailObject.AddComponent <SpriteRenderer>(); boxTailRenderer.sprite = tailSprite; boxComponent.Build(); boxDimensions = boxComponent.GetBoxWorldDimensions(); boxPosition = GetBoxPositionForSource(sourceObject, sourceDistance, boxDimensions, tryAbove, ref boxPositionValid, ref tailOffset); if (boxPositionValid) { boxObject.transform.SetParent(transactionBoxParent.transform, false); /*halmeida - since the transactionBoxParent is at x = 0 and y = 0, I can use the local position of its * children as if it was their position. Changing just the local position is faster.*/ boxObject.transform.localPosition = boxPosition; boxTailObject.transform.SetParent(boxObject.transform, false); boxTailObject.transform.localPosition = new Vector3(tailOffset.x, tailOffset.y, boxComponent.GetBoxToTextDepth()); if (tailOffset.y > 0f) { boxTailObject.transform.rotation = Quaternion.Euler(0f, 0f, 180f); } boxComponent.Open(); UsefulFunctions.IncreaseArray <GameObject>(ref boxObjects, boxObject); UsefulFunctions.IncreaseArray <TransactionBox>(ref boxComponents, boxComponent); UsefulFunctions.IncreaseArray <GameObject>(ref boxSourceObjects, sourceObject); UsefulFunctions.IncreaseArray <ITransactionListener>(ref boxSourceListeners, sourceListener); UsefulFunctions.IncreaseArray <float>(ref boxSourceDistances, sourceDistance); UsefulFunctions.IncreaseArray <bool>(ref boxTryAboves, tryAbove); UsefulFunctions.IncreaseArray <GameObject>(ref boxTailObjects, boxTailObject); UsefulFunctions.IncreaseArray <SpriteRenderer>(ref boxTailRenderers, boxTailRenderer); return(true); } boxComponent.Clear(); GameObject.Destroy(boxObject); GameObject.Destroy(boxTailObject); } return(false); }
public virtual void AddTransactionListener(TransactionState transactionState, ITransactionListener transactionListener) { Transaction transaction = Transaction; ICommandContext commandContext = Context.CommandContext; try { transaction.RegisterSynchronization(new TransactionStateSynchronization(transactionState, transactionListener, commandContext)); } catch (System.InvalidOperationException e) { throw new ActivitiException("IllegalStateException while registering synchronization ", e); } catch (RollbackException e) { throw new ActivitiException("RollbackException while registering synchronization ", e); } catch (SystemException e) { throw new ActivitiException("SystemException while registering synchronization ", e); } }
public TransactionStateSynchronization(TransactionState transactionState, ITransactionListener transactionListener, ICommandContext commandContext) { this.transactionState = transactionState; this.transactionListener = transactionListener; this.commandContext = commandContext; }