B2017-270 only enable the Steps Section and/or Word Section radio buttons if the format has them defined.
This commit is contained in:
parent
8b177644f7
commit
bd167bbb13
@ -59,8 +59,12 @@ namespace VEPROMS
|
|||||||
_MyStepTabRibbon.Name = "displayTabRibbon1";
|
_MyStepTabRibbon.Name = "displayTabRibbon1";
|
||||||
_MyStepTabRibbon.Visible = false;
|
_MyStepTabRibbon.Visible = false;
|
||||||
|
|
||||||
// if creating a new section, enable the StepSect and WordSect radio buttons
|
// B2017-272 disable/enable the Steps and Word radio buttons based on the section types defined in the format
|
||||||
rbStepSect.Enabled = rbWordSect.Enabled = !(ii.HasWordContent || ii.HasStepContent);
|
// and the type of an existing section or if we are creating a new section.
|
||||||
|
// Move the check of creating a new section into CheckAvailableSectionTypes()
|
||||||
|
CheckAvaibleSectionTypes();
|
||||||
|
//// if creating a new section, enable the StepSect and WordSect radio buttons
|
||||||
|
//rbStepSect.Enabled = rbWordSect.Enabled = !(ii.HasWordContent || ii.HasStepContent);
|
||||||
|
|
||||||
// if this is an auto table of contents (mydocstyle == null if new section, so must check for that first)
|
// if this is an auto table of contents (mydocstyle == null if new section, so must check for that first)
|
||||||
if (ii.IsAutoTOCSection)
|
if (ii.IsAutoTOCSection)
|
||||||
@ -78,6 +82,27 @@ namespace VEPROMS
|
|||||||
if (ii.HasWordContent) _isStepSection = false;
|
if (ii.HasWordContent) _isStepSection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// B2017-272 disable/enable the Steps and Word section radio buttons based on the section types defined in the format
|
||||||
|
// and the type of an existing section or if we are creating a new section
|
||||||
|
private void CheckAvaibleSectionTypes()
|
||||||
|
{
|
||||||
|
PlantFormat pf = (ppCmbxFormat.SelectedIndex != -1) ? FormatInfoList.SortedFormatInfoList[ppCmbxFormat.SelectedIndex].PlantFormat : (_SectionConfig.MyFormat != null) ? _SectionConfig.MyFormat.PlantFormat : _SectionConfig.MyDefaultFormat.PlantFormat;
|
||||||
|
ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
|
||||||
|
// if creating a new section, enable the StepSect and WordSect radio buttons
|
||||||
|
bool isNewSection = !(ii.HasWordContent || ii.HasStepContent);
|
||||||
|
int numStepSects = 0;
|
||||||
|
int numWordSects = 0;
|
||||||
|
foreach (DocStyle nds in pf.DocStyles.DocStyleListActive)
|
||||||
|
{
|
||||||
|
if (nds.IsStepSection)
|
||||||
|
numStepSects++;
|
||||||
|
else
|
||||||
|
numWordSects++;
|
||||||
|
}
|
||||||
|
rbStepSect.Enabled = (numStepSects > 0 && (isNewSection || ii.IsStepSection)); // there are step section types and current section is a step section or creating new section
|
||||||
|
rbWordSect.Enabled = (numWordSects > 0 && (isNewSection || !ii.IsStepSection)); // there are word section types and current section is a word section or creating new section
|
||||||
|
}
|
||||||
|
|
||||||
private void btnSectPropOK_Click(object sender, EventArgs e)
|
private void btnSectPropOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
sectionConfigBindingSource.EndEdit();
|
sectionConfigBindingSource.EndEdit();
|
||||||
@ -88,6 +113,7 @@ namespace VEPROMS
|
|||||||
Settings.Default.ShowDefaultSectionProp = ppCbShwDefSettings.Checked;
|
Settings.Default.ShowDefaultSectionProp = ppCbShwDefSettings.Checked;
|
||||||
Settings.Default.Save();
|
Settings.Default.Save();
|
||||||
// save the type based on selection.
|
// save the type based on selection.
|
||||||
|
if (ppCmbxStyleSectionType.Items.Count > 0) // B2017-270 user click on OK button but format does not have section style for this section type
|
||||||
_SectionConfig.MySection.MyContent.Type = ((DocStyle)ppCmbxStyleSectionType.SelectedItem).Index + 10000;
|
_SectionConfig.MySection.MyContent.Type = ((DocStyle)ppCmbxStyleSectionType.SelectedItem).Index + 10000;
|
||||||
|
|
||||||
// save any changes to checkoffs. The bindings were added to the designer, but the 'save' was
|
// save any changes to checkoffs. The bindings were added to the designer, but the 'save' was
|
||||||
@ -628,6 +654,7 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ppCmbxStyleSectionType.DataSource = newDocStyles;
|
ppCmbxStyleSectionType.DataSource = newDocStyles;
|
||||||
|
if (newDocStyles.Count > 0)
|
||||||
ppCmbxStyleSectionType.SelectedIndex = selindx;
|
ppCmbxStyleSectionType.SelectedIndex = selindx;
|
||||||
ppCmbxStyleSectionType.Refresh();
|
ppCmbxStyleSectionType.Refresh();
|
||||||
ppBtnConvertToDocX.Visible = false;// Set the Convert To DocX button to invisible by default
|
ppBtnConvertToDocX.Visible = false;// Set the Convert To DocX button to invisible by default
|
||||||
@ -745,6 +772,9 @@ namespace VEPROMS
|
|||||||
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||||
//if (!didDefault) SetupPpCmbxSectionType();
|
//if (!didDefault) SetupPpCmbxSectionType();
|
||||||
SetupPpCmbxSectionType();
|
SetupPpCmbxSectionType();
|
||||||
|
// B2017-272 disable/enable the Steps and Word radio buttons based on the section types defined in the format
|
||||||
|
// and the type of an existing section or if we are creating a new section.
|
||||||
|
CheckAvaibleSectionTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is used when the user selects different format for a give section.
|
// This function is used when the user selects different format for a give section.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user