Ejemplo n.º 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init(bool RefreshAll = true)
        {
            ChangePrice = "0";
            Remark      = "";


            RefreshBalanceLists();

            if (RefreshAll)
            {
                BalanceMode = false;
                Mode        = 1;



                if (OldBalanceList.Count > 0)
                {
                    SelectedOldBalance = OldBalanceList.FirstOrDefault();
                }

                if (NewBalanceList.Count > 0)
                {
                    SelectedNewBalance = NewBalanceList.FirstOrDefault();
                }
            }
        }
Ejemplo n.º 2
0
        private void RefreshBalanceLists()
        {
            long oldBalanceId = -1;
            long newBalanceId = -1;


            if (null != SelectedOldBalance)
            {
                oldBalanceId = (SelectedOldBalance.Value as Balance).BalanceId;
            }

            if (null != SelectedNewBalance)
            {
                newBalanceId = (SelectedNewBalance.Value as Balance).BalanceId;
            }

            OldBalanceList.Clear();
            NewBalanceList.Clear();



            if (Res.Instance.MainLangIndex == 0)
            {
                foreach (var item in BalanceList.OrderByDescending(x => x.Order).ThenByDescending(x => x.BalanceId))
                {
                    OldBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName0 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                    NewBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName0 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                }
            }
            else if (Res.Instance.MainLangIndex == 1)
            {
                foreach (var item in BalanceList.OrderByDescending(x => x.Order).ThenByDescending(x => x.BalanceId))
                {
                    OldBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName1 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                    NewBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName1 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                }
            }
            else if (Res.Instance.MainLangIndex == 2)
            {
                foreach (var item in BalanceList.OrderByDescending(x => x.Order).ThenByDescending(x => x.BalanceId))
                {
                    OldBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName2 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                    NewBalanceList.Add(new Dict()
                    {
                        Name = item.BalanceName2 + "  " + Resources.Instance.PrintInfo.PriceSymbol + item.BalancePrice, Value = item
                    });
                }
            }

            if (oldBalanceId != -1)
            {
                SelectedOldBalance = OldBalanceList.FirstOrDefault(x => (x.Value as Balance).BalanceId == oldBalanceId);
            }
            if (newBalanceId != -1)
            {
                SelectedNewBalance = NewBalanceList.FirstOrDefault(x => (x.Value as Balance).BalanceId == newBalanceId);
            }
        }