Beispiel #1
0
        public QuestionsStoreSqlLite(IAppRuntimeSettings settings, IOptionsStore optionsStore) : base(settings)
        {
            _optionsStore = optionsStore;
            DB.DropTable <Question>();
            DB.CreateTable <Question>();

            if (!DB.Table <Question>().Any())
            {
                var seeder = new QuestionsSeeder(this);
                seeder.Seed();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.RequestFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.HighScores);

            _settings           = new RuntimeSettingsAndroid();
            _highscore          = new ScoreUserStoreSqlLite(_settings);
            _highscoresListView = FindViewById <ListView>(Resource.Id.HighScoresListView);
            var users = _highscore.GetUsers();
            var names = users.Select(u => u.Name + $"\t ({u.Scores})").ToList();

            _highscoresListView.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, names);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Window.RequestFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Questionary);

            _settings                   = new RuntimeSettingsAndroid();
            _optionsStore               = new OptionsStoreSqlLite(_settings);
            _questionsStore             = new QuestionsStoreSqlLite(_settings, _optionsStore);
            _session                    = new QuestionarySession(_questionsStore, _optionsStore);
            _questionNumberTextView     = FindViewById <TextView>(Resource.Id.QuestionNumberTextView);
            _questionTextView           = FindViewById <TextView>(Resource.Id.QuestionTextView);
            _optionsListView            = FindViewById <ListView>(Resource.Id.OptionsListView);
            _lifesTextView              = FindViewById <TextView>(Resource.Id.LifesTextView);
            _scoresTextView             = FindViewById <TextView>(Resource.Id.ScoresTextView);
            _optionsListView.ChoiceMode = ChoiceMode.Single;
            _optionsListView.ItemClick += OptionsListViewOnItemClick;

            UpdatePontuations();
            PopulateQuestion();
        }
 public SQLiteRepository(IAppRuntimeSettings settings)
 {
     DB = new SQLiteConnection(settings.SQLitePlatform, Path.Combine(settings.DatabasePath, settings.DatabaseFilename));
 }
 public OptionsStoreSqlLite(IAppRuntimeSettings settings) : base(settings)
 {
     DB.DropTable <QuestionOption>();
     DB.CreateTable <QuestionOption>();
 }
 public ScoreUserStoreSqlLite(IAppRuntimeSettings settings) : base(settings)
 {
     DB.CreateTable <ScoreUser>();
 }