Kill the process after closing the main app window. The process was remaining in memory for an extended period of time after it was closed. This removes it from memory immediately.

Added "Fix Symbol Font" button
Don't open a DSOFramer if it fails - Fixed B2012-267.
Replace an automatic function with a manual function to fix Symbol fonts. Fixed B2012-259.
This commit is contained in:
Rich 2012-10-10 19:12:59 +00:00
parent 6e082b3076
commit 537213ee7a
4 changed files with 55 additions and 19 deletions

View File

@ -72,6 +72,7 @@ namespace VEPROMS
this.lblItemID = new DevComponents.DotNetBar.LabelItem();
this.lblResolution = new DevComponents.DotNetBar.LabelItem();
this.btnEditItem = new DevComponents.DotNetBar.ButtonItem();
this.btnFixMSWord = new DevComponents.DotNetBar.ButtonItem();
this.epAnnotations = new DevComponents.DotNetBar.ExpandablePanel();
this.ctrlAnnotationDetails = new Volian.Controls.Library.AnnotationDetails();
this.btnAnnoDetailsPushPin = new DevComponents.DotNetBar.ButtonX();
@ -483,7 +484,8 @@ namespace VEPROMS
this.btnItemInfo,
this.lblItemID,
this.lblResolution,
this.btnEditItem});
this.btnEditItem,
this.btnFixMSWord});
this.bottomBar.Location = new System.Drawing.Point(5, 552);
this.bottomBar.Name = "bottomBar";
this.bottomBar.Size = new System.Drawing.Size(1185, 29);
@ -561,6 +563,14 @@ namespace VEPROMS
this.btnItemInfo.Text = "ItemInfo";
this.btnItemInfo.Click += new System.EventHandler(this.btnItemInfo_Click);
//
// btnFixMSWord
//
this.btnFixMSWord.ForeColor = System.Drawing.Color.Black;
this.btnFixMSWord.Name = "btnFixMSWord";
this.btnFixMSWord.Text = "Fix Symbol Fonts";
this.btnFixMSWord.Click += new System.EventHandler(this.btnFixMSWord_Click);
this.btnFixMSWord.Visible = false;
//
// lblItemID
//
this.lblItemID.Name = "lblItemID";
@ -1375,6 +1385,7 @@ namespace VEPROMS
this.Text = "Proms";
this.Load += new System.EventHandler(this.frmVEPROMS_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmVEPROMS_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(frmVEPROMS_FormClosed);
this.Resize += new System.EventHandler(this.frmVEPROMS_Resize);
((System.ComponentModel.ISupportInitialize)(this.bottomBar)).EndInit();
this.bottomBar.ResumeLayout(false);
@ -1401,7 +1412,6 @@ namespace VEPROMS
this.ResumeLayout(false);
}
#endregion
private DevComponents.DotNetBar.RibbonControl ribbonControl1;
@ -1503,6 +1513,7 @@ namespace VEPROMS
private Volian.Controls.Library.DisplaySearch displaySearch1;
private DevComponents.DotNetBar.LabelItem lblEditView;
private DevComponents.DotNetBar.ButtonItem btnItemInfo;
private DevComponents.DotNetBar.ButtonItem btnFixMSWord;
private Volian.Controls.Library.DisplayBookMarks displayBookMarks;
private DevComponents.DotNetBar.LabelItem lblLocked;
private DevComponents.DotNetBar.ButtonItem btnShortCuts;

View File

@ -487,6 +487,13 @@ namespace VEPROMS
Volian.Base.Library.DebugPagination.Close();
Volian.Base.Library.DebugText.Close();
}
void frmVEPROMS_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
{
// 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.
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
private void frmVEPROMS_Load(object sender, EventArgs e)
{
//string debugMode = ConfigurationManager.AppSettings["Debug"];
@ -605,10 +612,6 @@ namespace VEPROMS
if (ranAuto)
{
this.Close();
// 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.
System.Diagnostics.Process myProc = System.Diagnostics.Process.GetCurrentProcess();
myProc.Kill();
}
}
private bool _RunNext = false;
@ -1389,6 +1392,7 @@ namespace VEPROMS
private StepRTB _LastStepRTB = null;
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
{
btnFixMSWord.Visible = (args != null && ( args.MyItemInfo != null && args.MyEditItem == null));
if (_LastStepRTB != null && !_LastStepRTB.Disposing && !_LastStepRTB.Closed)
_LastStepRTB.EditModeChanged -= new StepRTBEvent(_LastStepRTB_EditModeChanged);
_LastStepRTB = args != null && args.MyEditItem != null ? args.MyEditItem.MyStepRTB : null;
@ -1803,6 +1807,19 @@ namespace VEPROMS
else
MessageBox.Show("Select Item First", "Item not selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
private void btnFixMSWord_Click(object sender, EventArgs e)
{
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyDSOTabPanel != null)
{
string btnText = btnFixMSWord.Text;
btnFixMSWord.FixedSize = btnFixMSWord.Size;
btnFixMSWord.Text = "Processing ...";
this.Cursor = Cursors.WaitCursor;
tc.SelectedDisplayTabItem.MyDSOTabPanel.FixSymbolCharacters();
btnFixMSWord.Text = btnText;
this.Cursor = Cursors.Default;
}
}
private void epAnnotations_Resize(object sender, EventArgs e)
{

View File

@ -166,7 +166,8 @@ namespace Volian.Controls.Library
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
Application.DoEvents();
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
CheckForSymbolCharacters(doc);
// The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc);
InitializeWordDocument(doc);
FindSearchString();
}
@ -178,10 +179,14 @@ namespace Volian.Controls.Library
// TODO: Should try to do a direct open using Word.
}
}
public void FixSymbolCharacters()
{
CheckForSymbolCharacters(new LBDocumentClass(_MyDSOFramer.ActiveDocument));
}
private void CheckForSymbolCharacters(LBDocumentClass doc)
{
if (doc.FontHasSymbolCharacters != null)
string fontHasSymbolCharacters = doc.FontHasSymbolCharacters;
if (fontHasSymbolCharacters != null)
{
// do a string for the log message, depending if this is a libdoc.
string msg = null;
@ -196,16 +201,16 @@ namespace Volian.Controls.Library
msg = string.Format("Library Document: {0}", MyDocumentInfo.LibTitle);
if (doc.AttemptToFixASymbolCharacter()) // font is installed correctly, 'fix' this file.
{
MessageBox.Show(string.Format("This document uses the font {0}, which previously had an error.\r\nThe program will attempt to fix the problem for this Word section.", doc.FontHasSymbolCharacters),
"Font Being Corrected", MessageBoxButtons.OK);
//MessageBox.Show(string.Format("This document uses the font {0}, which previously had an error.\r\nThe program will attempt to fix the problem for this Word section.", fontHasSymbolCharacters),
// "Font Being Corrected", MessageBoxButtons.OK);
doc.FixSymbolCharacters();
_MyLog.Info(string.Format("Font problem being fixed in Font: {0}, {1}.",doc.FontHasSymbolCharacters, msg));
_MyLog.Info(string.Format("Font problem being fixed in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
else
{
MessageBox.Show(string.Format("This document uses the font {0}, which has an error.\r\n\r\nReinstall this font.", doc.FontHasSymbolCharacters),
MessageBox.Show(string.Format("This document uses the font {0}, which has an error.\r\n\r\nReinstall this font.", fontHasSymbolCharacters),
"Reinstall Font", MessageBoxButtons.OK);
_MyLog.Info(string.Format("Font problem found in Font: {0}, {1}.",doc.FontHasSymbolCharacters, msg));
_MyLog.Info(string.Format("Font problem found in Font: {0}, {1}.",fontHasSymbolCharacters, msg));
}
}
}

View File

@ -807,11 +807,14 @@ namespace Volian.Controls.Library
{
_OpenDocFromSearch = true;
DisplayTabItem dti = _TabControl.OpenItem(_ItemInfo); // open the corresponding procedure text
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.SearchString = _strSrchText == null || _strSrchText == "" ? this.cbxTextSearchText.Text : _strSrchText;
if (dti.MyStepTabPanel != null)
dti.MyStepTabPanel.SearchString = _strSrchText == null || _strSrchText == "" ? this.cbxTextSearchText.Text : _strSrchText;
_OpenDocFromSearch = false;
if (dti != null)
{
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.SearchString = _strSrchText == null || _strSrchText == "" ? this.cbxTextSearchText.Text : _strSrchText;
if (dti.MyStepTabPanel != null)
dti.MyStepTabPanel.SearchString = _strSrchText == null || _strSrchText == "" ? this.cbxTextSearchText.Text : _strSrchText;
_OpenDocFromSearch = false;
}
}
}
}