Save Item only once when text is updated

Adjust AER to reflect changes in the RNO column
Added AnnotationColor property
Set Active or Inactive BackColor for StepRTB
This commit is contained in:
Rich 2010-10-18 15:40:29 +00:00
parent b39ee1b05b
commit ecb9f7f872
4 changed files with 42 additions and 4 deletions

View File

@ -361,7 +361,13 @@ namespace Volian.Controls.Library
Dictionary<int, ContentRoUsage> roUsgReplacements = BuildRoUsgReplacements(_MyItem.MyContent.ContentRoUsages);
_MyItem.DTS = DateTime.Now;
_MyItem.UserID = Environment.UserName;
_MyItem.Save();
// Do the Save once rather than multiple times
bool saveAtOnce = false;
// If it is a new Item, save it before the transitions and ROs are saved
if (_MyItem.ItemID < 0)
_MyItem.Save();
else
saveAtOnce = true;
if (ctReplacements.Count > 0)
{
EditText = FixCtReplacements(EditText, ctReplacements);
@ -369,13 +375,15 @@ namespace Volian.Controls.Library
foreach (ContentTransition ct in ctReplacements.Values)
using (TransitionInfo tran = TransitionInfo.Get(ct.TransitionID))
_MyItem.MyContent.FixTransitionText(tran);
_MyItem.Save();
saveAtOnce = true;
}
if (roUsgReplacements.Count > 0)
{
EditText = FixRoUsgReplacements(EditText, roUsgReplacements);
_MyItem.Save();
saveAtOnce = true;
}
if(saveAtOnce)
_MyItem.Save();
modtext = EditText;
}
else

View File

@ -2049,12 +2049,30 @@ namespace Volian.Controls.Library
return MyItemInfo.MyContent.ToString();
}
}
private StepItem AERStepItem
{
get
{
if (MyParentStepItem != null)
{
if (MyParentStepItem.RNOLevel < RNOLevel)
return MyParentStepItem;
else
return MyParentStepItem.AERStepItem;
}
else
{
return MyPreviousStepItem.AERStepItem;
}
}
}
/// <summary>
/// Adjust the Location of all items below the current item.
/// </summary>
internal void AdjustLocation()
{
if (RNORight) MoveRNO(); // This is needed when an AER is Deleted that has an RNO.
if (RNOLevel>0) AERStepItem.AdjustLocation();
StepItem nextStepItem = NextDownStepItem;
//if (MyID == 2138)
// Console.WriteLine("2138");

View File

@ -47,6 +47,7 @@ namespace Volian.Controls.Library
private Font _StepFont = new Font("Arial", 10);
private Color _ActiveColor = Color.SkyBlue;
private Color _InactiveColor = Color.Linen;
private Color _AnnotationColor = Color.FromArgb(255, 255, 128);
private Color _TabColor = Color.Beige;
private Color _PanelColor = Color.LightGray;
// Whether panel is in view or edit mode. Toggled from steprtb
@ -501,6 +502,14 @@ namespace Volian.Controls.Library
set { _ActiveColor = value; }
}
/// <summary>
/// Gets or Sets the Annotation backcolor for StepRTBs in the Panel
/// </summary>
public Color AnnotationColor
{
get { return _AnnotationColor; }
set { _AnnotationColor = value; }
}
/// <summary>
/// Gets or sets the InActive Color for the Panel
/// </summary>
public Color InactiveColor

View File

@ -172,7 +172,10 @@ namespace Volian.Controls.Library
public void SetBackColor()
{
if (MyStepItem == null || MyStepItem.MyStepPanel == null) return;
if (!Focused)BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyStepItem.MyStepPanel.InactiveColor : Color.FromArgb(255, 255, 128);
if (Focused) // If active Set BackColor to the active color
BackColor = MyStepItem.MyStepPanel.ActiveColor;
else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor
BackColor = _MyItemInfo.ItemAnnotationCount == 0 ? MyStepItem.MyStepPanel.InactiveColor : MyStepItem.MyStepPanel.AnnotationColor;
}
public void HighlightBackColor()
{