New Enhanced Document Properties

Fixed Find and Replace logic to keep it from getting into an infinite loop
Used new CSLA code to hanndle deletion of procedures with external transitions
New Enhanced Document properties
This commit is contained in:
Rich
2015-10-27 13:34:33 +00:00
parent e22458bd1a
commit 58e58083c2
7 changed files with 242 additions and 197 deletions

View File

@@ -20,6 +20,13 @@ namespace Volian.Controls.Library
Showing = 8,
Done = 16
}
public enum EnhancedAddTypes : int
{
No = 0,
Before = 1,
After = 2,
Child = 3
}
#endregion
public partial class RTBItem : EditItem
{
@@ -219,6 +226,18 @@ namespace Volian.Controls.Library
}
set { _CheckOffMargin = value; }
}
private EnhancedAddTypes _EnhAddType = EnhancedAddTypes.No;
public EnhancedAddTypes EnhAddType
{
get { return _EnhAddType; }
set { _EnhAddType = value; }
}
private ItemInfo _EnhAddFromItemInfo = null;
public ItemInfo EnhAddFromItemInfo
{
get { return _EnhAddFromItemInfo; }
set { _EnhAddFromItemInfo = value; }
}
#endregion
#region Constructors
public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand)
@@ -422,35 +441,13 @@ namespace Volian.Controls.Library
{
_ProcessingEnter = true;
DisplayTabItem dti = null;
// Syncronize any open Enhanced Documents
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
if (sc.Step_SourceToBackground != null && sc.Step_SourceToDeviation != null)
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
{
ItemInfo bii = ItemInfo.Get(int.Parse(sc.Step_SourceToBackground));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(bii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(bii));
// dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(bii);
ItemInfo dii = ItemInfo.Get(int.Parse(sc.Step_SourceToDeviation));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(dii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(dii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(dii);
if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
}
else if (sc.Step_SourceToBackground != null && sc.Step_SourceToDeviation == null)
{
ItemInfo bii = ItemInfo.Get(int.Parse(sc.Step_SourceToBackground));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(bii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(bii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(bii);
if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
}
else if (sc.Step_SourceToBackground == null && sc.Step_SourceToDeviation != null)
{
ItemInfo dii = ItemInfo.Get(int.Parse(sc.Step_SourceToDeviation));
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(dii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(dii));
//dti = MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(dii);
ItemInfo ii = ItemInfo.Get(ed.ItemID);
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.IsItemInfoProcedureOpen(ii))
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnOpenEnhancedDocument(new ItemSelectedChangedEventArgs(ii));
if (dti != null)
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
}
@@ -745,8 +742,41 @@ namespace Volian.Controls.Library
MyStepRTB.FindAllLinks();
MyStepRTB.OrigRTF = MyStepRTB.Rtf;
MyStepRTB.ClearUndo();
// see if enhanced document related steps need to be created: KBR 10/2/15 - NEED to do this when saving RO
if (EnhAddType != EnhancedAddTypes.No)
{
StepConfig sib = EnhAddFromItemInfo.MyConfig as StepConfig;
foreach (EnhancedDocument ed in sib.MyEnhancedDocuments)
{
// create a new enhanced step and link it to this new source step.
// the new source step's item is passed in to know what type & what to link to.
// The ed.Type & itemid show what type of enhanced document (use to create new
// config Type) and itemid is the one to insert after.
DoAddEnhancedSteps(ed.Type, ed.ItemID);
}
EnhAddType = EnhancedAddTypes.No;
}
}
}
private void DoAddEnhancedSteps(int enhType, int enhItemID)
{
// get the item object in the enhanced document so that inserting of the new enhanced item and
// its children can be done:
ItemInfo existingEnhancedItemInfo = ItemInfo.Get(enhItemID);
ItemInfo.EAddpingPart addpart = ItemInfo.EAddpingPart.After;
if (EnhAddType == EnhancedAddTypes.Before) addpart = ItemInfo.EAddpingPart.Before;
else if (EnhAddType == EnhancedAddTypes.Child) addpart = ItemInfo.EAddpingPart.Child;
ItemInfo newEnhancedItemInfo = existingEnhancedItemInfo.InsertEnhancedSteps(MyItemInfo.MyContent.Text, null, addpart, MyItemInfo.MyContent.Type, enhType, MyItemInfo.ItemID);
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
sc.AddEnhancedDocument(enhType, newEnhancedItemInfo.ItemID);
using (Content c = Content.Get(MyItemInfo.ContentID))
{
c.Config = sc.ToString();
c.Save();
}
MyItemInfo.RefreshConfig();
}
//public override void SetBackgroundColor()
//{
// MyStepRTB.SetBackColor();