private void BtnSubmit_Click(object sender, EventArgs e) { // Save Existing List of Birds to .csv File BirdListFile.CreateWorkingBirdListFile(masterBirdList, workingBirdList); // Calculate the total number of different bird species seen, but only birds in the list with Count >= 1 totalSpeciesSeen = workingBirdList.Count(bird => bird.Count >= 1); // Calculate the total number of birds seen // 1) Reset the 'totalBirdsSeen' variable to begin a fresh total count totalBirdsSeen = 0; // 2) Add up the counts for all birds currently in the 'workingBirdList' foreach (var bird in workingBirdList) { totalBirdsSeen += bird.Count; } // Start New Intent to Open New Screen for Submit Form // Check with user to see what type of count report needs to be made. // Options are Field, Feeder, and Count Week // Open the correct report form for the count type selected by the user. FragmentTransaction transaction = FragmentManager.BeginTransaction(); ChooseCountTypePopUp countTypePopUp = new ChooseCountTypePopUp(); countTypePopUp.Show(transaction, "Dialog Fragment"); // Subscribe to events in ChooseCountTypePopUp class countTypePopUp.OnFieldCount += Submit_OnFieldCount; countTypePopUp.OnFeederCount += Submit_OnFeederCount; countTypePopUp.OnCountWeekCount += Submit_OnCountWeekCount; }
protected override void OnStop() { // Save Existing List of Birds to .csv File BirdListFile.CreateWorkingBirdListFile(masterBirdList, workingBirdList); // Deregister Event Handlers //btnAddBird.Click -= AddBird_OnClick; ibClearFilter.Click -= IBClearFilter_OnClick; llAdd.Click -= AddBird_OnClick; base.OnStop(); }
protected override void OnStart() { base.OnStart(); // Load the "Master" Bird List Context appContext = this.ApplicationContext; masterBirdList = BirdListFile.LoadMasterBirdList(appContext); // Load Existing "Working" List of Birds from .csv File workingBirdList = BirdListFile.LoadWorkingBirdListFromFile(); filteredBirdList = workingBirdList; // Update the "Working" bird list from the "Master" bird list //workingBirdList = BirdListFile.UpdateWorkingBirdListFromMaster(masterBirdList, workingBirdList); // Initialize ListView Adapter userBirdListView.Adapter = new row_adapter(this, filteredBirdList); // Register Event Handlers //btnAddBird.Click += AddBird_OnClick; ibClearFilter.Click += IBClearFilter_OnClick; llAdd.Click += AddBird_OnClick; if (workingBirdList.Count == 0) { //btnClear.Enabled = false; llClear.Enabled = false; llClear.SetBackgroundColor(Android.Graphics.Color.LightGray); } else { //btnClear.Enabled = true; llClear.Enabled = true; llClear.SetBackgroundResource(Resource.Drawable.selector); } }