本文整理汇总了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();
}
示例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();
}