Пример #1
0
 public App(string vocPath)
 {
     InitializeComponent();
     //DependencyService.Register<VocDataStore>();
     MainVocs  = new VocDataStore(vocPath);
     MainPage  = MenuPage = new MenuPage(MainVocs, this);
     TrainPage = new TrainPage(this);
 }
Пример #2
0
 public Session(VocDataStore vocs, int num_vocs, bool mode, int set, int[] int_levels, bool starred)
 {
     MainVocs      = vocs;
     Mode          = mode;
     SessionVocIds = MainVocs.CreateSessionIdArray(num_vocs, mode, set, int_levels, starred);
     Index         = 0;
     VocCorr       = new bool[SessionVocIds.Length];
     VocSeen       = new bool[SessionVocIds.Length];
 }
Пример #3
0
        public MenuPage(VocDataStore vocs, App app)
        {
            InitializeComponent();

            BindingContext = menuViewModel = new MenuViewModel(vocs, app);
        }
Пример #4
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();
            });
        }