B2018-071 PROMs was crashing during automated testing or print all procedures. Error Handling was added to keep the code from crashing.
B2018-070 The MS Word Panel was getting focus when the step editor was active if the PROMS window was resized or if a step with an annotation received focus. PROMS code was changed so that Word recieves focus when the Word Panel is active.
This commit is contained in:
		@@ -1442,7 +1442,14 @@ namespace VEPROMS.CSLA.Library
 | 
			
		||||
			void CloseWordApp_Tick(object sender, EventArgs e)
 | 
			
		||||
			{
 | 
			
		||||
				Enabled = false;
 | 
			
		||||
				MyApp.Quit(false);
 | 
			
		||||
				try // B2018-071 Keep code from crashing on close of MS Word
 | 
			
		||||
				{
 | 
			
		||||
					MyApp.Quit(false);
 | 
			
		||||
				}
 | 
			
		||||
				catch (Exception ex)
 | 
			
		||||
				{
 | 
			
		||||
					_MyLog.WarnFormat("MyApp Quit {0} {1}", ex.GetType().FullName, ex.Message);
 | 
			
		||||
				}
 | 
			
		||||
				Dispose();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -119,6 +119,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
			_RefreshTimer.Interval = 500;// B2017-133 Edraw
 | 
			
		||||
			ClientSizeChanged += new EventHandler(DSOTabPanel_ClientSizeChanged);
 | 
			
		||||
			_RefreshTimer.Tick += new EventHandler(_RefreshTimer_Tick);
 | 
			
		||||
			// B2018-070 Activate MS Word Panel
 | 
			
		||||
			_RefreshTimer.Enabled = true;
 | 
			
		||||
			_MyEdWord.BeforeDocumentSaved += _MyEdWord_BeforeDocumentSaved;// B2017-133 Edraw
 | 
			
		||||
		}
 | 
			
		||||
		void _MyEdWord_BeforeDocumentSaved(object sender, EventArgs e)// B2017-133 Edraw
 | 
			
		||||
@@ -145,20 +147,23 @@ namespace Volian.Controls.Library
 | 
			
		||||
			_RefreshTimer.Enabled = false;
 | 
			
		||||
			if (_MyEdWord != null)// B2017-133 Edraw
 | 
			
		||||
			{
 | 
			
		||||
				_MyEdWord.Focus();
 | 
			
		||||
				_MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToStart, EDWordLib.WdGoToDirection.wdGoToFirst);
 | 
			
		||||
				//_MyEdWord.BringToFront();
 | 
			
		||||
				//_MyEdWord.EndInit();
 | 
			
		||||
				// B2018-070 Activate MS Word Panel
 | 
			
		||||
				_MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null);
 | 
			
		||||
			}
 | 
			
		||||
			//else
 | 
			
		||||
			//{
 | 
			
		||||
			//	_MyDisplayTabControl.CloseTabItem(_MyDisplayTabItem);
 | 
			
		||||
			//}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		void DSOTabPanel_ClientSizeChanged(object sender, EventArgs e)
 | 
			
		||||
		{
 | 
			
		||||
			_RefreshTimer.Enabled = false;		// This assures that interval is used from last event.
 | 
			
		||||
			_RefreshTimer.Enabled = true;
 | 
			
		||||
			// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
			if (_InDSOTabPanel)
 | 
			
		||||
			{
 | 
			
		||||
				_RefreshTimer.Enabled = false;		// This assures that interval is used from last event.
 | 
			
		||||
				_RefreshTimer.Enabled = true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region Private Methods
 | 
			
		||||
@@ -259,6 +264,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
				if (!float.TryParse(doc.Application.Version, out ver))
 | 
			
		||||
					ver = 12.0F;
 | 
			
		||||
				this.Enter += new EventHandler(DSOTabPanel_Enter);
 | 
			
		||||
				// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
				this.Leave += DSOTabPanel_Leave;
 | 
			
		||||
				Application.DoEvents();
 | 
			
		||||
				// The following line corrects Symbol characters in MSWord Sections
 | 
			
		||||
				// CheckForSymbolCharacters(doc);
 | 
			
		||||
@@ -273,6 +280,12 @@ namespace Volian.Controls.Library
 | 
			
		||||
				// TODO: Should try to do a direct open using Word.
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		void DSOTabPanel_Leave(object sender, EventArgs e)
 | 
			
		||||
		{
 | 
			
		||||
			// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
			_InDSOTabPanel = false;
 | 
			
		||||
		}
 | 
			
		||||
		public void FixSymbolCharacters()
 | 
			
		||||
		{
 | 
			
		||||
			CheckForSymbolCharacters(new LBDocumentClass(_MyEdWord.ActiveDocument()));// B2017-133 Edraw
 | 
			
		||||
@@ -502,7 +515,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
				if (!IsBeingDeleted)
 | 
			
		||||
					SaveDirty();
 | 
			
		||||
				this.Enter -= new EventHandler(DSOTabPanel_Enter);
 | 
			
		||||
				// this.Leave -= new EventHandler(DSOTabPanel_Leave);
 | 
			
		||||
				// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
				this.Leave -= DSOTabPanel_Leave;
 | 
			
		||||
				// SaveDirty();   // SaveDirty happens in CloseDSO(bool)
 | 
			
		||||
			}
 | 
			
		||||
			catch (Exception ex)
 | 
			
		||||
@@ -576,6 +590,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
		}
 | 
			
		||||
		public static bool IgnoreEnter = false;
 | 
			
		||||
		private bool _In_DSOTabPanel_Enter=false;
 | 
			
		||||
		// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
		private bool _InDSOTabPanel = false;
 | 
			
		||||
		/// <summary>
 | 
			
		||||
		/// When a Word document is selected make sure it's tab is activated and 
 | 
			
		||||
		/// the SelectedItem for the DisplayTabControl is updated.
 | 
			
		||||
@@ -584,6 +600,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
		/// <param name="e"></param>
 | 
			
		||||
		private void DSOTabPanel_Enter(object sender, EventArgs e)
 | 
			
		||||
		{
 | 
			
		||||
			// B2018-070 Use InDSOTabPanel to determine if the word panel should be activated - Activate MS Word Panel
 | 
			
		||||
			_InDSOTabPanel = true;
 | 
			
		||||
			if (IgnoreEnter) return;
 | 
			
		||||
			_MyTransparentPanel.SendToBack();
 | 
			
		||||
 | 
			
		||||
@@ -616,6 +634,8 @@ namespace Volian.Controls.Library
 | 
			
		||||
			_MyEdWord.Focus();
 | 
			
		||||
			_In_DSOTabPanel_Enter = false;
 | 
			
		||||
			_MyDisplayTabControl.SelectedDisplayTabItem = MyDisplayTabItem;
 | 
			
		||||
			// B2018-070 Position the text cursor - Activate MS Word Panel
 | 
			
		||||
			_MyEdWord.GotoItem(EDWordLib.WdGoToItem.wdGoToObject, EDWordLib.WdGoToDirection.wdGoToNext, 0, null);
 | 
			
		||||
		}
 | 
			
		||||
		#endregion
 | 
			
		||||
		#region Public Methods
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user