Smrf.NodeXL.ExcelTemplate.GroupByVertexAttributeDialog.EnableControls C# (CSharp) Method

EnableControls() protected method

protected EnableControls ( ) : void
return void
    EnableControls()
    {
        AssertValid();

        ExcelColumnFormat eSelectedVertexColumnFormat =
            this.SelectedVertexColumnFormat;

        Boolean bEnableMinimumValueToAddTextBox = false;
        SimpleDateTimeFormat eSimpleDateTimeFormat = SimpleDateTimeFormat.Date;

        switch (eSelectedVertexColumnFormat)
        {
            case ExcelColumnFormat.Other:
            case ExcelColumnFormat.Number:

                bEnableMinimumValueToAddTextBox = true;
                break;

            case ExcelColumnFormat.Date:

                break;

            case ExcelColumnFormat.Time:

                eSimpleDateTimeFormat = SimpleDateTimeFormat.Time;
                break;

            case ExcelColumnFormat.DateAndTime:

                eSimpleDateTimeFormat = SimpleDateTimeFormat.DateAndTime;
                break;

            default:

                Debug.Assert(false);
                break;
        }

        // Note that the txbMinimumValueToAdd TextBox and the
        // dtpMinimumValueToAdd DateTimePicker have the same size and location.
        // Only one is visible at any given time.

        txbMinimumValueToAdd.Enabled = txbMinimumValueToAdd.Visible =
            bEnableMinimumValueToAddTextBox;

        dtpMinimumValueToAdd.Enabled = dtpMinimumValueToAdd.Visible =
            !bEnableMinimumValueToAddTextBox;

        dtpMinimumValueToAdd.SimpleFormat = eSimpleDateTimeFormat;

        btnRemoveSelected.Enabled =
            (lbxMinimumValues.SelectedIndices.Count > 0);

        btnRemoveAll.Enabled = (lbxMinimumValues.Items.Count > 0);

        grpMinimumValues.Enabled = 
            !String.IsNullOrEmpty(cbxVertexColumnName.Text) &&
            (eSelectedVertexColumnFormat != ExcelColumnFormat.Other);
    }