From 55eafe81155dfa6862cbf733de4d6c04bfcd00cc Mon Sep 17 00:00:00 2001 From: Rich Date: Sat, 30 Apr 2011 12:47:44 +0000 Subject: [PATCH] Select row when you right-click to open context menu Use two separate modules to close MSWord application for DataLoader and PDF Creation. Use the Content DTS to determine ChangeBar status. --- PROMS/Sync/Sync/frmSync.Designer.cs | 1 + PROMS/Sync/Sync/frmSync.cs | 8 +++++++ .../Extension/DocumentExt.cs | 22 +++++++++---------- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 2 +- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/PROMS/Sync/Sync/frmSync.Designer.cs b/PROMS/Sync/Sync/frmSync.Designer.cs index 517610f9..8bde95e7 100644 --- a/PROMS/Sync/Sync/frmSync.Designer.cs +++ b/PROMS/Sync/Sync/frmSync.Designer.cs @@ -220,6 +220,7 @@ namespace Sync this.dgv.Name = "dgv"; this.dgv.Size = new System.Drawing.Size(759, 283); this.dgv.TabIndex = 2; + this.dgv.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgv_MouseDown); this.dgv.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dgv_ColumnWidthChanged); // // cms diff --git a/PROMS/Sync/Sync/frmSync.cs b/PROMS/Sync/Sync/frmSync.cs index f28749f1..2ef67c54 100644 --- a/PROMS/Sync/Sync/frmSync.cs +++ b/PROMS/Sync/Sync/frmSync.cs @@ -46,6 +46,7 @@ namespace Sync btnBrwsSS.Tag = this.tbSourceSafe; btnBrwsMail.Tag = this.tbMailBox; btnBrwsSSMail.Tag = this.tbSSMailBox; + } private void btnBrowse_Click(object sender, EventArgs e) { @@ -423,5 +424,12 @@ namespace Sync Clipboard.SetText(sb.ToString()); MessageBox.Show(sb.ToString(), "Copied to Clipboard", MessageBoxButtons.OK, MessageBoxIcon.Information); } + private void dgv_MouseDown(object sender, MouseEventArgs e) + { + dgv.ClearSelection(); + DataGridView.HitTestInfo info = dgv.HitTest(e.X, e.Y); + dgv.CurrentCell = dgv[0, info.RowIndex]; + dgv.Rows[info.RowIndex].Selected = true; + } } } \ No newline at end of file diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 1e097689..27c4b655 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -619,7 +619,7 @@ namespace VEPROMS.CSLA.Library MyApp.ActiveDocument.Close(false); if (CloseWordWhenDone) { - CloseApp(); + CloseAppAfterWait(); } return fileName; } @@ -662,21 +662,21 @@ namespace VEPROMS.CSLA.Library myDoc.PageSetup.BottomMargin = (11 * 72) - newLength; } } - //public static void CloseApp() - //{ - // WaitMS(900);// This was added because MSWord will sometimes get the error below - // // Microsoft Office Word has stopped working - // // It appears that this is caused by quiting the MS Word application - // // to soon after closing the document or doing an export. - // MyApp.Quit(false); - // _MyApp = null; - //} + public static void CloseApp() + { + //WaitMS(900);// This was added because MSWord will sometimes get the error below + // Microsoft Office Word has stopped working + // It appears that this is caused by quiting the MS Word application + // to soon after closing the document or doing an export. + MyApp.Quit(false); + _MyApp = null; + } /// /// This closes the MS Word Application, but, delays for about 1 second. /// It appears that closing MSWord to quickly causes a: /// "Microsoft Office Word has stopped working" error. /// - public static void CloseApp() + public static void CloseAppAfterWait() { System.Windows.Forms.Application.DoEvents(); new CloseWordApp(_MyApp, 1000); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 92490ed6..7281135a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1612,7 +1612,7 @@ namespace VEPROMS.CSLA.Library if (sc == null) return false; // if there is no override & return whether there was a change to the text. if (sc.Step_CBOverride == null) - return (DTS > MyProcedure.DTS); + return (MyContent.DTS > MyProcedure.DTS); else // override is on: return (sc.Step_CBOverride == "On"); }