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


C# IProgressReporter.ProgressMessage方法代码示例

本文整理汇总了C#中IProgressReporter.ProgressMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressReporter.ProgressMessage方法的具体用法?C# IProgressReporter.ProgressMessage怎么用?C# IProgressReporter.ProgressMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProgressReporter的用法示例。


在下文中一共展示了IProgressReporter.ProgressMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compile

        // Compile() is called by a background Thread in ProgressForm so be careful
        public void Compile(IProgressReporter progressReporter)
        {
            // Use registry to find the compiler and invoke as a separate process.
            const string key = @"HKEY_CURRENT_USER\Software\Microsoft\HTML Help Workshop";

            var install = (string)Registry.GetValue(key, "InstallDir", null);
            var hhcExe = Path.Combine(install, "hhc.exe");

            if (install == null || File.Exists(hhcExe) == false)
            {
                throw new ApplicationException("Please install the HTML Help Workshop.");
            }

            var compileProcess = new Process
                                     {
                                         StartInfo =
                                             {
                                                 FileName = "\"" + Path.Combine(install, "hhc.exe") + "\"",
                                                 Arguments = "\"" + _baseName + ".hhp" + "\"",
                                                 CreateNoWindow = true,
                                                 WorkingDirectory = _chmDir,
                                                 UseShellExecute = false,
                                                 RedirectStandardOutput = true
                                             }
                                     };

            compileProcess.Start();

            var streamReader = compileProcess.StandardOutput;

            // The UI doesn't update because stdout isn't flushed, so for now, just toss
            // the message and call the progressReporter with the same
            // message.
            while (streamReader.EndOfStream != true)
            {
                streamReader.ReadLine();
                {
                    progressReporter.ProgressMessage("Compiling");
                }
            }

            compileProcess.Close();
        }
开发者ID:mark-s,项目名称:MSDN-to-Kindle,代码行数:44,代码来源:Chm.cs

示例2: throw

        // Compile() is called by a background Thread in ProgressForm so be carful
        void ICompilable.Compile(IProgressReporter progressReporter)
        {
            this.progressReporter = progressReporter;

            // Use registry to find the compiler and invoke as a separate process.
            string key = @"HKEY_CURRENT_USER\Software\Microsoft\HTML Help Workshop";

            string install = (string)Registry.GetValue(key, "InstallDir", null);
            string hhcExe =  Path.Combine(install, "hhc.exe");

            if (install == null || File.Exists(hhcExe) == false)
            {
                throw (new Exception("Please install the HTML Help Workshop."));
            }

            Process compileProcess = new Process();

            compileProcess.StartInfo.FileName = "\"" + Path.Combine(install, "hhc.exe") + "\"";
            compileProcess.StartInfo.Arguments = "\"" + baseName + ".hhp" + "\"";                  //Fix: Wrap in quotes
            compileProcess.StartInfo.CreateNoWindow = true;
            compileProcess.StartInfo.WorkingDirectory = chmDir;
            compileProcess.StartInfo.UseShellExecute = false;
            compileProcess.StartInfo.RedirectStandardOutput = true;
            //            compileProcess.OutputDataReceived += new DataReceivedEventHandler(CompilerOutputHandler);

            compileProcess.Start();

            StreamReader streamReader = compileProcess.StandardOutput;

            //            compileProcess.BeginOutputReadLine();
            //            compileProcess.WaitForExit();

            string line;

            // The UI doesn't update because stdout isn't flushed, so for now, just toss
            // the message and call the progressReporter with the same
            // message.
            while(streamReader.EndOfStream != true)
            {
                line = streamReader.ReadLine();

                // if (String.IsNullOrEmpty(line) == false)
                {
                    progressReporter.ProgressMessage("Compiling");
                }
            }

            compileProcess.Close();
        }
开发者ID:SamB,项目名称:PackageThis,代码行数:50,代码来源:Chm.cs


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