Exemplo n.º 1
0
        public void Refresh()
        {
            int[] info  = Vocs.GetSetInfo(Mode, Starred, ToIntLevels());
            int   total = Vocs.GetSize();

            Progress0 = (float)info[0] / (float)total;
            Progress1 = (float)info[1] / (float)total;
            Progress2 = (float)info[2] / (float)total;
            Progress3 = (float)info[3] / (float)total;
            Progress4 = (float)info[4] / (float)total;
            Progress5 = (float)info[5] / (float)total;
            if (SelectedSet == 0 && info[0] > 15)
            {
                NumVocs = 15;
            }
            else
            {
                NumVocs = info[SelectedSet];
            }
        }
Exemplo n.º 2
0
        public MenuViewModel(VocDataStore vocs_in, App app)
        {
            App = app;
            Debug.WriteLine("INIT MenuViewModel");
            Vocs        = vocs_in;
            Starred     = Mode = false;
            StarredText = "☆";
            ModeText    = "👀";
            Refresh();

            Train = new Command(() => {
                Debug.WriteLine("start session");
                Session session = new Session(Vocs, NumVocs, Mode, SelectedSet, ToIntLevels(), Starred);
                app.SetSession(session);
                app.SetTrainPage();
            });
            StepperLess = new Command(() => {
                Debug.WriteLine("less");
                if (NumVocs > 1)
                {
                    NumVocs -= 1;
                }
            });

            StepperMore = new Command(() => {
                Debug.WriteLine("more");
                NumVocs += 1;
            });

            StepperHalf = new Command(() => {
                Debug.WriteLine("half");
                NumVocs = (int)Math.Ceiling((double)NumVocs / 2d);
            });

            StepperAll = new Command(() => {
                Debug.WriteLine("all");
                NumVocs = Vocs.GetSetInfo(Mode, Starred, ToIntLevels())[SelectedSet];
            });

            OnSet0 = new Command(() => {
                SelectedSet = 0;
                Refresh();
            });
            OnSet1 = new Command(() => {
                SelectedSet = 1;
                Refresh();
            });
            OnSet2 = new Command(() => {
                SelectedSet = 2;
                Refresh();
            });
            OnSet3 = new Command(() => {
                SelectedSet = 3;
                Refresh();
            });
            OnSet4 = new Command(() => {
                SelectedSet = 4;
                Refresh();
            });
            OnSet5 = new Command(() => {
                SelectedSet = 5;
                Refresh();
            });
        }