本文整理汇总了C#中ErrorReporter.Report方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorReporter.Report方法的具体用法?C# ErrorReporter.Report怎么用?C# ErrorReporter.Report使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorReporter
的用法示例。
在下文中一共展示了ErrorReporter.Report方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static int Main(string[] args)
{
CommandLineParser parser = new CommandLineParser( args );
if (parser.RegistrationPath.Length == 0)
parser.RegistrationPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(RegistrarApp)).Location);
try
{
AssemblyRegistrar registrar = new AssemblyRegistrar( parser );
if( parser.RegisterMode == CommandLineParser.InstallMode.Register )
registrar.Register();
else
{
try
{
registrar.UnRegister();
}
catch
{
// ignore the exception
}
}
return (int) ReturnValue.Success;
}
catch( Exception ex )
{
System.Diagnostics.Debug.Assert(false, ex.Message);
ErrorReporter reporter = new ErrorReporter(parser.RegistrationPath, parser.SilentMode);
reporter.Report(ex.Message);
return (int) ReturnValue.Failure;
}
}
示例2: Report
public void Report()
{
ExceptionForm form = new ExceptionForm(message, ex);
if (form.ShowDialog(owner) == DialogResult.OK) {
ErrorReporter reporter = new ErrorReporter();
reporter.Report(ex);
}
}
示例3: ImportFilesInComponent
private void ImportFilesInComponent(TreeNode node, XmlNode componentNode, string[] files)
{
if (componentNode.Name == "Component")
{
bool mustExpand = (node.Nodes.Count == 0);
CurrentTreeView.SuspendLayout();
bool foundReg = false;
foreach (string file in files)
{
if (Path.GetExtension(file).ToLower() == ".reg")
{
foundReg = true;
break;
}
}
bool importRegistryFiles = false;
if (foundReg == true)
{
DialogResult result = MessageBox.Show(this, "Import Registry (*.reg) files to Registry elements?", "Import?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (result == DialogResult.Cancel)
{
return;
}
else if (result == DialogResult.Yes)
{
importRegistryFiles = true;
}
}
WixFiles.UndoManager.BeginNewCommandRange();
StringBuilder errorMessageBuilder = new StringBuilder();
foreach (string file in files)
{
FileInfo fileInfo = new FileInfo(file);
try
{
if (fileInfo.Extension.ToLower() == ".reg" && importRegistryFiles)
{
RegistryImport regImport = new RegistryImport(WixFiles, fileInfo, componentNode);
regImport.Import(node);
}
else
{
FileImport fileImport = new FileImport(WixFiles, fileInfo, componentNode);
fileImport.Import(node);
}
}
catch (WixEditException ex)
{
errorMessageBuilder.AppendFormat("{0} ({1})\r\n", fileInfo.Name, ex.Message);
}
catch (Exception ex)
{
string message = String.Format("An exception occured during the import of \"{0}\"! Please press OK to report this error to the WixEdit website, so this error can be fixed.", fileInfo.Name);
ExceptionForm form = new ExceptionForm(message, ex);
if (form.ShowDialog() == DialogResult.OK)
{
ErrorReporter reporter = new ErrorReporter();
reporter.Report(ex);
}
}
}
if (errorMessageBuilder.Length > 0)
{
MessageBox.Show(this, "Import failed for the following files:\r\n\r\n" + errorMessageBuilder.ToString(), "Import failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
ShowNode(componentNode);
if (mustExpand)
{
node.Expand();
}
CurrentTreeView.ResumeLayout();
}
}
示例4: ReportError
private void ReportError(string message)
{
ErrorReporter reporter = new ErrorReporter(m_parser.RegistrationPath, m_parser.SilentMode);
reporter.Report(message);
}