Open Enhanced Document from Procedure or Procedure from Enhanced Document
Added new feature to keep Background Document and Deviation Documents in Sync as the user moves through the procedure. Support ReadOnly steps for Enhanced Documents linked steps.
This commit is contained in:
parent
551b71e525
commit
a87decdbe3
@ -48,6 +48,12 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public partial class DisplayTabControl : UserControl
|
||||
{
|
||||
public event ItemSelectedChangedEvent OpenEnhancedDocument;
|
||||
public void OnOpenEnhancedDocument(ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
if (OpenEnhancedDocument != null)
|
||||
OpenEnhancedDocument(this, args);
|
||||
}
|
||||
public event DisplayTabControlStatusEvent StatusChanged;
|
||||
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
|
||||
{
|
||||
@ -92,8 +98,18 @@ namespace Volian.Controls.Library
|
||||
public Dictionary<int, string> ItemsChangeIds = null;
|
||||
private ItemInfo _MyItemInfo = null;
|
||||
private EditItem _MyEditItem = null;
|
||||
|
||||
public EditItem MyEditItem
|
||||
{
|
||||
get { return _MyEditItem; }
|
||||
set { _MyEditItem = value; }
|
||||
}
|
||||
private StepRTB _MyStepRTB = null;
|
||||
private bool _RibbonExpanded=true;
|
||||
public StepRTB MyStepRTB
|
||||
{
|
||||
get { return _MyStepRTB; }
|
||||
}
|
||||
public bool RibbonExpanded
|
||||
{
|
||||
get { return _RibbonExpanded; }
|
||||
@ -807,6 +823,22 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
/// <param name="myItemInfo"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsItemInfoProcedureOpen(ItemInfo ii)
|
||||
{
|
||||
ItemInfo proc = ii.MyProcedure; // Find procedure Item
|
||||
if (dicEnhancedDocuments.ContainsKey(ii.MyProcedure.MyDocVersion))
|
||||
{
|
||||
frmEnhanced frm = dicEnhancedDocuments[ii.MyProcedure.MyDocVersion];
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
if (frm.MyDisplayTabClntrol._MyDisplayTabItems.ContainsKey(key))
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
//return false;
|
||||
return false;
|
||||
}
|
||||
public Dictionary<DocVersionInfo, frmEnhanced> dicEnhancedDocuments = new Dictionary<DocVersionInfo, frmEnhanced>();
|
||||
|
||||
private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
@ -840,9 +872,19 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
Application.DoEvents();
|
||||
pg.SelectedItemInfo = myItemInfo; // Select the item
|
||||
//StepConfig sc = new StepConfig(myItemInfo.MyContent.Config);
|
||||
//if (sc.Step_SourceToBackground != null || sc.Step_SourceToDeviation != null)
|
||||
// pg.MyStepTabPanel.MyStepTabRibbon.btnEnhancedDocSync.Visible = true;
|
||||
//else
|
||||
// pg.MyStepTabPanel.MyStepTabRibbon.btnEnhancedDocSync.Visible = false;
|
||||
return pg;
|
||||
}
|
||||
|
||||
private bool _SyncEnhancedDocuments;
|
||||
public bool SyncEnhancedDocuments
|
||||
{
|
||||
get { return _SyncEnhancedDocuments; }
|
||||
set { _SyncEnhancedDocuments = value; }
|
||||
}
|
||||
public void HandleChangeId(ItemInfo myItemInfo, DisplayTabItem pg)
|
||||
{
|
||||
if (myItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
|
||||
|
@ -410,11 +410,53 @@ namespace Volian.Controls.Library
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private bool _ProcessingEnter = false;
|
||||
private void _StepRTB_Enter(object sender, EventArgs e)
|
||||
{
|
||||
if (MyStepPanel.DisplayItemChanging) return;
|
||||
//vlnStackTrace.ShowStack("_StepRTB_Enter {0}",this.MyID);
|
||||
MyStepPanel.SelectedEditItem = this;
|
||||
if (MyStepPanel.MyStepTabPanel.MyDisplayTabControl.SyncEnhancedDocuments)
|
||||
{
|
||||
if (!_ProcessingEnter)
|
||||
{
|
||||
_ProcessingEnter = true;
|
||||
DisplayTabItem dti = null;
|
||||
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
|
||||
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);
|
||||
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);
|
||||
if (dti != null)
|
||||
dti.MyStepTabPanel.MyDisplayTabControl.OpenItem(this.MyItemInfo);
|
||||
}
|
||||
_ProcessingEnter = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Pass the AttachmentClick event to the StepPanel control.
|
||||
@ -676,6 +718,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (MyStepRTB.ReadOnly) return;
|
||||
if (!MyStepRTB.ActiveMode) return;
|
||||
if (MyStepRTB.IsExperimenting) return;
|
||||
if (MyStepRTB.MyItemInfo.MyContent.Number != null && !MyStepRTB.IsDirty && MyStepRTB.Text.Contains("(Resolved Transition Text)") == false) return;
|
||||
bool success = MyStepRTB.OrigDisplayText.Save((RichTextBox)MyStepRTB);
|
||||
if (success)
|
||||
|
@ -303,6 +303,12 @@ namespace Volian.Controls.Library
|
||||
get { return OrigRTF != Rtf; }
|
||||
}
|
||||
private bool _InitializingRTB;
|
||||
private bool _IsExperimenting = false;
|
||||
public bool IsExperimenting
|
||||
{
|
||||
get { return _IsExperimenting; }
|
||||
set { _IsExperimenting = value; }
|
||||
}
|
||||
private IContainer _Container = null;
|
||||
private string _MyClassName=string.Empty;
|
||||
public string MyClassName
|
||||
@ -416,6 +422,7 @@ namespace Volian.Controls.Library
|
||||
// RefreshDisplay is used to update the rtb for an entire Item as defined by MyItemInfo.
|
||||
public void RefreshDisplay(bool activeMode)
|
||||
{
|
||||
if (IsExperimenting) return;
|
||||
ActiveMode = activeMode;
|
||||
OnAdjustTableWidth(this, new StepRTBTableWidthEventArgs(true));
|
||||
_InitializingRTB = true;
|
||||
@ -445,6 +452,12 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
RTBAPI.SetLineSpacing(this, RTBAPI.ParaSpacing.PFS_EXACT);
|
||||
bool readOnlyStep = MyItemInfo == null || MyItemInfo.FormatStepData == null ? false : MyItemInfo.FormatStepData.ReadOnly;
|
||||
if (!readOnlyStep)
|
||||
{
|
||||
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
|
||||
if (sc.Step_BackgroundToSource != null || sc.Step_DeviationToSource != null)
|
||||
readOnlyStep = true;
|
||||
}
|
||||
ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false;
|
||||
AddRtfText(vlntxt.StartText);
|
||||
//AddRtfStyles();
|
||||
@ -734,7 +747,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
void StepRTB_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingRTB) return;
|
||||
if (_InitializingRTB || _IsExperimenting) return;
|
||||
HandleSelectionChange();
|
||||
}
|
||||
private bool _MouseDown = false;
|
||||
@ -1384,7 +1397,7 @@ namespace Volian.Controls.Library
|
||||
#region TextAndContentsEvents
|
||||
void StepRTB_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_InitializingRTB) return;
|
||||
if (_InitializingRTB || _IsExperimenting) return;
|
||||
// Was setting _IsDirty to true here, but this was getting called from
|
||||
// 'dotnetbar' when text was NOT Changed. So _IsDirty was made into
|
||||
// a property and compared original rtf versus current richtextbox's
|
||||
|
Loading…
x
Reference in New Issue
Block a user