Changed SubSection.Edit Section Config property to correctly be defaulted to "No"

Base MyConfig on the type of item (Procedure, Section or Step)
Keep the code from crashing iff the user selects a result in the search window that points to non-editable text
This commit is contained in:
Rich 2015-02-16 20:22:57 +00:00
parent 469a8da0ba
commit 3e413b0f17
3 changed files with 43 additions and 11 deletions

View File

@ -101,11 +101,11 @@ namespace VEPROMS.CSLA.Library
_Xp = new XMLProperties(xml);
if (_SectionInfo.ActiveParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
}
public SectionConfig(string xml)
{
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
//public SectionConfig(string xml)
//{
// if (xml == string.Empty) xml = "<Config/>";
// _Xp = new XMLProperties(xml);
//}
public SectionConfig()
{
_Xp = new XMLProperties();
@ -761,7 +761,7 @@ namespace VEPROMS.CSLA.Library
#region SubSectionCategory // from sequence number in 16-bit database.
[Category("SubSection")]
//PROPGRID: Hide SubSection Edit
[Browsable(false)]
[Browsable(true)]
[DisplayName("SubSection Edit")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection Edit")]
@ -779,20 +779,48 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("SubSection_Edit");
}
}
[Category("SubSection")]
//PROPGRID: Hide SubSection Edit
[Browsable(true)]
[DisplayName("DefaultSubSection Edit")]
[RefreshProperties(RefreshProperties.All)]
[Description("DefaultSubSection Edit")]
public string DefaultSubSectionEdit
{
get
{
if (_SectionInfo != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps.Count > 0)
//if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps != null && _SectionInfo.Steps.Count > 0)
if (_SectionInfo != null && _SectionInfo.Sections != null && _SectionInfo.Sections.Count > 0)
return "N";
if (_Section != null && HasSubsections)
return "N";
//if (_Section != null && _Section.MyContent.cont .Sections.Count > 0 && _Section.Steps.Count > 0)
// return "N";
return "Y";
}
}
private bool HasSubsections
{
get
{
//int result = 0;
foreach (ContentPart cp in _Section.MyContent.ContentParts)
{
if (cp.FromType == 2)
return true;
//if (cp.FromType == 2) result += 1;
//if (cp.FromType == 6) result += 2;
//if (result == 3)
//{
// return true;
//}
}
return false;
}
}
[Category("SubSection")]
//PROPGRID: Hide Subsection AutoIndent
[Browsable(false)]
[Browsable(true)]
[DisplayName("SubSection AutoIndent")]
[RefreshProperties(RefreshProperties.All)]
[Description("SubSection AutoIndent")]

View File

@ -3017,13 +3017,16 @@ namespace VEPROMS.CSLA.Library
switch (MyContent.Type / 10000)
{
case 0:
_MyConfig = new ProcedureConfig(MyContent.Config);
//_MyConfig = new ProcedureConfig(MyContent.Config);
_MyConfig = new ProcedureConfig(this as ProcedureInfo ?? ProcedureInfo.Get(ItemID));
break;
case 1:
_MyConfig = new SectionConfig(MyContent.Config);
//_MyConfig = new SectionConfig(MyContent.Config);
_MyConfig = new SectionConfig(this as SectionInfo ?? SectionInfo.Get(ItemID));
break;
case 2:
_MyConfig = new StepConfig(MyContent.Config);
//_MyConfig = new StepConfig(MyContent.Config);
_MyConfig = new StepConfig(this as StepInfo ?? StepInfo.Get(ItemID));
break;
}
}

View File

@ -90,6 +90,7 @@ namespace Volian.Controls.Library
}
public void FindSearchString()
{
if (SelectedEditItem == null) return;// Uneditable Data
if (SelectedEditItem.MyItemInfo.IsTable)
{
// if not ro table, just make the mysteprtb active.