本文整理汇总了C#中ErrorEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ErrorEventArgs类的具体用法?C# ErrorEventArgs怎么用?C# ErrorEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorEventArgs类属于命名空间,在下文中一共展示了ErrorEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Instance_Error
/// <summary>
/// Handles the Error event of the Instance control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.IO.ErrorEventArgs"/> instance containing the event data.</param>
private void Instance_Error(object sender, ErrorEventArgs e)
{
_messages.Add(WebStringHelper.EncodeForWebString(e.Message));
ErrorMessages.DataSource = _messages;
ErrorMessages.DataBind();
Visible = _messages != null && _messages.Count > 0;
}
示例2: OnError
protected void OnError(object sender, ErrorEventArgs args)
{
var onError = Error;
if (onError != null)
{
onError(sender, args);
}
}
示例3: ErrorEventArgs_ctor_Null
public void ErrorEventArgs_ctor_Null()
{
ErrorEventArgs args = new ErrorEventArgs(null);
Assert.Null(args.GetException());
// Make sure method is consistent.
Assert.Null(args.GetException());
}
示例4: CreateErrorEvent
/// <summary>
/// Creates the error event.
/// </summary>
/// <returns>The error event.</returns>
/// <param name="code">Code.</param>
public static IEvent CreateErrorEvent(int error)
{
ErrorEventArgs v = new ErrorEventArgs();
v.Code = error;
return new IEvent(
EngineEventType.EVENT_GLOBAL, CMD_ERROR, v
);
}
示例5: ValidateErrorEventArgs
private static void ValidateErrorEventArgs(Exception exception)
{
ErrorEventArgs args = new ErrorEventArgs(exception);
Assert.Equal(exception, args.GetException());
// Make sure method is consistent.
Assert.Equal(exception, args.GetException());
}
示例6: ErrorEventArgs_ctor
public void ErrorEventArgs_ctor()
{
Exception exception = new Exception();
ErrorEventArgs args = new ErrorEventArgs(exception);
Assert.Equal(exception, args.GetException());
// Make sure method is consistent.
Assert.Equal(exception, args.GetException());
}
示例7: OnError
public void OnError(ErrorEventArgs args)
{
bool raised = false;
EventHandler<ErrorEventArgs> handler = (sender, e) => raised = e == args;
var sut = new ExperimentSteps<string, string>();
sut.OnErrorEvent += handler;
sut.OnError(args);
//Verify
Assert.True(raised);
}
示例8: InitializeIfNecessary
/// <summary>
/// If this namespace declaration has not yet been initialized, parse the source, set the containing nodes of the result
/// and report any scanning and parsing errors via the host environment. This method is called whenever
/// </summary>
/// <remarks>Not called in incremental scenarios</remarks>
protected override void InitializeIfNecessary() {
if (this.isInitialized) return;
lock (GlobalLock.LockingObject) {
if (this.isInitialized) return;
//^ assume this.CompilationPart is CompilationPart; //The constructor ensures this
SmallBasicCompilationPart cp = (SmallBasicCompilationPart)this.CompilationPart;
Parser parser = new Parser(this.Compilation.NameTable, this.SourceLocation, new SmallBasicCompilerOptions(), cp.ScannerAndParserErrors); //TODO: get options from Compilation
this.Parse(parser);
this.SetContainingNodes();
ErrorEventArgs errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, this.SourceLocation, cp.ScannerAndParserErrors.AsReadOnly());
this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
this.isInitialized = true;
}
}
示例9: InitializeIfNecessary
protected override void InitializeIfNecessary()
//^^ ensures this.members != null;
{
if (this.isInitialized) return;
lock (GlobalLock.LockingObject) {
if (this.isInitialized) return;
//^ assume this.CompilationPart is SpecSharpCompilationPart; //The constructor ensures this
SpecSharpCompilationPart cp = (SpecSharpCompilationPart)this.CompilationPart;
Parser parser = new Parser(this.Compilation, this.SourceLocation, cp.ScannerAndParserErrors); //TODO: get options from Compilation
this.Parse(parser);
this.SetContainingNodes();
ErrorEventArgs errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, this.SourceLocation, cp.ScannerAndParserErrors.AsReadOnly());
this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
errorEventArguments = new ErrorEventArgs(ErrorReporter.Instance, cp.UnpreprocessedDocument.SourceLocation, cp.PreprocessorErrors);
this.Compilation.HostEnvironment.ReportErrors(errorEventArguments);
this.isInitialized = true;
}
}
示例10: DownloadFile
public bool DownloadFile(Uri uri, String fileName)
{
this.fileName = fileName;
statusCode = "Unknown";
contentLength = 0;
try {
WebRequest webRequest = HttpWebRequest.Create(uri);
webRequest.BeginGetResponse(new AsyncCallback(requestCallBack), webRequest);
State = ConnectState.Connect;
} catch (Exception e) {
Console.WriteLine(e);
State = ConnectState.Failed;
ErrorEventArgs args = new ErrorEventArgs();
args.Message = e.Message;
OnErrorOccurred(args);
return false;
}
return true;
}
示例11: OnSymbolInfo
void OnSymbolInfo(object sender, SymbolInfoEventArgs e)
{
try
{
var symbols = e.Information
.Select(o => o.Name)
.ToArray();
this.feed.Server.SubscribeToQuotes(symbols, 1);
}
catch(Exception ex)
{
var eh = this.Error;
if (eh != null)
{
var errEventArgs = new ErrorEventArgs(ex);
eh(this, errEventArgs);
}
}
}
示例12: onError
private void onError(object sender, ErrorEventArgs e)
{
OnError (e);
}
示例13: OnError
/// <summary>
/// Is called when the inner <see cref="WebSocket"/> or current <see cref="WebSocketService"/>
/// gets an error.
/// </summary>
/// <param name="e">
/// An <see cref="ErrorEventArgs"/> that contains an event data associated with
/// an inner <see cref="WebSocket.OnError"/> event.
/// </param>
protected virtual void OnError(ErrorEventArgs e)
{
}
示例14: Socket_OnError
private void Socket_OnError(object sender, ErrorEventArgs e)
{
LogHelper.Info("Koala数据传输异常");
IsConnected = false;
reset.Set();
}
示例15: Monitor_ErrorOccurred
public void Monitor_ErrorOccurred(object sender, ErrorEventArgs e)
{
try
{
this.Invoke(new EventHandler<ErrorEventArgs>(Monitor_ErrorOccurredHandler), sender, e);
}
catch(Exception ex)
{
MessageBox.Show("Monitor_Error: " + ex.Message,
clsUtil.TituloAviso,
MessageBoxButtons.OK,
MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button1);
}
}