public RepMaxView(Exercise exerciseToShow) : base("RepMaxView", null) { this._exercise = exerciseToShow; this._share = new RMShare(this); largestRMValue = 0.0; string dbname = "onerm.db"; string documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // This goes to the documents directory for your app string dbPath = Path.Combine (documents, dbname); db = new SQLiteConnection (dbPath); this.LoadRecords(); this._logRoot = new RootElement ("Records"); this._dvc = new DialogViewController (UITableViewStyle.Plain, this._logRoot, false); // load data from list this._logSect = new Section (); foreach (RmLog rm in this._rms) { StringElement recordString = new StringElement (rm.Weight.ToString(), rm.DateLogged.ToShortDateString()); this._logSect.Add(recordString); } this._logRoot.Add(this._logSect); }
private void SetupDb() { string dbname = "onerm.db"; string documents = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // This goes to the documents directory for your app string dbPath = Path.Combine (documents, dbname); db = new SQLiteConnection (dbPath); db.CreateTable<Exercise> (); this.exercises = db.Query<Exercise> ("select * from Exercise"); // populate the database if (exercises.Count () < 3) { Exercise bench = new Exercise { Name = "Bench Press" }; Exercise squat = new Exercise { Name = "Squat" }; Exercise deadlift = new Exercise { Name = "Deadlift" }; db.InsertAll(new[] { bench, squat, deadlift }, false); this.exercises = db.Query<Exercise> ("select * from Exercise"); } }