Exemplo n.º 1
0
        public SelectedViewModel(Xamarin.Forms.Page _element, Action Recalc, Action RecalcPaidPrice, Xamarin.Forms.StackLayout spSelectedList, Xamarin.Forms.ControlTemplate ctSelectedControlTemplate, Xamarin.Forms.StackLayout spRequestList, Xamarin.Forms.ControlTemplate ctRequestControlTemplate, Xamarin.Forms.StackLayout spBalanceList, Xamarin.Forms.ControlTemplate ctBalanceControlTemplate)
        {
            this._element = _element;


            this._spSelectedList            = spSelectedList;
            this._ctSelectedControlTemplate = ctSelectedControlTemplate;

            // 列表变化时重置一下编号
            CurrentSelectedList.CollectionChanged += (sender, args) =>
            {
                ResetNo();
            };
            RequestView     = new RequestViewModel(null, this, spRequestList, ctRequestControlTemplate);
            ChangeCountView = new ChangeCountViewModel(null, this, Recalc);
            ChangePriceView = new ChangePriceViewModel(null, this, Recalc);


            ChangePaidPriceView = new ChangePaidPriceViewModel(null, RecalcPaidPrice, spBalanceList, ctBalanceControlTemplate);
            ChangeTimeView      = new ChangeTimeViewModel(null, this, Recalc);



            foreach (var item in Res.Instance.AllLangList.OrderBy(x => x.Value.LangOrder))
            {
                Dict dict = new Dict()
                {
                    Name = Res.Instance.GetString("LangName", item.Value.Culture), Value = item.Value.LangIndex
                };
                AllLang.Add(dict);
            }
        }
Exemplo n.º 2
0
        public SettingViewModel(Page _element)
        {
            this._element = _element;


            foreach (var item in Res.Instance.AllLangList.OrderBy(x => x.Value.LangOrder))
            {
                Dict dict = new Dict()
                {
                    Name = Res.Instance.GetString("LangName", item.Value.Culture), Value = item.Value.LangIndex
                };
                AllLang.Add(dict);
            }



            AllMode.Add(new Dict()
            {
                Name = "Light", Value = "0"
            });
            AllMode.Add(new Dict()
            {
                Name = "Dark", Value = "1"
            });
        }
Exemplo n.º 3
0
 private void bindLangs()
 {
     AllLang.Sort();
     foreach (string lang in AllLang)
     {
         clbLangs.Items.Add(lang);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            ServerIP = Resources.Instance.SERVER_ADDRESS;



            SelectedLang = AllLang.Where(x => int.Parse(x.Value.ToString()) == Res.Instance.CurrentLangIndex).FirstOrDefault();
            SelectedMode = AllMode[(int)Theme.Instance.CurrentTheme];
        }
Exemplo n.º 5
0
        public MainListViewModel(Page _element, Xamarin.Forms.StackLayout spList, Xamarin.Forms.ControlTemplate ctControlTemplate)
        {
            this._element = _element;

            this._spList            = spList;
            this._ctControlTemplate = ctControlTemplate;

            // 菜单列表填充一下



            _addInnerBill = new MainListModel()
            {
                Name = "InnerBill", GoCommand = this.GoCommand
            };
            AddList(_addInnerBill);
            _addOuterBill = new MainListModel()
            {
                Name = "OuterBill", GoCommand = this.GoCommand
            };
            AddList(_addOuterBill);
            _importManager = new MainListModel()
            {
                Name = "ExpenditureManager", GoCommand = this.GoCommand
            };
            AddList(_importManager);
            _financeLog = new MainListModel()
            {
                Name = "FinanceLog", GoCommand = this.GoCommand
            };
            AddList(_financeLog);
            _openCashDrawer = new MainListModel()
            {
                Name = "OpenCashDrawer", GoCommand = this.GoCommand
            };
            AddList(_openCashDrawer);
            _balanceManager = new MainListModel()
            {
                Name = "BalanceManager", GoCommand = this.GoCommand
            };
            AddList(_balanceManager);
            _statistic = new MainListModel()
            {
                Name = "Statistic", GoCommand = this.GoCommand
            };
            AddList(_statistic);
            //AddList(new MainListModel() { Name = "ChangeLanguage", GoCommand = this.GoCommand });
            AddList(new MainListModel()
            {
                Name = "ChangePassword", GoCommand = this.GoCommand
            });
            AddList(new MainListModel()
            {
                Name = "About", GoCommand = this.GoCommand
            });
            AddList(new MainListModel()
            {
                Name = "Exit", GoCommand = this.GoCommand
            });


            Notification.Instance.NotificationLanguage += (obj, value, args) => { Device.BeginInvokeOnMainThread(() => { LoginRefresh(); }); };
            Notification.Instance.NotificationLogin    += (obj, value, args) => { Device.BeginInvokeOnMainThread(() => { LoginRefresh(); }); };

            // 设置语言
            LoginRefresh();



            foreach (var item in Res.Instance.AllLangList.OrderBy(x => x.Value.LangOrder))
            {
                Dict dict = new Dict()
                {
                    Name = Res.Instance.GetString("LangName", item.Value.Culture), Value = item.Value.LangIndex
                };
                AllLang.Add(dict);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init()
 {
     SelectedLang = AllLang.Where(x => int.Parse(x.Value.ToString()) == Res.Instance.CurrentLangIndex).FirstOrDefault();
     _isInit      = true;
 }