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

SmartToggler() public method

Perform all our form enable/disables in one place, so the form is always in a consistent state (this also makes this much easier to maintain)
public SmartToggler ( ) : void
return void
        public void SmartToggler()
        {
            /** TODO: Anything that enables/disables */

            //if (radioDefaultSRID.Checked) { }     //nothing to do here

            //projection list
            cboProjections.Enabled = (radioSRIDFromList.Checked && !backgroundWorker1.IsBusy);

            //projection file controls
            txtPrjFilePath.Enabled = (radioSRIDFile.Checked && !backgroundWorker1.IsBusy);
            btnBrowsePrjFile.Enabled = (radioSRIDFile.Checked && !backgroundWorker1.IsBusy);

            {
                bool enabledIfIdle = !backgroundWorker1.IsBusy;

                this.btnShapefile.Enabled = enabledIfIdle;
                this.btnFishnet.Enabled = enabledIfIdle;

                this.cboYear.Enabled = enabledIfIdle;
                this.cboStates.Enabled = enabledIfIdle;
                this.cboSummaryLevel.Enabled = enabledIfIdle;
                this.txtVariableFilePath.Enabled = enabledIfIdle;
                this.txtOutputDirectory.Enabled = enabledIfIdle;
                this.txtWorkingDirectory.Enabled = enabledIfIdle;

                this.radioDefaultSRID.Enabled = enabledIfIdle;
                this.radioSRIDFromList.Enabled = enabledIfIdle;
                this.radioSRIDFile.Enabled = enabledIfIdle;

                this.txtJobName.Enabled = enabledIfIdle;

                this.chkReplaceJob.Enabled = enabledIfIdle;
                this.txtFishnetCellSize.Enabled = enabledIfIdle;
                this.txtFishnetEnvelopeFilePath.Enabled = enabledIfIdle;
                this.cboIncludeEmptyGeom.Enabled = enabledIfIdle;
                this.txtBoundaryShpFilePath.Enabled = enabledIfIdle;
                this.chkPreserveJamValues.Enabled = enabledIfIdle;
                this.chkStripExtraGeoID.Enabled = enabledIfIdle;

                this.btnBrowseVariableFile.Enabled = enabledIfIdle;
                this.btnBrowseOutputFolder.Enabled = enabledIfIdle;
                this.btnBrowseWorking.Enabled = enabledIfIdle;

                this.btnBrowseBoundaryShpFile.Enabled = enabledIfIdle;
                this.btnBrowseFishnetEnvelopeFile.Enabled = enabledIfIdle;
            }
        }