Enhanced Document support
Null check Move DisplayText.cs to CSLA Enhanced Documents – don’t allow ‘Save’ RO on enhanced step Enhanced Documents windowing Enhanced Documents remove unnecessary options Enhanced Documents – don’t allow ‘Save’ transition on enhanced step Enhanced Documents/Insert,Delete,Paste
This commit is contained in:
@@ -48,12 +48,39 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
public partial class DisplayTabControl : UserControl
|
||||
{
|
||||
private static bool _SyncronizeEnahnced = false;
|
||||
public static bool SyncronizeEnhanced
|
||||
{
|
||||
get { return DisplayTabControl._SyncronizeEnahnced; }
|
||||
set { DisplayTabControl._SyncronizeEnahnced = value; }
|
||||
}
|
||||
private static Dictionary<int, DisplayTabControl> _AllDTCs = new Dictionary<int, DisplayTabControl>();
|
||||
private int? _VersionID = null;
|
||||
public int? VersionID
|
||||
{
|
||||
get { return _VersionID; }
|
||||
set
|
||||
{
|
||||
if (_AllDTCs.ContainsKey((int)value))
|
||||
_AllDTCs[(int)value] = this;
|
||||
else
|
||||
_AllDTCs.Add((int)value, this);
|
||||
_VersionID = value;
|
||||
}
|
||||
}
|
||||
|
||||
public event ItemSelectedChangedEvent OpenEnhancedDocument;
|
||||
public void OnOpenEnhancedDocument(ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
if (OpenEnhancedDocument != null)
|
||||
OpenEnhancedDocument(this, args);
|
||||
}
|
||||
public event ItemSelectedChangedEvent RefreshEnhancedDocument;
|
||||
public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
if (RefreshEnhancedDocument != null)
|
||||
RefreshEnhancedDocument(this, args);
|
||||
}
|
||||
public event DisplayTabControlStatusEvent StatusChanged;
|
||||
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
|
||||
{
|
||||
@@ -76,7 +103,7 @@ namespace Volian.Controls.Library
|
||||
/// "Item - " + Procedure ItemID for step pages
|
||||
/// "Doc - " + DocumentID for Word Documents
|
||||
/// </summary>
|
||||
private Dictionary<string, DisplayTabItem> _MyDisplayTabItems;
|
||||
public Dictionary<string, DisplayTabItem> _MyDisplayTabItems;
|
||||
/// <summary>
|
||||
/// When a Tab is closed it is added to this list.
|
||||
/// When another Tab is opened, any Tabs in this list are closed
|
||||
@@ -398,14 +425,39 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region Public Methods
|
||||
public void RefreshItem(ItemInfo myItemInfo)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
DisplayTabItem pg = _MyDisplayTabItems[key];
|
||||
if (pg.MyStepTabPanel.MyStepPanel._LookupEditItems.ContainsKey(myItemInfo.ItemID))
|
||||
OpenItem(myItemInfo,false);
|
||||
}
|
||||
}
|
||||
public DisplayTabItem OpenItem(ItemInfo myItemInfo2)
|
||||
{
|
||||
return OpenItem(myItemInfo2, true);
|
||||
}
|
||||
/// <summary>
|
||||
/// Open a Step Item or a Word Item
|
||||
/// </summary>
|
||||
/// <param name="myItemInfo"></param>
|
||||
/// <returns></returns>
|
||||
public DisplayTabItem OpenItem(ItemInfo myItemInfo2)
|
||||
public DisplayTabItem OpenItem(ItemInfo myItemInfo2, bool setFocus)
|
||||
{
|
||||
ItemInfo myItemInfo = myItemInfo2;
|
||||
if(VersionID!=myItemInfo.MyDocVersion.VersionID)
|
||||
{
|
||||
if(_AllDTCs.ContainsKey(myItemInfo.MyDocVersion.VersionID))
|
||||
{
|
||||
return _AllDTCs[myItemInfo.MyDocVersion.VersionID].OpenItem(myItemInfo);
|
||||
}
|
||||
if(VersionID != 0)
|
||||
return _AllDTCs[0].OpenItem(myItemInfo);
|
||||
}
|
||||
string message = string.Empty;
|
||||
if (myItemInfo.MyContent.MyEntry == null) //not a document
|
||||
{
|
||||
@@ -440,7 +492,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
_MyBar = GetParentBar(myItemInfo); // Get the docking bar associated with this item.
|
||||
if (myItemInfo.MyContent.MyEntry == null) // If it is a Word document open in step editor
|
||||
return OpenStepTabPage(myItemInfo);
|
||||
return OpenStepTabPage(myItemInfo,setFocus);
|
||||
else // Otherwise open it in the Word editor
|
||||
return OpenDSOTabPage(myItemInfo);
|
||||
}
|
||||
@@ -637,12 +689,16 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
get { return _PnlCaret; }
|
||||
}
|
||||
private static int trackerSC = 0;
|
||||
public void ShowCaret()
|
||||
{
|
||||
if (_MyStepRTB != null)
|
||||
{
|
||||
if (_MyEditItem.RTBLastFocus)
|
||||
{
|
||||
trackerSC++;
|
||||
/*if (trackerSC>20) */Console.WriteLine("ShowCaret: {0}", trackerSC);
|
||||
//Volian.Base.Library.vlnStackTrace.ShowStack("ShowCaret: EI: {0} StepRTB: {1}", _MyEditItem.MyItemInfo.ItemID, _MyStepRTB.MyItemInfo.ItemID);
|
||||
if (!_MyStepRTB.Visible)
|
||||
_MyStepRTB.Visible = true;
|
||||
if (_MyStepRTB.SelectionLength == 0)
|
||||
@@ -665,10 +721,14 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
private static int trackerHC = 0;
|
||||
public void HideCaret()
|
||||
{
|
||||
if (_MyStepRTB != null && !_MyStepRTB.Disposing && !_MyStepRTB.Closed)
|
||||
{
|
||||
trackerHC++;
|
||||
/* if (trackerHC>20)*/ Console.WriteLine("HideCaret {0}", trackerHC);
|
||||
//Volian.Base.Library.vlnStackTrace.ShowStack("HideCaret: StepRTB: {0}", _MyStepRTB.MyItemInfo.ItemID);
|
||||
if (_MyStepRTB.SelectionLength == 0)
|
||||
{
|
||||
tmrCaret.Enabled = false;
|
||||
@@ -823,23 +883,23 @@ 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>();
|
||||
//public bool IsItemInfoProcedureOpen(ItemInfo ii)
|
||||
// if (ii == null) return false; //{
|
||||
// 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)
|
||||
private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
@@ -847,18 +907,24 @@ namespace Volian.Controls.Library
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
pg = _MyDisplayTabItems[key];
|
||||
pg.Selected = true;
|
||||
HandleChangeId(myItemInfo, pg);
|
||||
if (SelectedDisplayTabItem != pg) // If the selected page doesn't match
|
||||
SelectDisplayTabItem(pg); // Set the selected page
|
||||
if (setFocus)
|
||||
{
|
||||
pg.Selected = true;
|
||||
HandleChangeId(myItemInfo, pg);
|
||||
if (SelectedDisplayTabItem != pg) // If the selected page doesn't match
|
||||
SelectDisplayTabItem(pg); // Set the selected page
|
||||
}
|
||||
}
|
||||
else // If not already open, create a new Page
|
||||
{
|
||||
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
pg.Selected = true;
|
||||
HandleChangeId(myItemInfo, pg);
|
||||
SelectDisplayTabItem(pg);
|
||||
if (setFocus)
|
||||
{
|
||||
pg.Selected = true;
|
||||
HandleChangeId(myItemInfo, pg);
|
||||
SelectDisplayTabItem(pg);
|
||||
}
|
||||
pg.MyStepTabPanel.MyProcedureItemInfo = proc;
|
||||
|
||||
// When more than one procedure is openned, the ribbon control cuts off the bottom of the buttons.
|
||||
|
Reference in New Issue
Block a user