当前位置: 首页>>代码示例>>C#>>正文


C# System.Diagnostics.Process.WaitForInputIdle方法代码示例

本文整理汇总了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();
        }
开发者ID:jmd7p7,项目名称:Futures-In-Faith,代码行数:22,代码来源:PDFPrinter.cs

示例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;
 }
开发者ID:Martmath,项目名称:ISaveable,代码行数:8,代码来源:Debug.cs

示例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;
        }
开发者ID:jmd7p7,项目名称:Futures-In-Faith,代码行数:63,代码来源:PDFCreator.cs


注:本文中的System.Diagnostics.Process.WaitForInputIdle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。