本文整理汇总了C#中System.Diagnostics.Process.WaitForInputIdle方法的典型用法代码示例。如果您正苦于以下问题:C# System.Diagnostics.Process.WaitForInputIdle方法的具体用法?C# System.Diagnostics.Process.WaitForInputIdle怎么用?C# System.Diagnostics.Process.WaitForInputIdle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Diagnostics.Process
的用法示例。
在下文中一共展示了System.Diagnostics.Process.WaitForInputIdle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintPDF
public static void PrintPDF(string path)
{
string printerPath = "";
PrintDialog pd = new PrintDialog();
var result = pd.ShowDialog();
if (result == DialogResult.OK)
{
printerPath = pd.PrinterSettings.PrinterName;
}
//string printer = GetDefaultPrinter();
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = path;
process.StartInfo.Verb = "printto";
process.StartInfo.Arguments = "\"" + printerPath + "\"";
process.Start();
// I have to use this in case of Adobe Reader to close the window
process.WaitForInputIdle();
process.Kill();
}
示例2: RunApp
public static void RunApp(string S)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = S;
proc.Start();
proc.WaitForInputIdle();
_Header=proc.MainWindowTitle;
}
示例3: PrintPDF
private bool PrintPDF(Investment2 newInvestment)
{
//Create the PDF for printing
string FileName = "FIF_" + this.Investor.LastName + this.Investor.FirstName + ".pdf";
string tempPath = Path.GetTempPath() + FileName;
try
{
//Working code that creates a printable in-memory pdf
using (PdfReader reader = new PdfReader(Properties.Resources.FIF_CertificateTemplate))
{
using (FileStream fs = new FileStream(tempPath, FileMode.Create))
{
using (PdfStamper stamper = new PdfStamper(reader, fs))
{
stampFields(stamper, newInvestment);
}
}
}
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(String.Format("Unable to create or print pdf file. \nError Message: {0}", ex.Message));
File.Delete(tempPath);
return false;
}
try
{
string printerPath = "";
PrintDialog pd = new PrintDialog();
var result = pd.ShowDialog();
if (result == DialogResult.OK)
{
printerPath = pd.PrinterSettings.PrinterName;
}
else
{
File.Delete(tempPath);
return false;
}
using (System.Diagnostics.Process process = new System.Diagnostics.Process())
{
process.StartInfo.FileName = tempPath;
process.StartInfo.Verb = "printto";
process.StartInfo.Arguments = "\"" + printerPath + "\"";
process.Start();
// I have to use this in case of Adobe Reader to close the window
process.WaitForInputIdle();
process.Kill();
File.Delete(tempPath);
}
}
catch(Exception ex)
{
MessageBox.Show(String.Format("Unable to send PDF to the printer. \nError Message: ", ex.Message));
File.Delete(tempPath);
return false;
}
return true;
}