Azavea.NijPredictivePolicing.AcsAlchemistGui.MainForm.PopulateLists C# (CSharp) Method

PopulateLists() protected method

Populates our 'year', 'state', 'summary level', and 'srid' controls, as well as any other "choose from a set" controls that come up.
protected PopulateLists ( ) : void
return void
        protected void PopulateLists()
        {
            this.cboYear.DataSource = new BindingSource(FormController.Instance.AvailableYears, string.Empty);
            this.cboStates.DataSource = new BindingSource(FormController.Instance.AvailableStates, string.Empty);
            this.cboSummaryLevel.DataSource = new BindingSource(FormController.Instance.AvailableLevels, string.Empty);

            this.cboStates.FormattingEnabled = true;
            this.cboStates.Format += delegate(object sender, ListControlConvertEventArgs e)
            {
                AcsState state = (AcsState)e.Value;
                if (state == AcsState.None) { e.Value = string.Empty; }
                else { e.Value = state.ToString(); }
            };

            this.cboSummaryLevel.FormattingEnabled = true;
            this.cboSummaryLevel.Format += delegate(object sender, ListControlConvertEventArgs e)
            {
                BoundaryLevels level = (BoundaryLevels)e.Value;
                switch (level)
                {
                    case BoundaryLevels.None:
                        e.Value = string.Empty;
                        break;
                    //case BoundaryLevels.counties:
                    //    e.Value = "Counties";
                    //    break;
                    //case BoundaryLevels.county_subdivisions:
                    //    e.Value = "County Subdivisions";
                    //    break;
                    case BoundaryLevels.census_tracts:
                        e.Value = "Census Tracts";
                        break;
                    case BoundaryLevels.census_blockgroups:
                        e.Value = "Census Blockgroups";
                        break;
                }
            };

            //NOTE! We're doing this initialization in "radioSRIDFromList_CheckedChanged",
            //instead of here, this is because it's expensive (we have to read through a whole file)
            //so we're shaving a half-second off the init, and moving it to a spot where the user shouldn't notice.
            //this.cboProjections.DataSource = new BindingSource(FormController.Instance.AvailableProjections, string.Empty);
        }