Table shrinking support

Support for mutilple ItemIDs in the TextBox in the ToolBar
This commit is contained in:
Rich 2015-05-27 18:46:57 +00:00
parent 39f4daa237
commit cf79062b90

View File

@ -926,30 +926,30 @@ namespace VEPROMS
if (MySessionInfo.ChangedItems.Count > 0) if (MySessionInfo.ChangedItems.Count > 0)
{ {
foreach (int id in MySessionInfo.ChangedItems.Keys) foreach (int id in MySessionInfo.ChangedItems.Keys)
{ {
if (ItemInfo.IsInCache(id)) if (ItemInfo.IsInCache(id))
mUIContext.Post(MyFindNodeAndExpand, id); mUIContext.Post(MyFindNodeAndExpand, id);
} }
} }
if (MySessionInfo.ChangedContents.Count > 0) if (MySessionInfo.ChangedContents.Count > 0)
foreach (int id in MySessionInfo.ChangedContents.Keys) foreach (int id in MySessionInfo.ChangedContents.Keys)
{ {
if (ContentInfo.IsInCache(id)) if (ContentInfo.IsInCache(id))
{ {
ContentInfo ci = ContentInfo.Get(id); ContentInfo ci = ContentInfo.Get(id);
//if (ci.LastChangedInt64 > MySessionInfo.LastChangedInt64) //if (ci.LastChangedInt64 > MySessionInfo.LastChangedInt64)
if (MySessionInfo.LastContentChange >= ci.LastChangedInt64) if (MySessionInfo.LastContentChange >= ci.LastChangedInt64)
{ {
using (Content c = Content.Get(id)) using (Content c = Content.Get(id))
{ {
ContentInfo.Refresh(c); ContentInfo.Refresh(c);
} }
} }
} }
lastChanged = MySessionInfo.ChangedContents[id]; lastChanged = MySessionInfo.ChangedContents[id];
} }
MySessionInfo.ChangedItems.Clear(); MySessionInfo.ChangedItems.Clear();
MySessionInfo.ChangedContents.Clear(); MySessionInfo.ChangedContents.Clear();
if (lastChanged > 0) if (lastChanged > 0)
{ {
MySessionInfo.LastContentChange = lastChanged; MySessionInfo.LastContentChange = lastChanged;
@ -1024,17 +1024,17 @@ namespace VEPROMS
MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id); MySessionInfo = SessionInfo.BeginSession(Environment.MachineName, System.Diagnostics.Process.GetCurrentProcess().Id);
this.LastContentChange = MySessionInfo.LastContentChange; this.LastContentChange = MySessionInfo.LastContentChange;
RefreshLastChange(); RefreshLastChange();
if (MySessionInfo == null) if (MySessionInfo == null)
{ {
MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked"); MessageBox.Show("This database is locked by the Administrator. Please try again later", "PROMS is Locked");
Application.Exit(); Application.Exit();
} }
tc.MySessionInfo = MySessionInfo; tc.MySessionInfo = MySessionInfo;
tv.MySessionInfo = MySessionInfo; tv.MySessionInfo = MySessionInfo;
System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false); System.Threading.AutoResetEvent autoEvent = new System.Threading.AutoResetEvent(false);
//System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession); //System.Threading.TimerCallback timerDelegate = new System.Threading.TimerCallback(MySessionInfo.PingSession);
//System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess(); //System.Diagnostics.Process xyzzy = System.Diagnostics.Process.GetCurrentProcess();
if (!System.Diagnostics.Debugger.IsAttached) if(!System.Diagnostics.Debugger.IsAttached)
{ {
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); MyActivityTimer = new System.Threading.Timer(timerDelegate, autoEvent, 10000, 10000);
@ -1048,10 +1048,9 @@ namespace VEPROMS
// get the saved location and size of the VE-PROMS appication for this user // get the saved location and size of the VE-PROMS appication for this user
this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress); this.txtSearch.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox
this.txtSearch.TextChanged += txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox this.txtSearch.TextChanged+=txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox this.btnNext.Click += btnNext_Click; // RHM20150506 Multiline ItemID TextBox
this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox this.btnPrint1.Click += btnPrint1_Click; // RHM20150506 Multiline ItemID TextBox
this.cbScrunch.Click += cbScrunch_Click; // RHM20150506 Multiline ItemID TextBox
this.btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multiline ItemID TextBox this.btnPrevious.Click += btnPrevious_Click; // RHM20150506 Multiline ItemID TextBox
if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location; if (Settings.Default["Location"] != null) this.Location = Settings.Default.Location;
if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size; if (Settings.Default["Size"] != null) this.Size = Settings.Default.Size;
@ -1060,7 +1059,7 @@ namespace VEPROMS
// if the Procedures panel was left open from the last session, then open it // if the Procedures panel was left open from the last session, then open it
epProcedures.Expanded = Settings.Default.TreeviewExpanded; epProcedures.Expanded = Settings.Default.TreeviewExpanded;
if (Settings.Default["QATItems"] != null) ribbonControl1.QatLayout = Settings.Default.QATItems; if (Settings.Default["QATItems"] != null) ribbonControl1.QatLayout = Settings.Default.QATItems;
// See if any database 'changes' need done and do them: // See if any database 'changes' need done and do them:
MakeDatabaseChanges(); MakeDatabaseChanges();
@ -1087,7 +1086,7 @@ namespace VEPROMS
ctrlAnnotationDetails.SetupAnnotations(displaySearch1); ctrlAnnotationDetails.SetupAnnotations(displaySearch1);
SetupButtons(); SetupButtons();
displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs displayBookMarks.MyDisplayTabControl = tc; // allows bookmark selection to bring up steps/docs
office2007StartButton1.MouseDown += new MouseEventHandler(office2007StartButton1_MouseDown); office2007StartButton1.MouseDown +=new MouseEventHandler(office2007StartButton1_MouseDown);
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged); //displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
tc.Enter += new EventHandler(tc_Enter); tc.Enter += new EventHandler(tc_Enter);
tc.Leave += new EventHandler(tc_Leave); tc.Leave += new EventHandler(tc_Leave);
@ -1113,7 +1112,7 @@ namespace VEPROMS
// btnAdmin.Visible = false; // btnAdmin.Visible = false;
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns; StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText; StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
Activate(); Activate();
//FolderInfo fi = FolderInfo.Get(1); //FolderInfo fi = FolderInfo.Get(1);
//FormatInfo frmI = FormatInfo.Get(fi.FormatID ?? 1); //FormatInfo frmI = FormatInfo.Get(fi.FormatID ?? 1);
//if (frmI.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds) //if (frmI.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds)
@ -1121,13 +1120,11 @@ namespace VEPROMS
// dlgChgId dlgCI = new dlgChgId(tc); // dlgChgId dlgCI = new dlgChgId(tc);
// dlgCI.ShowDialog(this); // dlgCI.ShowDialog(this);
//} //}
// RHM20150506 Multiline ItemID TextBox // RHM20150506 Multiline ItemID TextBox
this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",", "\r\n"); this.txtSearch.Text = Volian.Base.Library.VlnSettings.GetCommand("ItemIDs", "").Replace(",","\r\n");
}
void cbScrunch_Click(object sender, EventArgs e) // RHM20150506 Multiline ItemID TextBox
{
//Rtf2Pdf._AllowTableScrunching = TableScrunching.Phase1;
} }
// RHM20150507 Table Scrunch
private TableScrunching _DefaultScrunchingRules = TableScrunching.Phase1 | TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4 | TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8;
void btnPrint1_Click(object sender, EventArgs e) void btnPrint1_Click(object sender, EventArgs e)
{ {
string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray()); string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray());
@ -1135,21 +1132,20 @@ namespace VEPROMS
foreach (string id in ids) foreach (string id in ids)
{ {
if(id != "") if(id != "")
{ {
ItemInfo ii = GetItemInfoFromString(id); ItemInfo ii = GetItemInfoFromString(id);
if (!dicProcs.ContainsKey(ii.MyProcedure.ItemID)) if (!dicProcs.ContainsKey(ii.MyProcedure.ItemID))
dicProcs.Add(ii.MyProcedure.ItemID, ii.MyProcedure); dicProcs.Add(ii.MyProcedure.ItemID, ii.MyProcedure);
} }
} }
DialogResult dr = System.Windows.Forms.DialogResult.Yes; DialogResult dr = System.Windows.Forms.DialogResult.Yes;
//dr = MessageBox.Show("Do you want all of the PDFs to be opened?", "Open After Create", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //dr = MessageBox.Show("Do you want all of the PDFs to be opened?", "Open After Create", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
//Rtf2Pdf.AllowTableScrunching = TableScrunching.None;//TableScrunching.Phase1 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8; // RHM20150507 Table Scrunch
//Rtf2Pdf.AllowTableScrunching = TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8 | Rtf2Pdf.AllowTableScrunching = cbScrunch.Checked ? _DefaultScrunchingRules : TableScrunching.None;
// 0;
foreach (int key in dicProcs.Keys) foreach (int key in dicProcs.Keys)
{ {
ProcedureInfo proc = dicProcs[key]; ProcedureInfo proc = dicProcs[key];
Console.WriteLine("{0}", proc.ShortPath); //Console.WriteLine("{0}", proc.ShortPath);
DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc,true);//dvi.DocVersionConfig,pnum); DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc,true);//dvi.DocVersionConfig,pnum);
prnDlg.MySessionInfo = MySessionInfo; prnDlg.MySessionInfo = MySessionInfo;
//prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window //prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
@ -1163,17 +1159,17 @@ namespace VEPROMS
bool ProcessingPaste = false; bool ProcessingPaste = false;
private void txtSearch_TextChanged(object sender, EventArgs e) private void txtSearch_TextChanged(object sender, EventArgs e)
{ {
if (!ProcessingPaste) if (!ProcessingPaste) // RHM20150507 Multiline ItemID TextBox
{ {
ProcessingPaste = true;
if (txtSearch.Text.Contains("\n")) if (txtSearch.Text.Contains("\n"))
{ {
ProcessingPaste = true;
txtSearch.Text = txtSearch.Text.Trim("\r\n ".ToCharArray()); txtSearch.Text = txtSearch.Text.Trim("\r\n ".ToCharArray());
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
txtSearch.SelectionStart = 0; txtSearch.SelectionStart = 0;
CurrentID = GetCurrentLine(); CurrentID = GetCurrentLine();
ProcessingPaste = false;
} }
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
ProcessingPaste = false;
} }
} }
void btnPrevious_Click(object sender, EventArgs e) void btnPrevious_Click(object sender, EventArgs e)
@ -1273,22 +1269,22 @@ namespace VEPROMS
} }
} }
if (e.KeyChar == 1 || e.KeyChar==22) if (e.KeyChar == 1 || e.KeyChar==22)
{ {
e.Handled = true; e.Handled = true;
} }
} }
private void OpenMyItem(string str) // RHM20150506 Multiline ItemID TextBox private void OpenMyItem(string str) // RHM20150506 Multiline ItemID TextBox
{ {
ItemInfo ii = GetItemInfoFromString(str); // RHM20150506 Multiline ItemID TextBox ItemInfo ii = GetItemInfoFromString(str); // RHM20150506 Multiline ItemID TextBox
if (ii != null) if (ii != null)
{ {
tc.OpenItem(ii); tc.OpenItem(ii);
tv.AdjustTree(ii); tv.AdjustTree(ii);
} }
else else
MessageBox.Show("No item found"); MessageBox.Show("No item found");
} }
private static ItemInfo GetItemInfoFromString(string str) // RHM20150506 Multiline ItemID TextBox private static ItemInfo GetItemInfoFromString(string str) // RHM20150506 Multiline ItemID TextBox
{ {