C2015-022 Separate Windows Upgrade – supporting code for child windows

This commit is contained in:
John Jenko 2018-03-12 14:31:58 +00:00
parent 4b3fd3a702
commit 400ef655c7
2 changed files with 181 additions and 102 deletions

View File

@ -1607,8 +1607,8 @@ namespace VEPROMS
private DevComponents.DotNetBar.TabItem infotabTags; private DevComponents.DotNetBar.TabItem infotabTags;
private DevComponents.DotNetBar.PanelEx panelEx1; private DevComponents.DotNetBar.PanelEx panelEx1;
private DevComponents.DotNetBar.Controls.CheckBoxX checkBoxX1; //private DevComponents.DotNetBar.Controls.CheckBoxX checkBoxX1;
private System.Windows.Forms.CheckedListBox checkedListBox1; //private System.Windows.Forms.CheckedListBox checkedListBox1;
//private System.Windows.Forms.PropertyGrid pg; //private System.Windows.Forms.PropertyGrid pg;
private DevComponents.DotNetBar.LabelItem labelItem9; private DevComponents.DotNetBar.LabelItem labelItem9;
@ -1617,7 +1617,7 @@ namespace VEPROMS
private DevComponents.DotNetBar.SuperTooltip superTooltip1; private DevComponents.DotNetBar.SuperTooltip superTooltip1;
private System.Windows.Forms.BindingSource itemAnnotationsBindingSource; private System.Windows.Forms.BindingSource itemAnnotationsBindingSource;
private System.Windows.Forms.CheckBox checkBox1; //private System.Windows.Forms.CheckBox checkBox1;
//private DevComponents.DotNetBar.Controls.GroupPanel groupPanel2; //private DevComponents.DotNetBar.Controls.GroupPanel groupPanel2;
//private DevComponents.DotNetBar.Controls.GroupPanel groupPanel1; //private DevComponents.DotNetBar.Controls.GroupPanel groupPanel1;
//private DevComponents.DotNetBar.Controls.GroupPanel groupPanel3; //private DevComponents.DotNetBar.Controls.GroupPanel groupPanel3;
@ -1631,7 +1631,7 @@ namespace VEPROMS
private DevComponents.DotNetBar.GalleryGroup galleryGroup3; private DevComponents.DotNetBar.GalleryGroup galleryGroup3;
//private DevComponents.DotNetBar.Controls.GroupPanel groupPanel4; //private DevComponents.DotNetBar.Controls.GroupPanel groupPanel4;
private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1; //private DevComponents.DotNetBar.Controls.ComboBoxEx comboBoxEx1;
private DevComponents.DotNetBar.NavigationPanePanel navigationPanePanel2; private DevComponents.DotNetBar.NavigationPanePanel navigationPanePanel2;
private DevComponents.DotNetBar.TabControlPanel infotabControlPanelRO; private DevComponents.DotNetBar.TabControlPanel infotabControlPanelRO;
private DevComponents.DotNetBar.TabItem infotabRO; private DevComponents.DotNetBar.TabItem infotabRO;

View File

@ -172,6 +172,7 @@ namespace VEPROMS
get { return _MyDocVersion; } get { return _MyDocVersion; }
set { _MyDocVersion = value; } set { _MyDocVersion = value; }
} }
// C2015-022 setup the child PROMS window
public frmVEPROMS(frmVEPROMS myParent, DocVersionInfo myDocVersion) public frmVEPROMS(frmVEPROMS myParent, DocVersionInfo myDocVersion)
{ {
MyParent = myParent; MyParent = myParent;
@ -182,6 +183,11 @@ namespace VEPROMS
displaySearch1.TopFolderID = myDocVersion.FolderID; displaySearch1.TopFolderID = myDocVersion.FolderID;
SelectedDVI = myDocVersion; SelectedDVI = myDocVersion;
tc.VersionID = myDocVersion.VersionID; tc.VersionID = myDocVersion.VersionID;
tc.SeparateWindows = true; // need to set this in child window for goto Outside Transitions
displayBookMarks.MyBookMarks = MyParent.displayBookMarks.MyBookMarks;
displayBookMarks.SetupBookMarks(); // setup bookmarks in the child window
tc.MyCopyStep = myParent.tc.MyCopyStep; // copy the copystep info to the child window
(tv.Nodes[0] as VETreeNode).InChildWindow = true; // tells us this folder's tree nodes are in the child window
} }
public void OpenItem(ItemInfo myItemInfo) public void OpenItem(ItemInfo myItemInfo)
{ {
@ -288,7 +294,7 @@ namespace VEPROMS
string db = Volian.Base.Library.VlnSettings.GetDB(); string db = Volian.Base.Library.VlnSettings.GetDB();
if(db != null) if(db != null)
Database.SelectedDatabase = db; Database.SelectedDatabase = db;
if (Properties.Settings.Default["DefaultDB"] != string.Empty) if ((string)Properties.Settings.Default["DefaultDB"] != string.Empty)
Database.LastDatabase = Properties.Settings.Default.DefaultDB; Database.LastDatabase = Properties.Settings.Default.DefaultDB;
// Setup the Context menu for DisplaySearch including the symbols // Setup the Context menu for DisplaySearch including the symbols
displaySearch1.SetupContextMenu(); displaySearch1.SetupContextMenu();
@ -326,6 +332,7 @@ namespace VEPROMS
} }
SetupFolder(1); SetupFolder(1);
tc.VersionID = 0; tc.VersionID = 0;
tc.SeparateWindows = Properties.Settings.Default.SeparateWindows;
tv.PauseRefresh += tv_PauseRefresh; tv.PauseRefresh += tv_PauseRefresh;
tv.UnPauseRefresh += tv_UnPauseRefresh; tv.UnPauseRefresh += tv_UnPauseRefresh;
} }
@ -410,6 +417,21 @@ namespace VEPROMS
tv.Processing += tv_Processing; tv.Processing += tv_Processing;
tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary); tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary);
tv.SelectDateToStartChangeBars += tv_SelectDateToStartChangeBars; tv.SelectDateToStartChangeBars += tv_SelectDateToStartChangeBars;
displayBookMarks.ResetBookMarksInPROMSWindows += displayBookMarks_ResetBookMarksInPROMSWindows;
}
// Part of Separate Windows upgrade C2015-022
// Extend changeds to BookMark information to all of the child windows
void displayBookMarks_ResetBookMarksInPROMSWindows(object sender, EventArgs args)
{
foreach (int k in PROMSWindowForms.Keys)
{
frmVEPROMS tmp = PROMSWindowForms[k];
if (tmp.MyDocVersion.VersionID != this.SelectedDVI.VersionID)
tmp.displayBookMarks.ResetBookMarkList();
else if (tmp.MyParent != null)
tmp.MyParent.displayBookMarks.ResetBookMarkList();
}
} }
void tv_SelectDateToStartChangeBars(object sender, vlnTreeEventArgs args) void tv_SelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
@ -474,6 +496,7 @@ namespace VEPROMS
VETreeNode tn = args.Node as VETreeNode; VETreeNode tn = args.Node as VETreeNode;
ItemInfo ii = tn.VEObject as ItemInfo; ItemInfo ii = tn.VEObject as ItemInfo;
tc.MyCopyStep = ii; tc.MyCopyStep = ii;
tc_CopyStepSelected(sender, null); // C2015-022 set copy step info in the child windows
} }
void tv_PrintTransitionReport(object sender, vlnTreeEventArgs args) void tv_PrintTransitionReport(object sender, vlnTreeEventArgs args)
{ {
@ -1017,6 +1040,12 @@ namespace VEPROMS
} }
if (SelectedStepTabPanel != null && SelectedStepTabPanel.MyStepTabRibbon != null) if (SelectedStepTabPanel != null && SelectedStepTabPanel.MyStepTabRibbon != null)
SelectedStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(SelectedStepTabPanel.MyStepTabRibbon.NewerRoFst()); SelectedStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(SelectedStepTabPanel.MyStepTabRibbon.NewerRoFst());
// C2015-022 needed when creating a separate window from a tree selection
if (selectedChildWindow != null)
{
selectedChildWindow.Focus();
selectedChildWindow = null;
}
} }
// Add a tree node for a procedure if this is the first procedure in the docversion, added from // Add a tree node for a procedure if this is the first procedure in the docversion, added from
// step editor (used for creating enhanced procedure in empty docversion) // step editor (used for creating enhanced procedure in empty docversion)
@ -1105,7 +1134,10 @@ namespace VEPROMS
// bug fix B2016-005 - set MyCopyStep to null. This will take the paste options off of the tree node context menus. jsj 4-19-2016 // bug fix B2016-005 - set MyCopyStep to null. This will take the paste options off of the tree node context menus. jsj 4-19-2016
// B2016-105 - added null reference check -jsj // B2016-105 - added null reference check -jsj
if (tc.MyCopyStep != null && args.MyItemInfo.ItemID == tc.MyCopyStep.ItemID) if (tc.MyCopyStep != null && args.MyItemInfo.ItemID == tc.MyCopyStep.ItemID)
{
tc.MyCopyStep = null; tc.MyCopyStep = null;
tc_CopyStepSelected(sender, null); // C2015-022 update copystep info in the child windows
}
bool rtval = tc.DeleteRTBItem(args.MyItemInfo); bool rtval = tc.DeleteRTBItem(args.MyItemInfo);
// Also disable the paste options on the ribbon if it is open. jsj 4-19-2016 // Also disable the paste options on the ribbon if it is open. jsj 4-19-2016
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyStepTabPanel != null) // MyStepTabPanel will be null if the active tab is a Word Attachment if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyStepTabPanel != null) // MyStepTabPanel will be null if the active tab is a Word Attachment
@ -1120,6 +1152,7 @@ namespace VEPROMS
{ {
return tc.PasteRTBItem(args.MyItemInfo, args.CopyStartID, args.PasteType, (int)args.Type); return tc.PasteRTBItem(args.MyItemInfo, args.CopyStartID, args.PasteType, (int)args.Type);
} }
private bool _RemoveFromPROMSWindowForms = true;
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e) private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
{ {
// B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well // B2017-212 If the user uses the X button in Word to close the word attachment, PROMS thinks that the user wants to close out of PROMS as well
@ -1135,16 +1168,45 @@ namespace VEPROMS
return; return;
} }
} }
//C2015-022 Separate Windows - if child windows are open and we are closing the main PROMS window, give user a chance to not close PROMS and that child windows
if (MyParent == null && PROMSWindowForms.Count > 0)
{
DialogResult dr = MessageBox.Show("Close all of the child windows and exit PROMS?", "Exit PROMS", MessageBoxButtons.YesNo);
if (dr == System.Windows.Forms.DialogResult.No)
{
e.Cancel = true;
return;
}
}
tc.ShuttingDown = true; // This keeps PROMS from Hanging under certain circumstances tc.ShuttingDown = true; // This keeps PROMS from Hanging under certain circumstances
foreach (DisplayTabItem dti in tc.MyBar.Items) foreach (DisplayTabItem dti in tc.MyBar.Items)
{ {
if (dti.MyDSOTabPanel != null) if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.CloseDSO(); dti.MyDSOTabPanel.CloseDSO();
else
MySessionInfo.CheckInItem(dti.OwnerID); //C2015-022 Separate Windows closing child form only left procedure ownership active
} }
//_MyLog.WarnFormat("frmVEPROMS_FormClosing"); //_MyLog.WarnFormat("frmVEPROMS_FormClosing");
if (MyParent == null) if (MyParent == null)
{ {
if (MyActivityTimer != null) MyActivityTimer.Dispose(); if (MyActivityTimer != null)
{
MyActivityTimer.Dispose();
_MyLog.Debug("VEPROMS FormClosing - dispose timer");
}
// part of separate windows upgrade C2015-022
// close all of the child windows before closing the main PROMS window
if (PROMSWindowForms != null && PROMSWindowForms.Count > 0)
{
foreach (int k in PROMSWindowForms.Keys)
{
frmVEPROMS child = PROMSWindowForms[k];
_RemoveFromPROMSWindowForms = false;
child._RemoveFromPROMSWindowForms = false;
child.Close();
child.MySessionInfo.EndSession();
}
}
if (MySessionInfo != null) MySessionInfo.EndSession(); if (MySessionInfo != null) MySessionInfo.EndSession();
// Save the location and size of the VE-PROMS appication for this user // Save the location and size of the VE-PROMS appication for this user
if (this.WindowState == FormWindowState.Normal) if (this.WindowState == FormWindowState.Normal)
@ -1268,7 +1330,7 @@ namespace VEPROMS
set { _MySessionInfo = value; } set { _MySessionInfo = value; }
} }
private System.Threading.Timer MyActivityTimer; private System.Threading.Timer MyActivityTimer;
private System.Threading.Timer MyRefreshTimer; //private System.Threading.Timer MyRefreshTimer;
private DevComponents.DotNetBar.ButtonItem btnManageSecurity; private DevComponents.DotNetBar.ButtonItem btnManageSecurity;
private DevComponents.DotNetBar.ButtonItem btnResetSecurity; private DevComponents.DotNetBar.ButtonItem btnResetSecurity;
private DevComponents.DotNetBar.ButtonItem btnAdministrativeTools; private DevComponents.DotNetBar.ButtonItem btnAdministrativeTools;
@ -1327,6 +1389,7 @@ namespace VEPROMS
} }
if (tnNew != null) tv.SelectedNode = tnNew; if (tnNew != null) tv.SelectedNode = tnNew;
} }
MySemaphore.Release(); // ping session control
} }
private void StartRefreshChanged(Object obj) private void StartRefreshChanged(Object obj)
{ {
@ -1412,6 +1475,7 @@ namespace VEPROMS
public ContentInfo ci3; public ContentInfo ci3;
public Timer tmrCloseTabItems; public Timer tmrCloseTabItems;
public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1); public System.Threading.Semaphore MySemaphore = new System.Threading.Semaphore(1, 1);
private bool _frmVEPROMSloading = false;
private void frmVEPROMS_Load(object sender, EventArgs e) private void frmVEPROMS_Load(object sender, EventArgs e)
{ {
InitializeSecurity(); InitializeSecurity();
@ -1493,7 +1557,7 @@ namespace VEPROMS
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); System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession);
MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000); if (this._MyParent == null) MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
// System.Threading.Thread.Sleep(5000); // System.Threading.Thread.Sleep(5000);
// System.Threading.TimerCallback timerRefresh = new System.Threading.TimerCallback(this.StartRefreshChanged); // System.Threading.TimerCallback timerRefresh = new System.Threading.TimerCallback(this.StartRefreshChanged);
// RefreshTimer.Enabled = true; // RefreshTimer.Enabled = true;
@ -1532,9 +1596,11 @@ namespace VEPROMS
{ {
if (Settings.Default.SaveTreeviewExpanded && _MyMRIList.Count > 0) if (Settings.Default.SaveTreeviewExpanded && _MyMRIList.Count > 0)
{ {
_frmVEPROMSloading = true; // C2015-022 so we don't try to create child windows when proms is first starting and position in the procedure tree
tv.AdjustTree(_MyMRIList[0].MyItemInfo.MyProcedure); tv.AdjustTree(_MyMRIList[0].MyItemInfo.MyProcedure);
tv.SelectedNode.Expand(); tv.SelectedNode.Expand();
SetCaption(tv.SelectedNode as VETreeNode); SetCaption(tv.SelectedNode as VETreeNode);
_frmVEPROMSloading = false;
} }
} }
//get version windows settings //get version windows settings
@ -1558,8 +1624,9 @@ namespace VEPROMS
tc.Leave += new EventHandler(tc_Leave); tc.Leave += new EventHandler(tc_Leave);
tc.StatusChanged += new DisplayTabControlStatusEvent(tc_StatusChanged); tc.StatusChanged += new DisplayTabControlStatusEvent(tc_StatusChanged);
tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded); tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded);
tc.OpenEnhancedDocument += tc_OpenEnhancedDocument; tc.OpenInSeparateWindow += tc_OpenInSeparateWindow;
tc.RefreshEnhancedDocument += tc_RefreshEnhancedDocument; tc.RefreshEnhancedDocument += tc_RefreshEnhancedDocument;
tc.CopyStepSelected += tc_CopyStepSelected; // will extend CopyStep info to all child windows (separate windows upgrade)
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate); this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style"); if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
displaySearch1.Enter += new EventHandler(displaySearch1_Enter); displaySearch1.Enter += new EventHandler(displaySearch1_Enter);
@ -1609,14 +1676,28 @@ namespace VEPROMS
{ {
int versionID = args.MyItemInfo.MyDocVersion.VersionID; int versionID = args.MyItemInfo.MyDocVersion.VersionID;
frmVEPROMS child = null; frmVEPROMS child = null;
if (EnhancedForms.ContainsKey(versionID)) if (PROMSWindowForms.ContainsKey(versionID))
{ {
child = EnhancedForms[versionID]; child = PROMSWindowForms[versionID];
child.RefreshItem(args.MyItemInfo); child.RefreshItem(args.MyItemInfo);
} }
} }
} }
// Part of Separate Windows upgrade C2015-022
// Extend the CopyStep selection information to all of the child windows
void tc_CopyStepSelected(object sender, ItemChangedEventArgs e)
{
foreach (int k in PROMSWindowForms.Keys)
{
frmVEPROMS tmp = PROMSWindowForms[k];
if (tmp.MyDocVersion.VersionID != this.SelectedDVI.VersionID)
tmp.tc.MyCopyStep = tc.MyCopyStep;
else if (tmp.MyParent != null)
tmp.MyParent.tc.MyCopyStep = tc.MyCopyStep;
}
}
/// <summary> /// <summary>
/// This looks for sessions associated with the current PC and user which are no longer active and removes them. /// 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. /// This will in-turn close any related procedure owner records and allow the user to re-open a previously open procedure.
@ -1650,90 +1731,85 @@ namespace VEPROMS
// return true; // return true;
// return false; // return false;
//} //}
Dictionary<int, frmVEPROMS> _EnhancedForms=null;
public Dictionary<int, frmVEPROMS> EnhancedForms // C2015-022 Separate Windows. This is a dictionary of child PROMS windows forms (frmVEPROMS)
//
Dictionary<int, frmVEPROMS> _PROMSWindowForms=null;
public Dictionary<int, frmVEPROMS> PROMSWindowForms
{ {
get get
{ {
if(_EnhancedForms == null) if(_PROMSWindowForms == null)
{ {
if (_MyParent == null) if (_MyParent == null)
_EnhancedForms = new Dictionary<int, frmVEPROMS>(); _PROMSWindowForms = new Dictionary<int, frmVEPROMS>();
else else
_EnhancedForms = MyParent.EnhancedForms; _PROMSWindowForms = MyParent.PROMSWindowForms;
} }
return _EnhancedForms; return _PROMSWindowForms;
} }
set { _EnhancedForms = value; } set { _PROMSWindowForms = value; }
} }
void tc_OpenEnhancedDocument(object sender, ItemSelectedChangedEventArgs args) // This gets called when user opens an enhanced document (ex Background) from the source (ex EOP)
{ // C2015-022 - This also get called if opening a procedure in a child (separate) window
if (!Properties.Settings.Default.SeparateWindows) void tc_OpenInSeparateWindow(object sender, ItemSelectedChangedEventArgs args)
{
tc.OpenItem(args.MyItemInfo);
}
else
{ {
int versionID = args.MyItemInfo.MyDocVersion.VersionID; int versionID = args.MyItemInfo.MyDocVersion.VersionID;
if(MyParent != null && args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.Count > 0 if (MyParent != null && args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.Count > 0
&& !args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.HasSourcePointer) && !args.MyItemInfo.MyDocVersion.DocVersionConfig.MyEnhancedDocuments.HasSourcePointer)
{ {
MyParent.OpenItem(args.MyItemInfo); MyParent.OpenItem(args.MyItemInfo);
return; return;
} }
frmVEPROMS child = null; frmVEPROMS child = null;
if (EnhancedForms.ContainsKey(versionID)) if (PROMSWindowForms.ContainsKey(versionID))
child = EnhancedForms[versionID]; child = PROMSWindowForms[versionID]; // use existing child window
else else
{ {
child = CreateEnhancedWindow(args.MyItemInfo.MyDocVersion); child = CreateChildPromsWindow(args.MyItemInfo.MyDocVersion); // create a new child window for the enhanced document procedure set
tv.AdjustTree(args.MyItemInfo); // find the position in the tree
VETreeNode _tn = tv.SelectedNode as VETreeNode; // get the tree node for args.MyItemInfo
while (!(_tn.VEObject is FolderInfo)) _tn = (VETreeNode)_tn.Parent; // back up to the first folder tree node
_tn.Nodes.Clear(); // remove the child nodes from main window - child window now has this part of the procedure tree
_tn.ChildrenLoaded = false;
_tn.MovedToSeparateWindow = true; // flag used to reload children nodes if the child window is closed and user clicks on the tree node in the main window
} }
child.OpenItem(args.MyItemInfo);
//if (!tc.dicEnhancedDocuments.ContainsKey(args.MyItemInfo.MyProcedure.MyDocVersion)) child.OpenItem(args.MyItemInfo); // this opens to the enhanced document step and expands the tree to the related node (in the child window)
//{
// 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();
//}
} }
} private frmVEPROMS CreateChildPromsWindow(DocVersionInfo dvi) // C2015-022 logic to create separate (child) windows for a procedure set
private frmVEPROMS CreateEnhancedWindow(DocVersionInfo dvi)
{ {
frmVEPROMS child; frmVEPROMS child;
if (EnhancedForms.ContainsKey(dvi.VersionID)) // create a new window for this doc version (procedure set)
{
child = EnhancedForms[dvi.VersionID];
}
else{
child = new frmVEPROMS(this, dvi); child = new frmVEPROMS(this, dvi);
EnhancedForms.Add(dvi.VersionID, child); PROMSWindowForms.Add(dvi.VersionID, child); // keep track of child windows
child.Visible = false; child.Visible = false;
child.Show(); child.Show();
if (MyVersionWindowList != null && MyVersionWindowList.Count > 0)
foreach (VersionWindow vw in MyVersionWindowList) foreach (VersionWindow vw in MyVersionWindowList)
if (vw.VersionID == dvi.VersionID) if (vw.VersionID == dvi.VersionID)
{ {
child.SetDesktopBounds(vw.MyRectangle.Left, vw.MyRectangle.Top, vw.MyRectangle.Width, vw.MyRectangle.Height); child.SetDesktopBounds(vw.MyRectangle.Left, vw.MyRectangle.Top, vw.MyRectangle.Width, vw.MyRectangle.Height);
break; break;
} }
child.office2007StartButton1.Visible = false; // hide V button
child.qatCustomizeItem1.Visible = false; // hide quick access list
child.btnExit.Visible = false; // hide the exit button (closes all of PROMS not just the child window)
child.Visible = true; child.Visible = true;
child.Move += child_MoveOrSize; child.Move += child_MoveOrSize;
child.Resize += child_MoveOrSize; child.Resize += child_MoveOrSize;
child.FormClosed += child_FormClosed; child.FormClosed += child_FormClosed;
} // these next three lines of code will force the child window to display on top of all other windows on the screen
child.TopMost = true; // force child window to the display on top of all others
Application.DoEvents();
child.TopMost = false; // child window will remain on top but now other windows can be displayed on top of it
return child; return child;
} }
void child_FormClosed(object sender, FormClosedEventArgs e)
void child_FormClosed(object sender, FormClosedEventArgs e) // C2015-022 used for Separate Windows logic
{ {
EnhancedForms.Remove((sender as frmVEPROMS).MyDocVersion.VersionID) ; if (_RemoveFromPROMSWindowForms)
PROMSWindowForms.Remove((sender as frmVEPROMS).MyDocVersion.VersionID);
} }
void child_MoveOrSize(object sender, EventArgs e) void child_MoveOrSize(object sender, EventArgs e)
{ {
@ -1886,7 +1962,7 @@ namespace VEPROMS
if (sub.Contains("\r\n")) return sub.Substring(0, sub.IndexOf("\r\n")); if (sub.Contains("\r\n")) return sub.Substring(0, sub.IndexOf("\r\n"));
return sub; return sub;
} }
void txtSearch_KeyPress(object sender, KeyPressEventArgs e) void txtSearch_KeyPress(object sender, KeyPressEventArgs e) // used when running in debug mode, for text box where you enter an ItemID or ContextID number
{ {
if (e.KeyChar == '\r') if (e.KeyChar == '\r')
{ {
@ -1899,7 +1975,7 @@ namespace VEPROMS
OpenMyItem(txtSearch.Text); OpenMyItem(txtSearch.Text);
} }
} }
if (e.KeyChar == 1 || e.KeyChar==22) if (e.KeyChar == 1 || e.KeyChar == 22)
{ {
e.Handled = true; e.Handled = true;
} }
@ -2262,7 +2338,7 @@ namespace VEPROMS
this.Close(); this.Close();
} }
} }
private bool _RunNext = false; //private bool _RunNext = false;
//void prnDlg_FormClosed(object sender, FormClosedEventArgs e) //void prnDlg_FormClosed(object sender, FormClosedEventArgs e)
//{ //{
// _RunNext = true; // _RunNext = true;
@ -2488,13 +2564,23 @@ namespace VEPROMS
return; return;
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null) if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
{ {
// this logic syncs up the place in the procedure tree with the place (step) in the procedure editor (when you click on white space in the tree panel)
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo); tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
tc.SelectedDisplayTabItem.Focus(); tc.SelectedDisplayTabItem.Focus();
SetCaption(tv.SelectedNode as VETreeNode); SetCaption(tv.SelectedNode as VETreeNode);
} }
} }
if (MyParent == null && tn != null && tn.MovedToSeparateWindow)
{
if ((tn.VEObject is FolderInfo) && ((tn.VEObject as FolderInfo).FolderDocVersions != null && !PROMSWindowForms.ContainsKey((int)(tn.VEObject as FolderInfo).FolderDocVersions[0].VersionID)) && tn.Nodes.Count == 0 && !tn.ChildrenLoaded)
{
tn.MovedToSeparateWindow = false;
tn.RefreshNode();
} }
} }
}
}
private frmVEPROMS selectedChildWindow = null; // C2015-022 used for separate windows
/// <summary> /// <summary>
/// This event is fired from the timer after the treeview click event completes /// This event is fired from the timer after the treeview click event completes
/// </summary> /// </summary>
@ -2518,25 +2604,16 @@ namespace VEPROMS
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e) private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{ {
//_MyLog.DebugFormat("tv_BeforeExpand \n{0}",Volian.Base.Library.vlnStackTrace.StackToStringLocal(2,10)); //_MyLog.DebugFormat("tv_BeforeExpand \n{0}",Volian.Base.Library.vlnStackTrace.StackToStringLocal(2,10));
_ExpandingTree = true;
VETreeNode tn = ((VETreeNode)e.Node); VETreeNode tn = ((VETreeNode)e.Node);
if (MyParent == null && if (tn == null)
Properties.Settings.Default.SeparateWindows && tn.VEObject is FolderInfo return;
&& (tn.VEObject as FolderInfo).FolderDocVersionCount == 1 _ExpandingTree = true;
&& (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.LoadingChildrenDone += new VETreeNodeEvent(tn_LoadingChildrenDone);
tn.LoadingChildrenMax += new VETreeNodeEvent(tn_LoadingChildrenMax); tn.LoadingChildrenMax += new VETreeNodeEvent(tn_LoadingChildrenMax);
tn.LoadingChildrenValue += new VETreeNodeEvent(tn_LoadingChildrenValue); tn.LoadingChildrenValue += new VETreeNodeEvent(tn_LoadingChildrenValue);
tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL); tn.LoadingChildrenSQL += new VETreeNodeEvent(tn_LoadingChildrenSQL);
tn.LoadChildren(true); tn.LoadChildren(true);
} }
}
#region Property Page and Grid #region Property Page and Grid
DialogResult tv_NodeOpenProperty(object sender, vlnTreePropertyEventArgs args) DialogResult tv_NodeOpenProperty(object sender, vlnTreePropertyEventArgs args)
{ {
@ -2924,11 +3001,13 @@ namespace VEPROMS
private void btnOptions_Click(object sender, EventArgs e) private void btnOptions_Click(object sender, EventArgs e)
{ {
frmSysOptions VeSysOpts = new frmSysOptions(); frmSysOptions VeSysOpts = new frmSysOptions();
VeSysOpts.CanChangeSeparateWindowsSetting = !tc.MoreThanOneProcedureSetIsOpen;
VeSysOpts.ShowDialog(); VeSysOpts.ShowDialog();
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns; StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText; StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
StepTabRibbon.SpecifiedVisioPath = Properties.Settings.Default.VisioPath; StepTabRibbon.SpecifiedVisioPath = Properties.Settings.Default.VisioPath;
tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments; tc.SyncEnhancedDocuments = Properties.Settings.Default.SyncEnhancedDocuments;
tc.SeparateWindows = Properties.Settings.Default.SeparateWindows;
} }
/// <summary> /// <summary>
/// Exit button on the dialog that appears when the V icon is clicked (top left of application window) /// Exit button on the dialog that appears when the V icon is clicked (top left of application window)