Enhanced Documents – various improvements

Enhanced Documents – existing docversion properties UI
This commit is contained in:
Kathy Ruffing 2016-01-20 16:35:48 +00:00
parent 33850f59c1
commit 77cdf81736
4 changed files with 1353 additions and 629 deletions

View File

@ -150,6 +150,44 @@ namespace VEPROMS
set { _SelectedROFst = value; }
}
#endregion
private frmVEPROMS _MyParent;
public frmVEPROMS MyParent
{
get { return _MyParent; }
set { _MyParent = value; }
}
//private FolderInfo _MyFolder = null;
//public FolderInfo MyFolder
//{
// get { return _MyFolder; }
// set { _MyFolder = value; }
//}
private DocVersionInfo _MyDocVersion = null;
public DocVersionInfo MyDocVersion
{
get { return _MyDocVersion; }
set { _MyDocVersion = value; }
}
public frmVEPROMS(frmVEPROMS myParent, DocVersionInfo myDocVersion)
{
MyParent = myParent;
MyDocVersion=myDocVersion;
InitializeComponent();
SetupFolder(MyDocVersion.FolderID);
tc.MySessionInfo = MyParent.MySessionInfo;
displaySearch1.TopFolderID = myDocVersion.FolderID;
SelectedDVI = myDocVersion;
tc.VersionID = myDocVersion.VersionID;
}
public void OpenItem(ItemInfo myItemInfo)
{
tc.OpenItem(myItemInfo);
}
public void RefreshItem(ItemInfo myItemInfo)
{
tc.RefreshItem(myItemInfo);
}
public frmVEPROMS()
{
// The following Try/Catch was added to protect against a problem seen by Kathy and Michelle
@ -280,7 +318,13 @@ namespace VEPROMS
else if (parameter.ToUpper().StartsWith("/UF"))
UpdateFormats(null);
}
VETreeNode tn = VETreeNode.GetFolder(1);
SetupFolder(1);
tc.VersionID = 0;
}
private void SetupFolder(int folderID)
{
VETreeNode tn = VETreeNode.GetFolder(folderID);
tv.Nodes.Add(tn);
tv.NodePSI += new vlnTreeViewPSIEvent(tv_NodePSI);
tv.NodeSI += new vlnTreeViewSIEvent(tv_NodeSI);
@ -293,9 +337,9 @@ namespace VEPROMS
tv.NodeInsert += new vlnTreeViewEvent(tv_NodeInsert);
tv.PasteItemInfo += new vlnTreeViewItemInfoPasteEvent(tv_PasteItemInfo);
tv.GetChangeId += new vlnTreeViewGetChangeIdEvent(tv_GetChangeId);
tv.NodeCopy += new vlnTreeViewEvent(tv_NodeCopy);
tv.ClipboardStatus += new vlnTreeViewClipboardStatusEvent(tv_ClipboardStatus);
tv.ProgressBar = bottomProgBar;
tv.NodeCopy += new vlnTreeViewEvent(tv_NodeCopy);
tv.ClipboardStatus += new vlnTreeViewClipboardStatusEvent(tv_ClipboardStatus);
tv.ProgressBar = bottomProgBar;
tc.ItemPaste += new StepPanelItemPastedEvent(tc_ItemPasted);
displayHistory.HistorySelectionChanged += new DisplayHistoryEvent(displayHistory_HistorySelectionChanged);
_CommentTitleBckColor = epAnnotations.TitleStyle.BackColor1.Color;
@ -329,7 +373,7 @@ namespace VEPROMS
tv.ProcedureCheckedOutTo += new vlnTreeViewEvent(tv_ProcedureCheckedOutTo);
tv.ViewPDF += new vlnTreeViewPdfEvent(tv_ViewPDF);
displayApplicability.ApplicabilityViewModeChanged += new DisplayApplicability.DisplayApplicabilityEvent(displayApplicability_ApplicabilityViewModeChanged);
tv.ExportImportProcedureSets += new vlnTreeViewEvent(tv_ExportImportProcedureSets);
tv.ExportImportProcedureSets += new vlnTreeViewEvent(tv_ExportImportProcedureSets);
tv.PrintTransitionReport += new vlnTreeViewEvent(tv_PrintTransitionReport);
tv.ProcessingComplete += tv_ProcessingComplete;
tv.Processing += tv_Processing;
@ -923,22 +967,25 @@ namespace VEPROMS
}
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
{
if (MyActivityTimer != null)MyActivityTimer.Dispose();
if(MySessionInfo != null)MySessionInfo.EndSession();
// Save the location and size of the VE-PROMS appication for this user
if (this.WindowState == FormWindowState.Normal)
if (MyParent == null)
{
Settings.Default.Location = this.Location;
Settings.Default.Size = this.Size;
if (MyActivityTimer != null) MyActivityTimer.Dispose();
if (MySessionInfo != null) MySessionInfo.EndSession();
// Save the location and size of the VE-PROMS appication for this user
if (this.WindowState == FormWindowState.Normal)
{
Settings.Default.Location = this.Location;
Settings.Default.Size = this.Size;
}
if (this.MyVersionWindowList != null)
Settings.Default.VersionWindows = this.MyVersionWindowList.ToSettings();
Settings.Default.WindowState = this.WindowState;
Settings.Default.QATItems = ribbonControl1.QatLayout;
SaveMRU();
//Settings.Default.Save();
Volian.Base.Library.DebugPagination.Close();
Volian.Base.Library.DebugText.Close();
}
if(this.MyVersionWindowList != null)
Settings.Default.VersionWindows = this.MyVersionWindowList.ToSettings();
Settings.Default.WindowState = this.WindowState;
Settings.Default.QATItems = ribbonControl1.QatLayout;
SaveMRU();
//Settings.Default.Save();
Volian.Base.Library.DebugPagination.Close();
Volian.Base.Library.DebugText.Close();
}
void frmVEPROMS_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
@ -947,13 +994,16 @@ namespace VEPROMS
// RHM 20121010
// Something was causing the process to remain in memory for an extended period of time
// after printing procedures. The following lines kills the process immediately.
try
if (MyParent == null)
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
catch (Exception ex)
{
_MyLog.Warn("Attempting to Close", ex);
try
{
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
catch (Exception ex)
{
_MyLog.Warn("Attempting to Close", ex);
}
}
}
// Get the "Procedures" Panel Heading (title).
@ -1022,7 +1072,16 @@ namespace VEPROMS
}
}
private SessionInfo MySessionInfo;
private SessionInfo _MySessionInfo;
public SessionInfo MySessionInfo
{
get {
if (_MySessionInfo == null)
_MySessionInfo = MyParent.MySessionInfo;
return _MySessionInfo;
}
set { _MySessionInfo = value; }
}
private System.Threading.Timer MyActivityTimer;
private System.Threading.Timer MyRefreshTimer;
private DevComponents.DotNetBar.ButtonItem btnManageSecurity;
@ -1204,20 +1263,20 @@ namespace VEPROMS
tmrCloseTabItems.Enabled = true;
CloseSessionsNoLongerActive();
MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id);
if (MySessionInfo == null)
{
MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked");
Application.Exit();
}
this.LastContentChange = MySessionInfo.LastContentChange;
_MyLog.WarnFormat("Original last content change {0}", this.LastContentChange);
RefreshLastChange();
if (MySessionInfo == null)
{
MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked");
Application.Exit();
}
tc.MySessionInfo = MySessionInfo;
tv.MySessionInfo = MySessionInfo;
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
if(!System.Diagnostics.Debugger.IsAttached)// running in Production Mode (Not in the debugger)
if (!System.Diagnostics.Debugger.IsAttached)// running in Production Mode (Not in the debugger)
{
System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
@ -1232,7 +1291,7 @@ namespace VEPROMS
// get the saved location and size of the VE-PROMS appication for this user
this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox
this.txtSearch.TextChanged+=txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
this.txtSearch.TextChanged += txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox
this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox
this.btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multiline ItemID TextBox
@ -1243,7 +1302,7 @@ namespace VEPROMS
// if the Procedures panel was left open from the last session, then open it
epProcedures.Expanded = Settings.Default.TreeviewExpanded;
if (Settings.Default["QATItems"] != null) ribbonControl1.QatLayout = Settings.Default.QATItems;
// See if any database 'changes' need done and do them:
MakeDatabaseChanges();
@ -1253,11 +1312,14 @@ namespace VEPROMS
// if the user selected to "Remember Last" (was "Save Expanded") then use the MRU list to
// expand the tree to the last opened procedure
//if (epProcedures.Expanded && _MyMRIList.Count > 0)
if (Settings.Default.SaveTreeviewExpanded && _MyMRIList.Count > 0)
if (MyParent == null)
{
tv.AdjustTree(_MyMRIList[0].MyItemInfo.MyProcedure);
tv.SelectedNode.Expand();
SetCaption(tv.SelectedNode as VETreeNode);
if (Settings.Default.SaveTreeviewExpanded && _MyMRIList.Count > 0)
{
tv.AdjustTree(_MyMRIList[0].MyItemInfo.MyProcedure);
tv.SelectedNode.Expand();
SetCaption(tv.SelectedNode as VETreeNode);
}
}
//get version windows settings
MyVersionWindowList = VersionWindowList.GetVersionWindowList(Properties.Settings.Default.VersionWindows);
@ -1273,13 +1335,14 @@ namespace VEPROMS
ctrlAnnotationDetails.SetupAnnotations(displaySearch1);
SetupButtons();
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown);
office2007StartButton1.MouseDown += new MouseEventHandler(office2007StartButton1_MouseDown);
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
tc.Enter += new EventHandler(tc_Enter);
tc.Leave += new EventHandler(tc_Leave);
tc.StatusChanged += new DisplayTabControlStatusEvent(tc_StatusChanged);
tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded);
tc.OpenEnhancedDocument += tc_OpenEnhancedDocument;
tc.RefreshEnhancedDocument += tc_RefreshEnhancedDocument;
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
@ -1300,7 +1363,7 @@ namespace VEPROMS
// btnAdmin.Visible = false;
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
Activate();
Activate();
//FolderInfo fi = FolderInfo.Get(1);
//FormatInfo frmI = FormatInfo.Get(fi.FormatID ?? 1);
//if (frmI.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
@ -1308,12 +1371,34 @@ namespace VEPROMS
// dlgChgId dlgCI = new dlgChgId(tc);
// dlgCI.ShowDialog(this);
//}
// RHM20150506 Multiline ItemID TextBox
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetItemIDs().Replace(",","\r\n");
// Open First Item
if (this.txtSearch.Text.Length > 0 && !this.txtSearch.Text.Contains("\r\n"))
CurrentID = txtSearch.Text;
// RHM20150506 Multiline ItemID TextBox
if (MyParent == null)
{
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetItemIDs().Replace(",", "\r\n");
// Open First Item
if (this.txtSearch.Text.Length > 0 && !this.txtSearch.Text.Contains("\r\n"))
CurrentID = txtSearch.Text;
}
}
void tc_RefreshEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)
{
// if the procedure is opened then move to the select step
if (!Properties.Settings.Default.SeparateWindows)
{
tc.RefreshItem(args.MyItemInfo);
}
else
{
int versionID = args.MyItemInfo.MyDocVersion.VersionID;
frmVEPROMS child = null;
if (EnhancedForms.ContainsKey(versionID))
{
child = EnhancedForms[versionID];
child.RefreshItem(args.MyItemInfo);
}
}
}
/// <summary>
/// This looks for sessions associated with the current PC and user which are no longer active and removes them.
/// This will in-turn close any related procedure owner records and allow the user to re-open a previously open procedure.
@ -1342,6 +1427,22 @@ namespace VEPROMS
// return true;
// return false;
//}
Dictionary<int, frmVEPROMS> _EnhancedForms=null;
public Dictionary<int, frmVEPROMS> EnhancedForms
{
get
{
if(_EnhancedForms == null)
{
if (_MyParent == null)
_EnhancedForms = new Dictionary<int, frmVEPROMS>();
else
_EnhancedForms = MyParent.EnhancedForms;
}
return _EnhancedForms;
}
set { _EnhancedForms = value; }
}
void tc_OpenEnhancedDocument(object sender, ItemSelectedChangedEventArgs args)
{
if (!Properties.Settings.Default.SeparateWindows)
@ -1350,45 +1451,75 @@ namespace VEPROMS
}
else
{
if (!tc.dicEnhancedDocuments.ContainsKey(args.MyItemInfo.MyProcedure.MyDocVersion))
int versionID = args.MyItemInfo.MyDocVersion.VersionID;
if(MyParent != null && args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.Count > 0
&& !args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.HasSourcePointer)
{
frmEnhanced frm = new frmEnhanced(args.MyItemInfo);
foreach (VersionWindow vw in MyVersionWindowList)
if (vw.VersionID == args.MyItemInfo.MyProcedure.MyDocVersion.VersionID)
{
frm.SetDesktopBounds(vw.MyRectangle.Left, vw.MyRectangle.Top, vw.MyRectangle.Width, vw.MyRectangle.Height);
break;
}
frm.Move += frmEnhancedDocumentResize;
frm.Resize += frmEnhancedDocumentResize;
frm.MySessionInfo = MySessionInfo;
tc.dicEnhancedDocuments.Add(args.MyItemInfo.MyProcedure.MyDocVersion, frm);
frm.FormClosed += frm_FormClosed;
//frm.Show(this); When this was specified the child form displayed on top of the parent form.
frm.Show(); // With this removed either form can be on top (user selectable - currently active form on top)
MyParent.OpenItem(args.MyItemInfo);
return;
}
frmVEPROMS child = null;
if (EnhancedForms.ContainsKey(versionID))
child = EnhancedForms[versionID];
else
{
frmEnhanced frm = tc.dicEnhancedDocuments[args.MyItemInfo.MyProcedure.MyDocVersion];
frm.MyItemInfo = args.MyItemInfo;
frm.OpenItem();
child = CreateEnhancedWindow(args.MyItemInfo.MyDocVersion);
}
child.OpenItem(args.MyItemInfo);
//if (!tc.dicEnhancedDocuments.ContainsKey(args.MyItemInfo.MyProcedure.MyDocVersion))
//{
// frmEnhanced frm = new frmEnhanced(args.MyItemInfo);
// frm.MySessionInfo = MySessionInfo;
// tc.dicEnhancedDocuments.Add(args.MyItemInfo.MyProcedure.MyDocVersion, frm);
// frm.FormClosed += frm_FormClosed;
// //frm.Show(this); When this was specified the child form displayed on top of the parent form.
// frm.Show(); // With this removed either form can be on top (user selectable - currently active form on top)
//}
//else
//{
// frmEnhanced frm = tc.dicEnhancedDocuments[args.MyItemInfo.MyProcedure.MyDocVersion];
// frm.MyItemInfo = args.MyItemInfo;
// frm.OpenItem();
//}
}
}
}
void frmEnhancedDocumentResize(object sender, EventArgs e)
private frmVEPROMS CreateEnhancedWindow(DocVersionInfo dvi)
{
frmEnhanced frm = sender as frmEnhanced;
RectangleConverter rc = new RectangleConverter();
string str = string.Format("{0}~{1}", frm.MyItemInfo.MyProcedure.MyDocVersion.VersionID, rc.ConvertToString(frm.DesktopBounds));
MyVersionWindowList.Add(new VersionWindow(str));
frmVEPROMS child;
if (EnhancedForms.ContainsKey(dvi.VersionID))
{
child = EnhancedForms[dvi.VersionID];
}
else{
child = new frmVEPROMS(this, dvi);
EnhancedForms.Add(dvi.VersionID, child);
child.Visible = false;
child.Show();
foreach (VersionWindow vw in MyVersionWindowList)
if (vw.VersionID == dvi.VersionID)
{
child.SetDesktopBounds(vw.MyRectangle.Left, vw.MyRectangle.Top, vw.MyRectangle.Width, vw.MyRectangle.Height);
break;
}
child.Visible = true;
child.Move += child_MoveOrSize;
child.Resize += child_MoveOrSize;
child.FormClosed += child_FormClosed;
}
return child;
}
void frm_FormClosed(object sender, FormClosedEventArgs e)
void child_FormClosed(object sender, FormClosedEventArgs e)
{
tc.dicEnhancedDocuments.Remove((sender as frmEnhanced).MyItemInfo.MyProcedure.MyDocVersion);
EnhancedForms.Remove((sender as frmVEPROMS).MyDocVersion.VersionID) ;
}
void child_MoveOrSize(object sender, EventArgs e)
{
frmVEPROMS frm = sender as frmVEPROMS;
RectangleConverter rc = new RectangleConverter();
string str = string.Format("{0}~{1}", frm.MyDocVersion.VersionID, rc.ConvertToString(frm.DesktopBounds));
MyVersionWindowList.Add(new VersionWindow(str));
}
private bool HasSetAdministrator(UserInfo ui)
{
DocVersionInfoList dvil = DocVersionInfoList.Get();
@ -1646,16 +1777,19 @@ namespace VEPROMS
Membership.MakeMembership(u, g, null, "");
}
}
if (VlnSettings.GetCommandFlag("VeauLeeAnn" + GetSecurityKey()) || VlnSettings.GetCommandFlag("VeauLeeAnnXYZZY" ))
if (MyParent == null)
{
//pop up user list to select from
ContextMenuStrip cms = BuildUserMenu();
while (proxyUser == null)
if (VlnSettings.GetCommandFlag("VeauLeeAnn" + GetSecurityKey()) || VlnSettings.GetCommandFlag("VeauLeeAnnXYZZY"))
{
cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
System.Windows.Forms.Application.DoEvents();
//pop up user list to select from
ContextMenuStrip cms = BuildUserMenu();
while (proxyUser == null)
{
cms.Show(new System.Drawing.Point((System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - cms.Width) / 2, (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - cms.Height) / 2));
System.Windows.Forms.Application.DoEvents();
}
VlnSettings.UserID = proxyUser;
}
VlnSettings.UserID = proxyUser;
}
lblUser.Text = VlnSettings.UserID;
lblUser.MouseDown += new MouseEventHandler(lblUser_MouseDown);
@ -2152,11 +2286,22 @@ namespace VEPROMS
//_MyLog.DebugFormat("tv_BeforeExpand \n{0}",Volian.Base.Library.vlnStackTrace.StackToStringLocal(2,10));
_ExpandingTree = true;
VETreeNode tn = ((VETreeNode)e.Node);
tn.LoadingChildrenDone += new VETreeNodeEvent(tn_LoadingChildrenDone);
tn.LoadingChildrenMax += new VETreeNodeEvent(tn_LoadingChildrenMax);
tn.LoadingChildrenValue += new VETreeNodeEvent(tn_LoadingChildrenValue);
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
tn.LoadChildren(true);
if (MyParent == null &&
Properties.Settings.Default.SeparateWindows && tn.VEObject is FolderInfo
&& (tn.VEObject as FolderInfo).FolderDocVersionCount == 1
&& (tn.VEObject as FolderInfo).FolderDocVersions[0].DocVersionConfig.MyEnhancedDocuments.HasSourcePointer)
{
CreateEnhancedWindow((tn.VEObject as FolderInfo).FolderDocVersions[0]);
tn.Nodes.Clear();
}
else
{
tn.LoadingChildrenDone += new VETreeNodeEvent(tn_LoadingChildrenDone);
tn.LoadingChildrenMax += new VETreeNodeEvent(tn_LoadingChildrenMax);
tn.LoadingChildrenValue += new VETreeNodeEvent(tn_LoadingChildrenValue);
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
tn.LoadChildren(true);
}
}
#region Property Page and Grid
DialogResult tv_NodeOpenProperty(object sender, vlnTreePropertyEventArgs args)
@ -2754,6 +2899,7 @@ namespace VEPROMS
private StepRTB _LastStepRTB = null;
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
{
if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus) return;
btnFixMSWord.Visible = (args != null && ( args.MyItemInfo != null && args.MyEditItem == null));
if (_LastStepRTB != null && !_LastStepRTB.Disposing && !_LastStepRTB.Closed)
_LastStepRTB.EditModeChanged -= new StepRTBEvent(_LastStepRTB_EditModeChanged);
@ -2882,6 +3028,19 @@ namespace VEPROMS
E_ROValueType.Table : (SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyItemInfo.IsFigure) ? E_ROValueType.Image : E_ROValueType.Text;
if (_LastStepRTB.IsRoTable && _LastStepRTB.MyItemInfo.MyContent.ContentRoUsageCount > 0)
displayRO.CurROLink = _LastStepRTB.MyItemInfo.MyContent.ContentRoUsages[0];
// if this is an enhanced step (linked from a source document), don't bring up the ro or transition panel,
// and don't allow replace on the find/replace dialog.
if (args.MyItemInfo.IsEnhancedStep)
{
// originally had these two lines to make the step properties panel/tran & ro tabs invisitble for
// enhanced steps but this was causing an error in the caret management code in StepTabPanel (Hide/ShowCaret)
//infotabTransition.Visible = false;
//infotabRO.Visible = false;
// RHM: Had to use a timer to keep from getting into an infinite loop
// Not sure why , but tc_Leave was being called over and over again.
//KBR:TmrSetTransROInVisible.Enabled = true;
}
}
else
{
@ -2896,7 +3055,28 @@ namespace VEPROMS
}
btnPrint.Enabled = (_CurrentItem != null);
}
/*KBR:Timer _tmrSetTransROInVisible;
public Timer TmrSetTransROInVisible
{
get
{
if (_tmrSetTransROInVisible == null)
{
_tmrSetTransROInVisible = new Timer();
_tmrSetTransROInVisible.Enabled = false;
_tmrSetTransROInVisible.Interval = 50;
_tmrSetTransROInVisible.Tick += _tmrSetTransROInVisible_Tick;
}
return _tmrSetTransROInVisible;
}
}
void _tmrSetTransROInVisible_Tick(object sender, EventArgs e)
{
TmrSetTransROInVisible.Enabled = false;
infotabTransition.Visible = false;
infotabRO.Visible = false;
}
*/
void _LastStepRTB_EditModeChanged(object sender, EventArgs args)
{
if (_LastStepRTB.EditMode) // going into edit mode in a cell of the grid.
@ -3482,7 +3662,7 @@ namespace VEPROMS
}
}
}
#region Lock stuff
#region Lock stuff / used for multi-user support
public class TabItemsToClose : Stack<DisplayTabItem>
{
public void PushDTI(DisplayTabItem dti)
@ -3512,4 +3692,71 @@ namespace VEPROMS
}
}
#endregion
public class VersionWindow
{
private int _VersionID;
public int VersionID
{
get { return _VersionID; }
set { _VersionID = value; }
}
private int _DBId;
public int DBId
{
get { return _DBId; }
set { _DBId = value; }
}
private Rectangle _MyRectangle;
public Rectangle MyRectangle
{
get { return _MyRectangle; }
set { _MyRectangle = value; }
}
public override string ToString()
{
RectangleConverter rc = new RectangleConverter();
return string.Format("{0}~{1}", _VersionID, rc.ConvertToString(_MyRectangle));
}
public VersionWindow(string str)
{
string[] parts = str.Split('~');
_VersionID = int.Parse(parts[0]);
RectangleConverter rc = new RectangleConverter();
_MyRectangle = (Rectangle)rc.ConvertFromString(parts[1]);
}
}
public class VersionWindowList : List<VersionWindow>
{
public static VersionWindowList GetVersionWindowList(System.Collections.Specialized.StringCollection list)
{
VersionWindowList vwl = new VersionWindowList();
if (list != null)
{
foreach (string str in list)
vwl.Add(new VersionWindow(str));
}
return vwl;
}
public System.Collections.Specialized.StringCollection ToSettings()
{
if (Count == 0) return null;
System.Collections.Specialized.StringCollection retval = new System.Collections.Specialized.StringCollection();
foreach (VersionWindow vw in this)
retval.Add(vw.ToString());
return retval;
}
public new void Add(VersionWindow versionWindow)
{
foreach (VersionWindow vw in this)
{
if (vw.VersionID == versionWindow.VersionID)
{
this.Remove(vw);
break;
}
}
base.Add(versionWindow);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@ namespace VEPROMS
{
private List<MiniConfig> _Apples;
private List<MiniConfig> _DeletedApples;
private List<EnhancedMiniConfig> _Enhanced;
private bool _Initializing = false;
private DocVersionConfig _DocVersionConfig;
@ -78,7 +79,7 @@ namespace VEPROMS
}
max++;
System.Xml.XmlNode nn = xd.CreateElement("Slave");
AddSlaveAttribute(nn,"index",max.ToString());
AddSlaveAttribute(nn, "index", max.ToString());
AddSlaveAttribute(nn, "ID", mc.ID);
AddSlaveAttribute(nn, "Name", mc.Name);
AddSlaveAttribute(nn, "Number", mc.Number);
@ -94,7 +95,7 @@ namespace VEPROMS
sn.AppendChild(nn);
return xd.OuterXml;
}
private void AddSlaveAttribute(System.Xml.XmlNode nn,string name,string value)
private void AddSlaveAttribute(System.Xml.XmlNode nn, string name, string value)
{
System.Xml.XmlAttribute xa = nn.OwnerDocument.CreateAttribute(name);
xa.InnerText = value;
@ -106,7 +107,7 @@ namespace VEPROMS
{
if (_DeletedApples != null && _DeletedApples.Count > 0)
{
foreach(MiniConfig mc in _DeletedApples)
foreach (MiniConfig mc in _DeletedApples)
_DocVersionConfig.RemoveSlave(mc.Index);
}
foreach (MiniConfig mc in _Apples)
@ -138,6 +139,27 @@ namespace VEPROMS
}
}
}
if (_Enhanced != null)
{
foreach (EnhancedMiniConfig emc in _Enhanced)
{
if (emc.IsDirty)
{
foreach (DVEnhancedDocument dved in _DocVersionConfig.MyEnhancedDocuments)
{
if (dved.Type == Convert.ToInt32(emc.Type))
{
// pdfxoffset must be int? how to check
dved.Name = emc.Name;
dved.PdfToken = emc.PdfToken;
dved.PdfX = Convert.ToInt32(emc.PdfXOffset);
}
}
}
}
_DocVersionConfig.SaveDVEnhancedDocuments();
}
_DocVersionConfig.Print_UnitNumberForPageList = ppTxbxUnitNum.Text;
docVersionConfigBindingSource.EndEdit();
@ -296,7 +318,7 @@ namespace VEPROMS
ppCmbxProcSetType.DisplayMember = "Description";
ppCmbxProcSetType.ValueMember = "EValue";
ppCmbxProcSetType.Enabled = false; // maybe enable this if used for version creation
// check active format to see if the unit number text box on the format tab is visible.
if (_DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.PrintData.UnitNumber)
{
@ -355,35 +377,174 @@ namespace VEPROMS
}
else
{
Button btnPC = new Button();
btnPC.Text = "Add Applicability to Working Draft";
btnPC.Width = 250;
btnPC.Location = new Point(25, 271);
btnPC.Parent = tcpGeneral;
btnPC.Click += new EventHandler(btnPC_Click);
btnApplicability.Visible = false;
tiApplicability.Visible = false;
Button btnPC = new Button();
btnPC.Text = "Add Applicability to Working Draft";
btnPC.Width = 250;
btnPC.Location = new Point(25, 271);
btnPC.Parent = tcpGeneral;
btnPC.Click += new EventHandler(btnPC_Click);
btnApplicability.Visible = false;
tiApplicability.Visible = false;
}
ppTxtBxPDFLoc.TextChanged += new EventHandler(ppTxtBxPDFLoc_TextChanged);
//end add new applicability stuff
lblProcSetRev.Visible = ppRTxtProcSetRev.Visible = _DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.MyStepSectionPrintData.UseXtraRevNumber;
_Initializing = false;
// the phone list button is only visible if the format has the print/phonelist format flag.
btnPhoneList.Visible = _DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.SectData.PrintPhoneList;
}
void btnPC_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "Are you sure you want to add Applicability to this Working Draft?", "Add Applicability", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop) == DialogResult.Yes)
{
btnApplicability.Visible = true;
tiApplicability.Visible = true;
Button btnPC = (Button)sender;
btnPC.Visible = false;
btnApplicability_Click(sender, e);
}
}
InitEnhanced();
_Initializing = false;
}
private void InitEnhanced()
{
// first determine if enhanced tab should be turned off: KBR HOW?
// get enhanced tab's data if:
// 1) hasEnhancedPO: this is source and format file has the purchase options for enhanced deviation or enhanced background
// 2) isEnhanced: this docversion has a config/enhanced node that defines it as an enhanced document.
bool hasEnhancedPO = true; // for now all can be enhanced
bool isEnhanced = (_DocVersionConfig.MyEnhancedDocuments != null && _DocVersionConfig.MyEnhancedDocuments.Count == 1 && _DocVersionConfig.MyEnhancedDocuments[0].Type == 0);
// isEnhanced is an already existing enhanced document. Only allow the user to change the Pdf settings:
if (isEnhanced)
{
_Enhanced = new List<EnhancedMiniConfig>();
// only display the data from the config setting. And only allow modify of PdfID and PdfXoffset
lbEnhanced.Visible = false;
lblEnhSet.Visible = false;
DocVersionInfo dvi = DocVersionInfo.Get(_DocVersionConfig.MyEnhancedDocuments[0].VersionID);
DVEnhancedDocument dvedUseData = _DocVersionConfig.MyEnhancedDocuments[0];
DocVersionConfig dvc = dvi.MyConfig as DocVersionConfig;
EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, "?", dvi.SearchDVPath, dvedUseData.Name, dvedUseData.Type.ToString(), dvedUseData.PdfToken, dvedUseData.PdfX.ToString());
cbxEnhVersions.Items.Add(dvi.SearchDVPath);
tbEnhName.Enabled = false;
tbEnhType.Enabled = false;
_Enhanced.Add(ecfg);
bsMiniEnhanced.DataSource = _Enhanced;
cbxEnhVersions.SelectedIndex = 0;
cbxEnhVersions.Enabled = false;
}
// This is a source document that already has settings KBR ? - Can additions can be made
else if (hasEnhancedPO)
{
// first set up existing enhanced linked documents (this is a listbox on left of form)
_Enhanced = new List<EnhancedMiniConfig>();
lbEnhanced.Visible = true;
lblEnhSet.Visible = true;
foreach (DVEnhancedDocument dved in _DocVersionConfig.MyEnhancedDocuments)
{
DocVersionInfo dvi = DocVersionInfo.Get(dved.VersionID);
DocVersionConfig dvc = dvi.MyConfig as DocVersionConfig;
EnhancedMiniConfig ecfg = new EnhancedMiniConfig(0, dvi.VersionID, "?", dvi.SearchDVPath, dved.Name, dved.Type.ToString(), dved.PdfToken, dved.PdfX.ToString());
cbxEnhVersions.Items.Add(dvi.SearchDVPath);
_Enhanced.Add(ecfg);
}
tbEnhName.Enabled = true;
tbEnhType.Enabled = false;
cbxEnhVersions.Enabled = false;
bsEnhanced.DataSource = _Enhanced;
if (cbxEnhVersions.Items.Count>0) cbxEnhVersions.SelectedIndex = 0;
if (lbEnhanced.Items.Count > 0) lbEnhanced.SelectedIndex = 0;
bsMiniEnhanced.DataSource = bsEnhanced.Current as EnhancedMiniConfig;
}
}
//private void InitEnhancedOld()
//{
// // get enhanced tab's data if:
// // 1) hasEnhancedPO: this is source and format file has the purchase options for enhanced deviation or enhanced background
// // 2) isEnhanced: this docversion has a config/enhanced node that defines it as an enhanced document.
// bool hasEnhancedPO = true;
// //if (((_DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)
// // || ((_DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) hasEnhancedPO = true;
// bool isEnhanced = (_DocVersionConfig.MyEnhancedDocuments != null && _DocVersionConfig.MyEnhancedDocuments.Count == 1 && _DocVersionConfig.MyEnhancedDocuments[0].Type == 0);
// if (hasEnhancedPO || isEnhanced)
// {
// // need to filter the list and add only those that are set for the current doc version whose properties
// // we are working with, or that have no setting. (If the docversion has a source that is not this one, don't list)
// DocVersionInfoList dvil = DocVersionInfoList.Get();
// _Enhanced = new List<EnhancedMiniConfig>();
// DVEnhancedDocument dvedUseData = null;
// int indxDataSource = 0;
// for (int ie = 0; ie < dvil.Count; ie++)
// {
// DocVersionInfo dvi = dvil[ie];
// // get config items for filling in the data:
// DocVersionConfig dvc = dvi.MyConfig as DocVersionConfig;
// // need to see if it should be include
// bool includeit = false;
// if (isEnhanced && dvi.VersionID == _DocVersionConfig.MyDocVersion.VersionID)
// {
// dvedUseData = dvc.MyEnhancedDocuments[0];
// includeit = true;
// }
// if (hasEnhancedPO && !isEnhanced)
// {
// // if this docversion has no relationships, include it:
// if (dvc.MyEnhancedDocuments == null || dvc.MyEnhancedDocuments.Count == 0)
// includeit = true;
// else
// {
// //DVEnhancedDocuments dveds = _DocVersionConfig.MyEnhancedDocuments;
// //foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
// //{
// // DVEnhancedDocument dved = dveds[ed.Type];
// // AddLinkToEnhancedDocument(cb, yLocation, ed.ItemID, dved.PdfToken, dved.PdfX);
// //}
// foreach (DVEnhancedDocument ed in dvc.MyEnhancedDocuments) // config for enhanced
// {
// if (ed.VersionID == _DocVersionConfig.MyDocVersion.VersionID)
// {
// // the displayed data is the enhanced config item pointing to this one:
// foreach (DVEnhancedDocument sed in _DocVersionConfig.MyEnhancedDocuments)
// {
// if (sed.VersionID == dvi.VersionID)
// {
// dvedUseData = sed;
// break;
// }
// }
// if (dvedUseData != null)
// {
// includeit = true;
// break;
// }
// }
// }
// }
// }
// if (includeit)
// {
// // get config items for filling in the data:
// EnhancedMiniConfig ecfg = null;
// if (dvedUseData != null)
// ecfg = new EnhancedMiniConfig(indxDataSource, dvi.VersionID, "?", dvi.SearchDVPath, dvedUseData.Name, dvedUseData.Type.ToString(), dvedUseData.PdfToken, dvedUseData.PdfX.ToString());
// else
// ecfg = new EnhancedMiniConfig(indxDataSource, dvi.VersionID, "?", dvi.SearchDVPath, "", "", "", "");
// indxDataSource++;
// _Enhanced.Add(ecfg);
// dvedUseData = null;
// includeit = false;
// if (isEnhanced) break;
// }
// }
// bsEnhanced.DataSource = _Enhanced;
// }
//}
void btnPC_Click(object sender, EventArgs e)
{
if (MessageBox.Show(this, "Are you sure you want to add Applicability to this Working Draft?", "Add Applicability", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop) == DialogResult.Yes)
{
btnApplicability.Visible = true;
tiApplicability.Visible = true;
Button btnPC = (Button)sender;
btnPC.Visible = false;
btnApplicability_Click(sender, e);
}
}
// The following code was added to fix Bug B2013-117
void ppTxtBxPDFLoc_TextChanged(object sender, EventArgs e)
{
@ -733,7 +894,7 @@ namespace VEPROMS
{
// Show or hide the labels containing the default values
//if (!_Initializing)
defaultSettingsVisiblity();
defaultSettingsVisiblity();
}
/// <summary>
@ -834,9 +995,9 @@ namespace VEPROMS
{
if (defaultText != null && !(defaultText.Equals("")))
{
string deftext = string.Format("{0}", defaultText);
lbl.Text = deftext;
cmbo.WatermarkText = deftext;
string deftext = string.Format("{0}", defaultText);
lbl.Text = deftext;
cmbo.WatermarkText = deftext;
}
}
@ -891,7 +1052,7 @@ namespace VEPROMS
}
Cursor = Cursors.WaitCursor;
SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, _DocVersionConfig.MyDocVersion, SelectedROFst,DoProgressBarRefresh);
ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, _DocVersionConfig.MyDocVersion, SelectedROFst, DoProgressBarRefresh);
SelectedROFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ppBtnUpRoVals.Enabled = _DocVersionConfig.MyDocVersion.NewerRoFst;
Cursor = Cursors.Default;
@ -1127,8 +1288,8 @@ namespace VEPROMS
{
MiniConfig cfg = new MiniConfig();
cfg.Name = "New Applicability";
if (_Apples == null)
_Apples = new List<MiniConfig>();
if (_Apples == null)
_Apples = new List<MiniConfig>();
_Apples.Add(cfg);
bsApples.DataSource = null;
bsApples.DataSource = _Apples;
@ -1153,8 +1314,115 @@ namespace VEPROMS
dlgPhoneList dlgPL = new dlgPhoneList(_DocVersionConfig);
dlgPL.ShowDialog();
}
}
private void btnEnhanced_Click(object sender, EventArgs e)
{
ProcessButtonClick(tiEnhanced, btnEnhanced);
}
private void lbEnhanced_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_Initializing && lbEnhanced.SelectedIndex > -1)
{
bsMiniEnhanced.DataSource = bsEnhanced.Current as EnhancedMiniConfig;
cbxEnhVersions.SelectedIndex = lbEnhanced.SelectedIndex;
}
}
}
[XmlRoot("Enhanced")]
public class EnhancedMiniConfig
{
private static int lastindex = 0;
private bool _isDeleted;
[XmlIgnore]
public bool IsDeleted
{
get { return _isDeleted; }
set { _isDeleted = value; }
}
private bool _isDirty;
[XmlIgnore]
public bool IsDirty
{
get { return _isDirty; }
set { _isDirty = value; }
}
private int _index;
[XmlAttribute("index")]
public int Index
{
get { return _index; }
set { _index = value; IsDirty = true; }
}
private int _versionID;
[XmlAttribute("VersionID")]
public int VersionID
{
get { return _versionID; }
set { _versionID = value; IsDirty = true; }
}
private string _versionPathName;
[XmlAttribute("VersionPathName")]
public string VersionPathName
{
get { return _versionPathName; }
set { _versionPathName = value; IsDirty = true; }
}
private string _name;
[XmlAttribute("Name")]
public string Name
{
get { return _name; }
set { _name = value; IsDirty = true; }
}
private string _type;
[XmlAttribute("Type")]
public string Type
{
get { return _type; }
set { _type = value; IsDirty = true; }
}
private string _pdfToken;
[XmlAttribute("PdfToken")]
public string PdfToken
{
get { return _pdfToken; }
set { _pdfToken = value; IsDirty = true; }
}
private string _pdfXOffset;
[XmlAttribute("PdfXOffset")]
public string PdfXOffset
{
get { return _pdfXOffset; }
set { _pdfXOffset = value; IsDirty = true; }
}
public EnhancedMiniConfig()
{
_index = --lastindex;
_versionID = -1;
_versionPathName = string.Empty;
_name = string.Empty;
_type = string.Empty;
_pdfToken = string.Empty;
_pdfXOffset = string.Empty;
_isDirty = false;
}
public EnhancedMiniConfig(int index, int versionid, string id, string versionPathName, string name, string type, string pdftoken, string pdfxoffset)
{
_index = index;
_versionID = versionid;
_versionPathName = versionPathName;
_name = name;
_type = type;
_pdfToken = pdftoken;
_pdfXOffset = pdfxoffset;
_isDirty = false;
}
public override string ToString()
{
return Name;
}
}
[XmlRoot("Slave")]
public class MiniConfig
{
@ -1273,7 +1541,7 @@ namespace VEPROMS
_otherText = string.Empty;
_isDirty = false;
}
public MiniConfig(int index,string id,string name,string number,string text,string procedurenumber,string setid,string setname,string otherid,string othername,string othernumber,string othertext)
public MiniConfig(int index, string id, string name, string number, string text, string procedurenumber, string setid, string setname, string otherid, string othername, string othernumber, string othertext)
{
_index = index;
_iD = id;

View File

@ -154,7 +154,7 @@ Check "Show Default Settings" to display the "default" Change Bar Custom Message
Check "Show Default Settings" to display the "default" Change Bar Custom Message (below the Line One selection box).</value>
</data>
<metadata name="imageCodecInfoBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
<value>789, 65</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="ppBtnPDFLoc.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -188,7 +188,16 @@ Check "Show Default Settings" to display the "default" duplexing setting (below
- Type in your own text to be placed next to the change bars.</value>
</data>
<metadata name="dlgROFolder.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>237, 56</value>
<value>17, 113</value>
</metadata>
<metadata name="bsMiniEnhanced.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 65</value>
</metadata>
<metadata name="bsEnhanced.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>817, 17</value>
</metadata>
<metadata name="documentInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>181, 113</value>
</metadata>
<data name="btnRoDbProperties.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -206,9 +215,6 @@ Check "Show Default Settings" to display the "default" duplexing setting (below
gg==
</value>
</data>
<metadata name="documentInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 56</value>
</metadata>
<metadata name="bsMiniApple.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 17</value>
</metadata>
@ -219,12 +225,12 @@ Check "Show Default Settings" to display the "default" duplexing setting (below
<value>238, 17</value>
</metadata>
<metadata name="PDFLocationBrowserDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>770, 17</value>
<value>213, 65</value>
</metadata>
<metadata name="formatInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>969, 17</value>
<value>495, 65</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>87</value>
<value>118</value>
</metadata>
</root>