コード例 #1
0
        public MarketSell()
        {
            this.InitializeComponent();
            this.DataContext = this;
            UiGlobalVariables.MarketSellPage = this;

            this.marketSellStrategy = this.GetMarketSellStrategy();
        }
コード例 #2
0
        public void ProcessSellPrice(MarketSellStrategy strategy)
        {
            switch (strategy.SaleType)
            {
            case EMarketSaleType.Recommended:
            {
                if (this.CurrentPrice == null || this.AveragePrice == null)
                {
                    this.SellPrice = null;
                }
                else if (this.CurrentPrice > this.AveragePrice)
                {
                    this.SellPrice = this.CurrentPrice;
                }
                else
                {
                    this.SellPrice = this.AveragePrice;
                }

                break;
            }

            case EMarketSaleType.LowerThanCurrent:
            {
                if (this.CurrentPrice == null)
                {
                    this.SellPrice = null;
                }
                else
                {
                    this.SellPrice = this.CurrentPrice + strategy.ChangeValue;
                }

                break;
            }

            case EMarketSaleType.LowerThanAverage:
            {
                if (this.AveragePrice == null)
                {
                    this.SellPrice = null;
                }
                else
                {
                    this.SellPrice = this.AveragePrice + strategy.ChangeValue;
                }

                break;
            }

            default:
            {
                this.SellPrice = null;
                return;
            }
            }
        }