public void SetDisplayType(SqLiteDisplayType displayType) { var directory = DependencyService.Get <IDirectoryLocation>().Directory; var utilities = new SqLiteUtilities(directory); utilities.OpenConnection(); switch (displayType) { case SqLiteDisplayType.ShowAll: ListItems = utilities.GetAllRecords(); break; case SqLiteDisplayType.ShowContaining1: ListItems = utilities.GetRecordsWith1(); break; default: throw new NotImplementedException("Invalid SqLiteDisplayType"); } utilities.CloseConnection(); }
private void LoadRecords() { SqLiteUtilities utilities; utilities = new SqLiteUtilities(this.dbPath); try { utilities.OpenConnection(); if (displayType == SqLiteDisplayType.ShowAll) { records = utilities.GetAllRecords(); } else { records = utilities.GetRecordsWith1(); } utilities.CloseConnection(); } catch (Exception ex) { // Bah, it's not production code... } }