Added parameter for frmPDFStatusForm
Added parameters for PromsPrinter Changed ItemID TextBox to a multiline TextBox Added Next and Previous button to move through IDs in TextBox Added a print button to print all of the procedures associated with the list of IDs Added code asociated with controls above Added error handler for the Clipboard
This commit is contained in:
@@ -972,6 +972,12 @@ namespace VEPROMS
|
||||
//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.KeyPress += new KeyPressEventHandler(txtSearch_KeyPress);
|
||||
this.txtSearch.KeyUp += txtSearch_KeyUp; // RHM20150506 Multiline ItemID TextBox
|
||||
this.txtSearch.TextChanged+=txtSearch_TextChanged; // RHM20150506 Multiline ItemID TextBox
|
||||
this.btnNext.Click += btnNext_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
|
||||
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;
|
||||
@@ -1040,39 +1046,193 @@ namespace VEPROMS
|
||||
// dlgChgId dlgCI = new dlgChgId(tc);
|
||||
// dlgCI.ShowDialog(this);
|
||||
//}
|
||||
// RHM20150506 Multiline ItemID TextBox
|
||||
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;
|
||||
}
|
||||
void btnPrint1_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray());
|
||||
Dictionary<int,ProcedureInfo> dicProcs= new Dictionary<int,ProcedureInfo>();
|
||||
foreach (string id in ids)
|
||||
{
|
||||
if(id != "")
|
||||
{
|
||||
ItemInfo ii = GetItemInfoFromString(id);
|
||||
if (!dicProcs.ContainsKey(ii.MyProcedure.ItemID))
|
||||
dicProcs.Add(ii.MyProcedure.ItemID, ii.MyProcedure);
|
||||
}
|
||||
}
|
||||
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);
|
||||
//Rtf2Pdf.AllowTableScrunching = TableScrunching.None;//TableScrunching.Phase1 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8;
|
||||
//Rtf2Pdf.AllowTableScrunching = TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4| TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8 |
|
||||
// 0;
|
||||
foreach (int key in dicProcs.Keys)
|
||||
{
|
||||
ProcedureInfo proc = dicProcs[key];
|
||||
Console.WriteLine("{0}", proc.ShortPath);
|
||||
DlgPrintProcedure prnDlg = new DlgPrintProcedure(proc,true);//dvi.DocVersionConfig,pnum);
|
||||
prnDlg.MySessionInfo = MySessionInfo;
|
||||
//prnDlg.ShowDialog(this); // RHM 20120925 - Center dialog over PROMS window
|
||||
prnDlg.Prefix = proc.MyDocVersion.VersionID.ToString() + "_";
|
||||
prnDlg.Automatic = true;
|
||||
prnDlg.OpenAfterCreate = (dr == System.Windows.Forms.DialogResult.Yes);
|
||||
prnDlg.SetupForProcedure();
|
||||
prnDlg.CreatePDF();
|
||||
}
|
||||
}
|
||||
bool ProcessingPaste = false;
|
||||
private void txtSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!ProcessingPaste)
|
||||
{
|
||||
if (txtSearch.Text.Contains("\n"))
|
||||
{
|
||||
ProcessingPaste = true;
|
||||
txtSearch.Text = txtSearch.Text.Trim("\r\n ".ToCharArray());
|
||||
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
|
||||
txtSearch.SelectionStart = 0;
|
||||
CurrentID = GetCurrentLine();
|
||||
ProcessingPaste = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
void btnPrevious_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentID = FindPreviousLine();
|
||||
}
|
||||
void btnNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentID = FindNextLine();
|
||||
}
|
||||
public string CurrentID
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetCurrentLine();
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
System.Media.SystemSounds.Beep.Play();
|
||||
}
|
||||
else
|
||||
OpenMyItem(value);
|
||||
}
|
||||
}
|
||||
private string FindNextLine()
|
||||
{
|
||||
if (txtSearch.SelectionLength > 0)
|
||||
txtSearch.SelectionLength = 0;
|
||||
string sub = txtSearch.Text.Substring(txtSearch.SelectionStart);
|
||||
if (sub.Contains("\n"))
|
||||
{
|
||||
txtSearch.SelectionStart += sub.IndexOf("\n") + 1;
|
||||
txtSearch.ScrollToCaret();
|
||||
return GetCurrentLine();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private string FindPreviousLine()
|
||||
{
|
||||
if (txtSearch.SelectionLength > 0)
|
||||
txtSearch.SelectionLength = 0;
|
||||
string sub = txtSearch.Text;
|
||||
int selStart = 0;
|
||||
if (txtSearch.SelectionStart == 0) return null;
|
||||
if (txtSearch.SelectionStart > 2)
|
||||
{
|
||||
sub = txtSearch.Text.Substring(0, txtSearch.SelectionStart - 2);
|
||||
if (sub.Contains("\n"))
|
||||
selStart = sub.LastIndexOf("\r\n") + 2;
|
||||
}
|
||||
txtSearch.SelectionStart = selStart;
|
||||
txtSearch.ScrollToCaret();
|
||||
return GetCurrentLine();
|
||||
}
|
||||
void txtSearch_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control && e.KeyCode == Keys.V)
|
||||
{
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.SelectionLength = txtSearch.TextLength;
|
||||
txtSearch.SelectedText = Clipboard.GetText().TrimEnd("\r\n ".ToCharArray());
|
||||
btnNext.Visible = btnPrint1.Visible = cbScrunch.Visible = btnPrevious.Visible = txtSearch.Text.Contains("\r\n");
|
||||
txtSearch.SelectionLength = 0;
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.ScrollToCaret();
|
||||
CurrentID= GetCurrentLine();
|
||||
e.Handled = true;
|
||||
}
|
||||
if (e.Control && e.KeyCode == Keys.A)
|
||||
{
|
||||
txtSearch.SelectionStart = 0;
|
||||
txtSearch.SelectionLength = txtSearch.TextLength;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
private string GetCurrentLine()
|
||||
{
|
||||
while (txtSearch.SelectionStart > 0 && txtSearch.Text[txtSearch.SelectionStart - 1] != '\n')
|
||||
txtSearch.SelectionStart--;
|
||||
string sub = txtSearch.Text.Substring(txtSearch.SelectionStart).TrimStart("\r\n ".ToCharArray());
|
||||
if (sub.Contains("\r\n")) return sub.Substring(0, sub.IndexOf("\r\n"));
|
||||
return sub;
|
||||
}
|
||||
|
||||
void txtSearch_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == '\r')
|
||||
{
|
||||
e.Handled = true;
|
||||
ItemInfo ii = null;
|
||||
ContentInfo ci = null;
|
||||
if (txtSearch.Text.Length > 0)
|
||||
{
|
||||
int id = 0;
|
||||
if (txtSearch.Text.ToUpper().StartsWith("C="))
|
||||
{
|
||||
if (int.TryParse(txtSearch.Text.Substring(2), out id))
|
||||
ci = ContentInfo.Get(id);
|
||||
if (ci != null)
|
||||
ii = ci.ContentItems[0];
|
||||
}
|
||||
if (txtSearch.Text.Contains("\r\n")) // RHM20150506 Multiline ItemID TextBox
|
||||
CurrentID = GetCurrentLine();
|
||||
else
|
||||
{
|
||||
if (int.TryParse(txtSearch.Text, out id))
|
||||
ii = ItemInfo.Get(id);
|
||||
}
|
||||
if (ii != null)
|
||||
{
|
||||
tc.OpenItem(ii);
|
||||
tv.AdjustTree(ii);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No item found");
|
||||
OpenMyItem(txtSearch.Text);
|
||||
}
|
||||
}
|
||||
if (e.KeyChar == 1 || e.KeyChar==22)
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenMyItem(string str) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
ItemInfo ii = GetItemInfoFromString(str); // RHM20150506 Multiline ItemID TextBox
|
||||
if (ii != null)
|
||||
{
|
||||
tc.OpenItem(ii);
|
||||
tv.AdjustTree(ii);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("No item found");
|
||||
}
|
||||
|
||||
private static ItemInfo GetItemInfoFromString(string str) // RHM20150506 Multiline ItemID TextBox
|
||||
{
|
||||
ItemInfo ii = null;
|
||||
int id = 0;
|
||||
ContentInfo ci = null;
|
||||
if (str.ToUpper().StartsWith("C="))
|
||||
{
|
||||
if (int.TryParse(str.Substring(2), out id))
|
||||
ci = ContentInfo.Get(id);
|
||||
if (ci != null)
|
||||
ii = ci.ContentItems[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (int.TryParse(str, out id))
|
||||
ii = ItemInfo.Get(id);
|
||||
}
|
||||
return ii;
|
||||
}
|
||||
|
||||
void btnAdministrativeTools_Click(object sender, EventArgs e)
|
||||
|
Reference in New Issue
Block a user