From f1c6f819b968cd95e5577dbf0d49df7a5e6bbd90 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 24 Oct 2014 01:30:19 +0000 Subject: [PATCH] Added code to support textbox in status bar at bottom of PROMS which allows user to locate an item by the itemid or contentid in debug mode --- .../frmVEPROMS.Designer.cs | 7 ++++ PROMS/VEPROMS User Interface/frmVEPROMS.cs | 39 +++++++++++++++++-- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs index 8095435e..f1c5bc07 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs @@ -72,6 +72,7 @@ namespace VEPROMS this.lblItemID = new DevComponents.DotNetBar.LabelItem(); this.lblResolution = new DevComponents.DotNetBar.LabelItem(); this.lblUser = new DevComponents.DotNetBar.LabelItem(); + this.txtSearch = new DevComponents.DotNetBar.TextBoxItem(); this.btnEditItem = new DevComponents.DotNetBar.ButtonItem(); this.btnFixMSWord = new DevComponents.DotNetBar.ButtonItem(); this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel(); @@ -496,6 +497,7 @@ namespace VEPROMS this.lblResolution, this.btnEditItem, this.lblUser, + this.txtSearch, this.btnFixMSWord}); this.bottomBar.Location = new System.Drawing.Point(5, 569); this.bottomBar.Name = "bottomBar"; @@ -594,6 +596,10 @@ namespace VEPROMS this.lblUser.ForeColor = System.Drawing.SystemColors.MenuText; this.lblUser.Name = "lblUser"; this.lblUser.Text = "User"; + // + // txtSearch + // + this.txtSearch.Name = "txtSearch"; // // btnEditItem // @@ -1612,6 +1618,7 @@ namespace VEPROMS private System.Windows.Forms.ComboBox cmbFont; private DevComponents.DotNetBar.LabelItem lblResolution; private DevComponents.DotNetBar.LabelItem lblUser; + private DevComponents.DotNetBar.TextBoxItem txtSearch; private DevComponents.DotNetBar.ButtonItem btnEditItem; private DevComponents.DotNetBar.TabControlPanel tabControlPanel1; private DevComponents.DotNetBar.TabItem infotabHistory; diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 184416f2..6a891c4b 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -798,7 +798,7 @@ namespace VEPROMS private System.Threading.Timer MyActivityTimer; private DevComponents.DotNetBar.ButtonItem btnManageSecurity; private DevComponents.DotNetBar.ButtonItem btnResetSecurity; - private TabItemsToClose _MyCloseTabList = new TabItemsToClose(); + private TabItemsToClose _MyCloseTabList = new TabItemsToClose(); public TabItemsToClose MyCloseTabList { get { return _MyCloseTabList; } @@ -866,12 +866,14 @@ namespace VEPROMS //System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession); System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(this.PingSession); - if (!System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost")) - MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000); + if (!System.Diagnostics.Process.GetCurrentProcess().ProcessName.ToLower().EndsWith("vshost")) + //MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 30000, 30000); + MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000); //string debugMode = ConfigurationManager.AppSettings["Debug"]; //VlnSettings.DebugMode = bool.Parse(debugMode); // set debug for the Volian.Controls.Library // get the saved location and size of the VE-PROMS appication for this user + this.txtSearch.KeyDown += new KeyEventHandler(txtSearch_KeyDown); if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location; if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size; if (Settings.Default["WindowState"] != null) this.WindowState = Settings.Default.WindowState; @@ -942,9 +944,37 @@ namespace VEPROMS //} } + void txtSearch_KeyDown(object sender, KeyEventArgs e) + { + if(e.KeyCode == Keys.Enter) + { + ItemInfo ii = null; + ContentInfo ci = null; + if(txtSearch.Text.Length > 0) + { + if (txtSearch.Text.ToUpper().StartsWith("C=")) + { + ci = ContentInfo.Get(int.Parse(txtSearch.Text.Substring(2))); + if(ci != null) + ii = ci.ContentItems[0]; + } + else + ii = ItemInfo.Get(int.Parse(txtSearch.Text)); + if (ii != null) + { + tc.OpenItem(ii); + tv.AdjustTree(ii); + } + else + MessageBox.Show("No item found"); + + } + } + } + void tmrCloseTabItems_Tick(object sender, EventArgs e) { - while(MyCloseTabList.CountDTI > 0) + while (MyCloseTabList.CountDTI > 0) { DisplayTabItem dti = MyCloseTabList.PopDTI(); if (dti.MyDSOTabPanel != null) @@ -1300,6 +1330,7 @@ namespace VEPROMS cmbFont.Visible = false; btnEditItem.Visible = false; lblResolution.Visible = false; + txtSearch.Visible = false; } } #region MRU