C2026-043-Tech-Debt_v1 - Stash 1
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using Volian.Controls.Library;
|
||||
using DevComponents.DotNetBar;
|
||||
using JR.Utils.GUI.Forms;
|
||||
using Volian.Base.Library;
|
||||
@@ -59,14 +56,8 @@ namespace Volian.Controls.Library
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
|
||||
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>();
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
private static Dictionary<int, DisplayTabControl> _AllDTCs = new Dictionary<int, DisplayTabControl>();
|
||||
private int _VersionID = 0;
|
||||
// zero tells us to PROMS just opened and no procedure was selected yet so use the main proms window
|
||||
// when the first procedure is opened, the VersionID is set and added to _AllDTCs
|
||||
@@ -75,11 +66,11 @@ namespace Volian.Controls.Library
|
||||
get { return _VersionID; }
|
||||
set
|
||||
{
|
||||
if ((int)value != 0)
|
||||
if (value != 0)
|
||||
{
|
||||
if (!_AllDTCs.ContainsKey((int)value))
|
||||
{
|
||||
_AllDTCs.Add((int)value, this);
|
||||
_AllDTCs.Add(value, this);
|
||||
if (_VersionID == 0)
|
||||
_VersionID = value;
|
||||
else
|
||||
@@ -148,9 +139,8 @@ namespace Volian.Controls.Library
|
||||
public event ItemSelectedChangedEvent OpenInSeparateWindow;
|
||||
public void OnOpenInSeparateWindow(ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
if (OpenInSeparateWindow != null)
|
||||
OpenInSeparateWindow(this, args);
|
||||
}
|
||||
OpenInSeparateWindow?.Invoke(this, args);
|
||||
}
|
||||
// C2020-033: Provide way to expand/fill in Search/Incoming Transition panel
|
||||
public event DisplayTabControlEditorSearchIncTransEvent SearchIncTrans;
|
||||
public ItemInfo OnSearchIncTrans(object sender, vlnTreeItemInfoEventArgs args)
|
||||
@@ -161,32 +151,30 @@ namespace Volian.Controls.Library
|
||||
public event ItemSelectedChangedEvent RefreshEnhancedDocument;
|
||||
public void OnRefreshEnhancedDocument(ItemSelectedChangedEventArgs args)
|
||||
{
|
||||
if (RefreshEnhancedDocument != null)
|
||||
RefreshEnhancedDocument(this, args);
|
||||
}
|
||||
RefreshEnhancedDocument?.Invoke(this, args);
|
||||
}
|
||||
public event DisplayTabControlStatusEvent StatusChanged;
|
||||
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
|
||||
{
|
||||
if (StatusChanged != null) StatusChanged(Sender, args);
|
||||
}
|
||||
StatusChanged?.Invoke(Sender, args);
|
||||
}
|
||||
public event DisplayTabControlEvent ToggleRibbonExpanded;
|
||||
public void OnToggleRibbonExpanded(object sender, EventArgs args)
|
||||
{
|
||||
if (ToggleRibbonExpanded != null) ToggleRibbonExpanded(sender, args);
|
||||
}
|
||||
ToggleRibbonExpanded?.Invoke(sender, args);
|
||||
}
|
||||
public event DisplayTabControlEvent SelectedDisplayTabItemChanged;
|
||||
public void OnSelectedDisplayTabItemChanged(object sender, EventArgs args)
|
||||
{
|
||||
if (SelectedDisplayTabItemChanged != null) SelectedDisplayTabItemChanged(sender, args);
|
||||
}
|
||||
SelectedDisplayTabItemChanged?.Invoke(sender, args);
|
||||
}
|
||||
// C2015-022 added copystep event to commuicate with child windows
|
||||
public event ItemChangedEventHandler CopyStepSelected;
|
||||
|
||||
public void OnCopyStepSelected(ItemChangedEventArgs args)
|
||||
{
|
||||
if (CopyStepSelected != null)
|
||||
CopyStepSelected(this, args);
|
||||
}
|
||||
CopyStepSelected?.Invoke(this, args);
|
||||
}
|
||||
|
||||
#region Private Fields
|
||||
|
||||
@@ -228,6 +216,8 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
private StepRTB _MyStepRTB = null;
|
||||
private bool _RibbonExpanded = true;
|
||||
|
||||
//Keeping for possible future references
|
||||
public StepRTB MyStepRTB
|
||||
{
|
||||
get { return _MyStepRTB; }
|
||||
@@ -302,8 +292,8 @@ namespace Volian.Controls.Library
|
||||
/// <param name="args"></param>
|
||||
internal void OnItemClick(object sender, StepPanelEventArgs args)
|
||||
{
|
||||
if (ItemClick != null) ItemClick(sender, args);
|
||||
}
|
||||
ItemClick?.Invoke(sender, args);
|
||||
}
|
||||
/// <summary>
|
||||
/// This occurs when the user moves onto or off of a link within a RichTextBox
|
||||
/// or moves between RichTextBoxes or Pages.
|
||||
@@ -408,8 +398,8 @@ namespace Volian.Controls.Library
|
||||
_MyEditItem = null;
|
||||
_MyStepRTB = null;
|
||||
}
|
||||
if (ItemSelectedChanged != null) ItemSelectedChanged(sender, args);
|
||||
}
|
||||
ItemSelectedChanged?.Invoke(sender, args);
|
||||
}
|
||||
|
||||
void _MyStepRTB_Disposed(object sender, EventArgs e)
|
||||
{
|
||||
@@ -476,8 +466,7 @@ namespace Volian.Controls.Library
|
||||
void DisplayTabControl_Resize(object sender, EventArgs e)
|
||||
{
|
||||
// If the currently selected Item is in a Step, then adjust the scroll as necessary to keep it visible
|
||||
if (_MyEditItem != null)
|
||||
_MyEditItem.ItemShow();
|
||||
_MyEditItem?.ItemShow();
|
||||
}
|
||||
private void SetupBar(Bar myBar)
|
||||
{
|
||||
@@ -531,15 +520,11 @@ namespace Volian.Controls.Library
|
||||
DisplayTabItem dti = e.DockContainerItem as DisplayTabItem;
|
||||
if (dti != null && dti.MyStepTabPanel != null)
|
||||
dti.MyStepTabPanel.MyStepPanel.Dispose();
|
||||
DisplayTabItem myTabItem = e.DockContainerItem as DisplayTabItem;
|
||||
if (myTabItem != null)
|
||||
{
|
||||
if (myTabItem.MyDSOTabPanel != null)
|
||||
{
|
||||
myTabItem.MyDSOTabPanel.CloseDSO();
|
||||
}
|
||||
}
|
||||
MySessionInfo.CheckInItem(dti.OwnerID);
|
||||
if (e.DockContainerItem is DisplayTabItem myTabItem)
|
||||
{
|
||||
myTabItem.MyDSOTabPanel?.CloseDSO();
|
||||
}
|
||||
MySessionInfo.CheckInItem(dti.OwnerID);
|
||||
if (((Bar)sender).Items == null) return;
|
||||
if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed...
|
||||
{
|
||||
@@ -551,17 +536,16 @@ namespace Volian.Controls.Library
|
||||
OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, E_ViewMode.Edit));
|
||||
}
|
||||
|
||||
Bar bar = sender as Bar;
|
||||
if (bar != null)
|
||||
{
|
||||
if (dotNetBarManager1.Bars.Contains(bar.Name))
|
||||
dotNetBarManager1.Bars.Remove(bar);
|
||||
ActivateRemainingTab();
|
||||
}
|
||||
// B2018-123 the last tab in the main window was closed.
|
||||
// remove the procedure version id from the _AllDTCs dictionary
|
||||
// reset VersionID to zero so that we know the main window is available
|
||||
_AllDTCs.Remove(VersionID);
|
||||
if (sender is Bar bar)
|
||||
{
|
||||
if (dotNetBarManager1.Bars.Contains(bar.Name))
|
||||
dotNetBarManager1.Bars.Remove(bar);
|
||||
ActivateRemainingTab();
|
||||
}
|
||||
// B2018-123 the last tab in the main window was closed.
|
||||
// remove the procedure version id from the _AllDTCs dictionary
|
||||
// reset VersionID to zero so that we know the main window is available
|
||||
_AllDTCs.Remove(VersionID);
|
||||
VersionID = 0;
|
||||
}
|
||||
else
|
||||
@@ -574,15 +558,14 @@ namespace Volian.Controls.Library
|
||||
public event StepTabRibbonEvent EnableDisableStepProperties;
|
||||
private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args)
|
||||
{
|
||||
if (EnableDisableStepProperties != null)
|
||||
EnableDisableStepProperties(this, args);
|
||||
EnableDisableStepProperties?.Invoke(this, args);
|
||||
}
|
||||
#endregion
|
||||
#region Public Methods
|
||||
public void RefreshItem(ItemInfo myItemInfo)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
@@ -717,9 +700,8 @@ namespace Volian.Controls.Library
|
||||
if (EDOfficeViewerX == null || EDWordCtrl == null)
|
||||
{
|
||||
|
||||
MessageBox.Show("Edraw needs to be installed or reinstalled on this device. " + Environment.NewLine + "" + Environment.NewLine +
|
||||
"Please contact your IT Administrator to install and register Edraw that was provided with the PROMS Installation media. If additional support is needed, please contact Volian.", "Error in Word section",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
MessageBox.Show($"Edraw needs to be installed or reinstalled on this device. {Environment.NewLine}{Environment.NewLine}Please contact your IT Administrator to install and register Edraw that was provided with the PROMS Installation media. If additional support is needed, please contact Volian.",
|
||||
"Error in Word section", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
@@ -730,19 +712,13 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
|
||||
}
|
||||
public T GetValue<T>(string registryKeyPath, string value, T defaultValue = default(T))
|
||||
{
|
||||
T retVal = default(T);
|
||||
|
||||
retVal = (T)Registry.GetValue(registryKeyPath, value, defaultValue);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
public bool PasteRTBItem(ItemInfo myItemInfo, int copyStartID, ItemInfo.EAddpingPart pasteType, int type)
|
||||
public T GetValue<T>(string registryKeyPath, string value, T defaultValue = default) => (T)Registry.GetValue(registryKeyPath, value, defaultValue);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "Keeping type for future usage")]
|
||||
public bool PasteRTBItem(ItemInfo myItemInfo, int copyStartID, ItemInfo.EAddpingPart pasteType, int type)
|
||||
{
|
||||
CleanUpClosedItems();
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key) && pasteType != ItemInfo.EAddpingPart.Replace) // If procedure page open use it unless replace
|
||||
{
|
||||
@@ -769,7 +745,7 @@ namespace Volian.Controls.Library
|
||||
EditItem ei = edtitm.PasteReplace(copyStartID);
|
||||
if (ei == null)
|
||||
{
|
||||
CloseTabItem(_MyDisplayTabItems["Item - " + myItemInfo.ItemID.ToString()]); //Grab itemID and set to close open tab.
|
||||
CloseTabItem(_MyDisplayTabItems[$"Item - {myItemInfo.ItemID}"]); //Grab itemID and set to close open tab.
|
||||
return false; //B2017-179 PasteReplace will return null if was aborted
|
||||
}
|
||||
|
||||
@@ -788,7 +764,7 @@ namespace Volian.Controls.Library
|
||||
else if (_MyDisplayTabItems.ContainsKey(key) && pasteType == ItemInfo.EAddpingPart.Replace)
|
||||
{
|
||||
// B2024-038: changed tab key to procedure (was item, which caused crash if section)
|
||||
CloseTabItem(_MyDisplayTabItems["Item - " + proc.ItemID.ToString()]); //Grab itemID and set to close open tab.
|
||||
CloseTabItem(_MyDisplayTabItems[$"Item - {proc.ItemID}"]); //Grab itemID and set to close open tab.
|
||||
return false; //B2017-179 PasteReplace will return null if was aborted
|
||||
}
|
||||
return false;
|
||||
@@ -800,7 +776,7 @@ namespace Volian.Controls.Library
|
||||
|
||||
//removeitem!
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
@@ -826,7 +802,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
CleanUpClosedItems();
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
@@ -875,17 +851,16 @@ namespace Volian.Controls.Library
|
||||
string key = "Doc - ";
|
||||
// there is no entry if it is an auto table of contents:
|
||||
if (myItemInfo.MyContent.MyEntry != null)
|
||||
key = key + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString();
|
||||
key += myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString();
|
||||
else
|
||||
key = key + "0";
|
||||
DisplayTabItem myTabItem = null;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it
|
||||
key += "0";
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If page open, close it
|
||||
{
|
||||
myTabItem = _MyDisplayTabItems[key];
|
||||
if (myTabItem.MyDSOTabPanel != null)
|
||||
_ = _MyDisplayTabItems[key];
|
||||
if (((DisplayTabItem)null).MyDSOTabPanel != null)
|
||||
{
|
||||
myTabItem.MyDSOTabPanel.IsBeingDeleted = isBeingDeleted;
|
||||
CloseTabItem(myTabItem);
|
||||
((DisplayTabItem)null).MyDSOTabPanel.IsBeingDeleted = isBeingDeleted;
|
||||
CloseTabItem(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -893,23 +868,22 @@ namespace Volian.Controls.Library
|
||||
public void CloseTabItem(DisplayTabItem myTabItem)
|
||||
{
|
||||
if (myTabItem.ContainerControl == null) return;
|
||||
Bar b = myTabItem.ContainerControl as Bar;
|
||||
if (b != null)
|
||||
{
|
||||
try
|
||||
if (myTabItem.ContainerControl is Bar b)
|
||||
{
|
||||
try
|
||||
{
|
||||
b.CloseDockTab(myTabItem);
|
||||
}
|
||||
catch
|
||||
{
|
||||
//This is to work around a bug inside 3rd party DotNetBar
|
||||
//The bug occurs when events happen out of order and it tries
|
||||
//to remove a TabItem from the Collection the has already been removed
|
||||
}
|
||||
catch
|
||||
{
|
||||
//This is to work around a bug inside 3rd party DotNetBar
|
||||
//The bug occurs when events happen out of order and it tries
|
||||
//to remove a TabItem from the Collection the has already been removed
|
||||
}
|
||||
|
||||
RemoveItem(myTabItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Look for a tab and set it to active.
|
||||
/// </summary>
|
||||
@@ -948,10 +922,9 @@ namespace Volian.Controls.Library
|
||||
if (_RemovedDisplayTabItems.Contains(myBar.SelectedDockContainerItem as DisplayTabItem))
|
||||
myBar.SelectedDockContainerItem = FindRemainingTab(myBar);
|
||||
myBar.SelectedDockContainerItem.Selected = true;
|
||||
StepTabPanel pnl = myBar.SelectedDockContainerItem.Control as StepTabPanel;
|
||||
if (pnl != null)
|
||||
pnl.MyStepPanel.ItemShow();
|
||||
}
|
||||
if (myBar.SelectedDockContainerItem.Control is StepTabPanel pnl)
|
||||
pnl.MyStepPanel.ItemShow();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Public Properties
|
||||
@@ -1035,7 +1008,7 @@ namespace Volian.Controls.Library
|
||||
PnlCaret.Visible = false;
|
||||
}
|
||||
// B2019-161 When tracking timing time this action
|
||||
private static VolianTimer _TimeActivity = new VolianTimer("DisplayTabControl.cs tmrCaret_Tick", 881);
|
||||
private static readonly VolianTimer _TimeActivity = new VolianTimer("DisplayTabControl.cs tmrCaret_Tick", 881);
|
||||
|
||||
private void tmrCaret_Tick(object sender, EventArgs e)
|
||||
{
|
||||
@@ -1045,22 +1018,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region Private Methods
|
||||
///// <summary>
|
||||
///// Gets and sets the SelectedDisplayTabItem (Active Tab)
|
||||
///// </summary>
|
||||
//public DisplayTabItem SelectedDisplayTabItem1
|
||||
//{
|
||||
// get { return (DisplayTabItem)_MyBar.SelectedDockContainerItem; }
|
||||
// set
|
||||
// {
|
||||
// //Volian.Base.Library.vlnStackTrace.ShowStackLocal("SelectedDisplayTabItem");
|
||||
// if (value != null)
|
||||
// {
|
||||
// value.Focus();
|
||||
// value.Selected = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
public void SelectDisplayTabItem(DisplayTabItem myDisplayTabItem)
|
||||
{
|
||||
if (myDisplayTabItem != null)
|
||||
@@ -1112,11 +1069,10 @@ namespace Volian.Controls.Library
|
||||
if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found
|
||||
foreach (object itm in b.Items)
|
||||
{
|
||||
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
||||
if (myTabItem != null && myTabItem.MyStepTabPanel != null && myItemInfo != null)
|
||||
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
||||
return b;
|
||||
}
|
||||
if (itm is DisplayTabItem myTabItem && myTabItem.MyStepTabPanel != null && myItemInfo != null)
|
||||
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (myBar == null)
|
||||
@@ -1125,7 +1081,7 @@ namespace Volian.Controls.Library
|
||||
_UniqueBarCount++;
|
||||
myBar = BarUtilities.CreateDocumentBar();
|
||||
myBar.DockTabClosing += new DockTabClosingEventHandler(myBar_DockTabClosing);
|
||||
myBar.Name = "barDocuments" + _UniqueBarCount.ToString();
|
||||
myBar.Name = $"barDocuments{_UniqueBarCount}";
|
||||
fillDocDockSite.GetDocumentUIManager().Dock(myBar);
|
||||
SetupBar(myBar);
|
||||
}
|
||||
@@ -1141,11 +1097,10 @@ namespace Volian.Controls.Library
|
||||
if (myBar == null) myBar = b;// Remember the first available bar if a specific bar cannot be found
|
||||
foreach (object itm in b.Items)
|
||||
{
|
||||
DisplayTabItem myTabItem = itm as DisplayTabItem;
|
||||
if (myTabItem != null && myTabItem.MyStepTabPanel != null && myTabItem.MyStepTabPanel.MyProcedureItemInfo != null)
|
||||
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
||||
return myTabItem.MyStepTabPanel;
|
||||
}
|
||||
if (itm is DisplayTabItem myTabItem && myTabItem.MyStepTabPanel != null && myTabItem.MyStepTabPanel.MyProcedureItemInfo != null)
|
||||
if (myTabItem.MyStepTabPanel.MyProcedureItemInfo.ItemID == myItemInfo.MyProcedure.ItemID)
|
||||
return myTabItem.MyStepTabPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -1173,8 +1128,7 @@ namespace Volian.Controls.Library
|
||||
if (stp != null)
|
||||
{
|
||||
EditItem ei = stp.SelectedEditItem;
|
||||
if (ei != null)
|
||||
ei.SaveCurrentAndContents();
|
||||
ei?.SaveCurrentAndContents();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1182,41 +1136,17 @@ namespace Volian.Controls.Library
|
||||
public DisplayTabItem GetProcDisplayTabItem(ItemInfo myItemInfo)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
DisplayTabItem pg = null;
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
return _MyDisplayTabItems[key];
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// This opens a Step page based upon a ItemInfo.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="myItemInfo"></param>
|
||||
/// <returns></returns>
|
||||
//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, bool setFocus, bool viewonlymode = false)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
DisplayTabItem pg = null;
|
||||
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
string key = $"Item - {proc.ItemID}";
|
||||
DisplayTabItem pg;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If procedure page open use it
|
||||
{
|
||||
pg = _MyDisplayTabItems[key];
|
||||
if (setFocus)
|
||||
@@ -1237,9 +1167,6 @@ namespace Volian.Controls.Library
|
||||
HandleChangeId(myItemInfo, pg);
|
||||
SelectDisplayTabItem(pg);
|
||||
|
||||
// If this is an enhanced document, check for refresh of text items:
|
||||
//if (myItemInfo.IsProcedure)
|
||||
//{
|
||||
// make the myiteminfo into a procedureinfo (depending on where this is called from, just
|
||||
// casting it crashed:
|
||||
ProcedureInfo pi = ProcedureInfo.Get(myItemInfo.MyProcedure.ItemID);
|
||||
@@ -1254,7 +1181,6 @@ namespace Volian.Controls.Library
|
||||
pi.EnhancedProcedureRefreshTextDifferences(iil);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
pg.MyStepTabPanel.MyProcedureItemInfo = proc;
|
||||
|
||||
@@ -1269,11 +1195,6 @@ 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;
|
||||
@@ -1294,7 +1215,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (!Volian.Base.Library.VlnSettings.GetCommandFlag("NOCHGID"))
|
||||
{
|
||||
dlgChgId dlgCI = new dlgChgId(this); //, null);
|
||||
dlgChgId dlgCI = new dlgChgId(this);
|
||||
dlgCI.ShowDialog(this);
|
||||
}
|
||||
ItemsChangeIds.Add(myItemInfo.MyProcedure.ItemID, ChgId);
|
||||
@@ -1303,11 +1224,6 @@ namespace Volian.Controls.Library
|
||||
|
||||
private void SetChangeId(string chgid, DisplayTabItem pg, ItemInfo ii)
|
||||
{
|
||||
//if (pg == null || pg.MyStepTabPanel == null)
|
||||
//{
|
||||
// ChgId = null;
|
||||
// return;
|
||||
//}
|
||||
if (pg != null && pg.MyStepTabPanel != null) pg.MyStepTabPanel.MyStepTabRibbon.SetChangeId(chgid, ii);
|
||||
ChgId = chgid;
|
||||
}
|
||||
@@ -1315,7 +1231,7 @@ namespace Volian.Controls.Library
|
||||
private bool LibDocAlreadyOpen(ItemInfo myItemInfo)
|
||||
{
|
||||
EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
|
||||
string key = "Doc - " + myEntry.DocID;
|
||||
string key = $"Doc - {myEntry.DocID}";
|
||||
DisplayTabItem pg = null;
|
||||
return LibDocAlreadyOpen(myItemInfo, key, ref pg, false);
|
||||
}
|
||||
@@ -1359,7 +1275,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
DisplayTabItem pg = null;
|
||||
EntryInfo myEntry = myItemInfo.MyContent.MyEntry;
|
||||
string key = "Doc - " + myEntry.DocID;
|
||||
string key = $"Doc - {myEntry.DocID}";
|
||||
bool libDocAlreadyOpen = LibDocAlreadyOpen(myItemInfo, key, ref pg, true);
|
||||
if (!libDocAlreadyOpen && pg == null)
|
||||
{
|
||||
@@ -1368,8 +1284,6 @@ namespace Volian.Controls.Library
|
||||
FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||
return null;
|
||||
}
|
||||
//if ((myItemInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "")
|
||||
// MessageBox.Show("WARNING: All edits made to this Library Document will be applied to all uses of the Document");
|
||||
pg = new DisplayTabItem(this.components, this, myItemInfo, key); // Open a new document page
|
||||
// B2917-219 if MyEdWord is null that means we had trouble opening the word attachment and either a blank document was created or a previous version was recovered
|
||||
// so we now we want to open the now blank or recovered attachment
|
||||
@@ -1391,21 +1305,21 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_MyBar = GetParentBar(null); // B2016-131 - allow open of a non-referenced library document
|
||||
CleanUpClosedItems();
|
||||
DisplayTabItem pg = null;
|
||||
string key = "Doc - " + myDocumentInfo.DocID;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
|
||||
pg = _MyDisplayTabItems[key];
|
||||
else
|
||||
{
|
||||
if (DSOTabPanel.Count > DSOTabPanel.MSWordLimit) //18) // Limit the number of open document pages to 18
|
||||
{
|
||||
FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||
return null;
|
||||
}
|
||||
pg = new DisplayTabItem(this.components, this, myDocumentInfo, key); // Open a new document page
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
}
|
||||
SelectDisplayTabItem(pg);
|
||||
string key = $"Doc - {myDocumentInfo.DocID}";
|
||||
DisplayTabItem pg;
|
||||
if (_MyDisplayTabItems.ContainsKey(key)) // If document page open use it
|
||||
pg = _MyDisplayTabItems[key];
|
||||
else
|
||||
{
|
||||
if (DSOTabPanel.Count > DSOTabPanel.MSWordLimit) //18) // Limit the number of open document pages to 18
|
||||
{
|
||||
FlexibleMessageBox.Show("Too many Word Documents Open. Please close one of the Documents before attempting to open another");
|
||||
return null;
|
||||
}
|
||||
pg = new DisplayTabItem(this.components, this, myDocumentInfo, key); // Open a new document page
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
}
|
||||
SelectDisplayTabItem(pg);
|
||||
pg.MyDSOTabPanel.EnterPanel();
|
||||
return pg;
|
||||
}
|
||||
@@ -1422,12 +1336,10 @@ namespace Volian.Controls.Library
|
||||
_MyDisplayTabItems.Remove(myDisplayTabItem.MyKey);
|
||||
|
||||
// Dispose of the procedure tab panel
|
||||
if (myDisplayTabItem.MyStepTabPanel != null)
|
||||
myDisplayTabItem.MyStepTabPanel.Dispose();
|
||||
myDisplayTabItem.MyStepTabPanel?.Dispose();
|
||||
|
||||
// Dispose of the MS Word Panel
|
||||
if (myDisplayTabItem.MyDSOTabPanel != null)
|
||||
myDisplayTabItem.MyDSOTabPanel.CloseDSO();
|
||||
myDisplayTabItem.MyDSOTabPanel?.CloseDSO();
|
||||
|
||||
components.Remove(myDisplayTabItem);
|
||||
myDisplayTabItem.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user