Esempio n. 1
0
        private void UpdateButtonOkStatus()
        {
            string message = string.Empty;

            // name
            if (string.IsNullOrEmpty(tbName.Text))
            {
                message = Resources.ID_FIELDNAMEEMPTY;
            }
            // name validity
            else if (!_document.IsValidNewAnalysisName(tbName.Text, _analysis))
            {
                message = string.Format(Resources.ID_INVALIDNAME, tbName.Text);
            }
            // description
            else if (string.IsNullOrEmpty(tbDescription.Text))
            {
                message = Resources.ID_FIELDDESCRIPTIONEMPTY;
            }
            // orientation
            else if (!AllowVerticalX && !AllowVerticalY && !AllowVerticalZ)
            {
                message = Resources.ID_DEFINEATLEASTONEVERTICALAXIS;
            }
            // maximum weight reached with only one box ?
            else if (UseMaximumCaseWeight && (MaximumCaseWeight < SelectedCase.Weight + SelectedBox.Weight))
            {
                message = string.Format(Resources.ID_MAXIMUMCASEWEIGHTSHOULDEXCEED, SelectedCase.Weight + SelectedBox.Weight);
            }
            // does box fits in case ?
            else if (!SelectedBox.FitsIn(SelectedCase, AllowVerticalX, AllowVerticalY, AllowVerticalZ))
            {
                message = string.Format(Resources.ID_BOXDOESNOTFITINCASE, SelectedBox.Name, SelectedCase.Name);
            }
            // update nud boxes according to checkbox
            nudMaximumCaseWeight.Enabled    = checkBoxMaximumCaseWeight.Checked;
            nudMaximumNumberOfBoxes.Enabled = checkBoxMaximumNumberOfBoxes.Checked;
            //---
            // button OK
            bnOk.Enabled = string.IsNullOrEmpty(message);
            // status bar
            toolStripStatusLabelDef.ForeColor = string.IsNullOrEmpty(message) ? Color.Black : Color.Red;
            toolStripStatusLabelDef.Text      = string.IsNullOrEmpty(message) ? Resources.ID_READY : message;
        }