Example #1
0
 private void OnLogUpdated(ConsoleLogEventHandler inEvent, string inMessage)
 {
     if (inEvent != null)
     {
         inEvent(inMessage);
     }
 }
Example #2
0
        Action IRunnerRepository.FindRunner(IParseResult inResult, ConsoleLogEventHandler inEvent)
        {
            Action <IParseResult, ConsoleLogEventHandler> act;

            if (mLookups.TryGetValue(inResult.GetType(), out act))
            {
                return(() => {
                    act(inResult, inEvent);
                });
            }

            throw new NotSupportedException(inResult.GetType().ToString());
        }
Example #3
0
 private void OnLogUpdated(ConsoleLogEventHandler inEvent, string inMessage)
 {
     if (inEvent != null) {
         inEvent(inMessage);
     }
 }
Example #4
0
        private void NotifyPurchaseLogs(int inPosition, ItemRackState inState, ConsoleLogEventHandler inEvent)
        {
            switch (inState) {
            case ItemRackState.CanPurchase:
                var item = this.PurchaseContext.Purchase(inPosition);

                this.OnLogUpdated(inEvent, string.Format("Purchased !! [{0}]", item.Name));
                break;
            case ItemRackState.RackNotExist:
                this.OnLogUpdated(inEvent, "Item is not placed.");
                break;
            case ItemRackState.MissingChange:
                this.OnLogUpdated(inEvent, "Sorry, can not purchase this item because of lack of changes.");
                break;
            case ItemRackState.Soldout:
                this.OnLogUpdated(inEvent, "Sorry, this item has been sold out.");
                break;
            case ItemRackState.CanNotPurchase:
                var amount = this.PurchaseContext.ReceivedTotal;
                var price = this.PurchaseContext.Racks[inPosition].Item.Price;

                this.OnLogUpdated(inEvent, string.Format(
                    "Money enough to purchase is not inserted. (left: {0})", price-amount
                    ));
                break;
            }
        }
Example #5
0
        Action IRunnerRepository.FindRunner(IParseResult inResult, ConsoleLogEventHandler inEvent)
        {
            Action<IParseResult, ConsoleLogEventHandler> act;
            if (mLookups.TryGetValue(inResult.GetType(), out act)) {
                return () => {
                    act(inResult, inEvent);
                };
            }

            throw new NotSupportedException(inResult.GetType().ToString());
        }