protected override void OnCreate(Bundle savedInstanceState) { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ScoutingApp.db3"); var db = new SQLiteConnection(dpPath); db.CreateTable <ISTable>(); ISTable tbl = new ISTable(); db.CreateTable <PitsTable>(); PitsTable pits = new PitsTable(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.scores_layout); listviewI = FindViewById <ListView>(Resource.Id.listViewIS); listis = db.Table <ISTable>().OrderBy(item => item.Team).ToList(); ImageViewAdapter adapterI = new ImageViewAdapter(this, listis); listviewI.Adapter = adapterI; }
private void Create_Click(object sender, EventArgs e) { try { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ScoutingApp.db3"); var db = new SQLiteConnection(dpPath); db.CreateTable <PitsTable>(); PitsTable tbl = new PitsTable(); db.CreateTable <ISTable>(); ISTable ist = new ISTable(); ScoresTable st = new ScoresTable(); int finalScore; int firstScore; int secondScore; secondScore = 0; finalScore = 0; firstScore = 0; int number = Int32.Parse(teamNumber.Text); tbl.Team = number; st.Team = number; ist.Team = number; //interesting issue-- it's not storing anything for the ints tbl.RobotWeight = weight.Text; if (mech.Checked) { tbl.Drivetrain = "Mechanum"; firstScore = 1; } if (holo.Checked) { tbl.Drivetrain = "Holonomic"; firstScore = 2; } if (tank.Checked) { tbl.Drivetrain = "Tank"; firstScore = 3; } if (swerve.Checked) { tbl.Drivetrain = "Swerve"; firstScore = 4; } if (slide.Checked) { tbl.Drivetrain = "Slide"; firstScore = 0; } tbl.Notes = notes.Text; db.Insert(tbl); Toast.MakeText(this, "Record Added Successfully", ToastLength.Short).Show(); items = db.Table <PitsTable>().OrderBy(item => item.Team).ToList(); PitsViewAdapter adapterP = new PitsViewAdapter(this, items); listviewP.Adapter = adapterP; int numberW = Int32.Parse(weight.Text); if (numberW < 50) { secondScore = 1; } if (numberW >= 50) { secondScore = 3; } finalScore = firstScore + secondScore; ist.Score = finalScore; st.TotalScore = finalScore; System.Diagnostics.Debug.WriteLine(finalScore); db.Insert(tbl); db.Insert(ist); db.Insert(st); } catch (Exception ex) { Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show(); } }