本文整理汇总了C#中ExceptionEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ExceptionEventArgs类的具体用法?C# ExceptionEventArgs怎么用?C# ExceptionEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionEventArgs类属于命名空间,在下文中一共展示了ExceptionEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCallbackException
internal bool OnCallbackException(Exception exception)
{
var args = new ExceptionEventArgs(exception);
OnCallbackException(args);
return args.Handled;
}
示例2: FileLoader_GetFileAsTextFailed
void FileLoader_GetFileAsTextFailed(object sender, ExceptionEventArgs e)
{
if (e.Exception != null)
OnGetConnectionsFailed(new ExceptionEventArgs(e.Exception, e.UserState));
else
OnGetConnectionsFailed(new ExceptionEventArgs(new Exception(Resources.Strings.ExceptionUnknownError), e.UserState));
}
示例3: Arrange
protected void Arrange()
{
var random = new Random();
_subsystemName = random.Next().ToString(CultureInfo.InvariantCulture);
_operationTimeout = TimeSpan.FromSeconds(30);
_encoding = Encoding.UTF8;
_disconnectedRegister = new List<EventArgs>();
_errorOccurredRegister = new List<ExceptionEventArgs>();
_errorOccurredEventArgs = new ExceptionEventArgs(new SystemException());
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_channelMock = new Mock<IChannelSession>(MockBehavior.Strict);
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.CreateChannelSession()).Returns(_channelMock.Object);
_channelMock.InSequence(_sequence).Setup(p => p.Open());
_channelMock.InSequence(_sequence).Setup(p => p.SendSubsystemRequest(_subsystemName)).Returns(true);
_subsystemSession = new SubsystemSessionStub(
_sessionMock.Object,
_subsystemName,
_operationTimeout,
_encoding);
_subsystemSession.Disconnected += (sender, args) => _disconnectedRegister.Add(args);
_subsystemSession.ErrorOccurred += (sender, args) => _errorOccurredRegister.Add(args);
_subsystemSession.Connect();
}
示例4: OnException
protected virtual void OnException(ExceptionEventArgs e)
{
if (this.Exception != null)
{
this.Exception(this, e);
}
}
示例5: onThrowException
protected virtual void onThrowException(ExceptionEventArgs e)
{
EventHandler<ExceptionEventArgs> handler = ThrowException;
if(handler != null)
{
handler(this, e);
}
}
示例6: ExceptionEventArgs_Unit_BubbleException_True
public void ExceptionEventArgs_Unit_BubbleException_True()
{
Exception exception = new ApplicationException("This is a test.").AsThrown();
ExceptionEventArgs target = new ExceptionEventArgs(exception);
Boolean value = true;
target.BubbleException = value;
Assert.AreEqual(value, target.BubbleException);
}
示例7: BitmapDownloadFailed
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e)
{
var bitmap = (BitmapSource)sender;
bitmap.DownloadCompleted -= BitmapDownloadCompleted;
bitmap.DownloadFailed -= BitmapDownloadFailed;
Image.Source = null;
}
示例8: BitmapDownloadFailed
private void BitmapDownloadFailed(object sender, ExceptionEventArgs e)
{
var bitmap = (BitmapSource)sender;
bitmap.DownloadCompleted -= BitmapDownloadCompleted;
bitmap.DownloadFailed -= BitmapDownloadFailed;
((MapImage)Children[currentImageIndex]).Source = null;
BlendImages();
}
示例9: bmp_DownloadFailed
void bmp_DownloadFailed(object sender, ExceptionEventArgs e)
{
BitmapFrame bmp = (BitmapFrame)sender;
var id = downloadingTiles[bmp];
downloadingTiles.Remove(bmp);
UnsubscribeBitmapEvents(bmp);
bmp.Freeze();
ReportFailure(id);
}
示例10: OnNonFatalError
/// <summary>
/// Handles non-fatal errors by writing a message describing the exception or
/// failure to stderror.
/// </summary>
/// <param name="sender">Source of the error</param>
/// <param name="e">Specifics of the exception or failure</param>
internal static void OnNonFatalError(Object sender, ExceptionEventArgs e)
{
if (e.Exception != null)
{
Console.Error.WriteLine("Non-fatal exception: {0}", e.Exception.Message);
}
else
{
Console.Error.WriteLine("Non-fatal failure: {0}", e.Failure.Message);
}
}
示例11: FileLoader_FileLoadFailed
void FileLoader_FileLoadFailed(object sender, ExceptionEventArgs e)
{
if (e.Exception != null)
{
OnGetConfigurationStoreFailed(new ExceptionEventArgs(e.Exception, e.UserState));
}
else
{
OnGetConfigurationStoreFailed(new ExceptionEventArgs(new Exception(Resources.Strings.ExceptionUnknownError), e.UserState));
}
}
示例12: LocalCrashHandler
private static void LocalCrashHandler(object sender, ExceptionEventArgs args)
{
var exception = args.ErrorException;
var recoverable = exception as RecoverableException;
if(recoverable != null)
{
MessageDialog.ShowError(args.ErrorException.Message);
}
else
{
MessageDialog.ShowWarning(args.ErrorException.ToString());
}
}
示例13: ExceptionEventArgs_Integration_Serialization_Optimal
public void ExceptionEventArgs_Integration_Serialization_Optimal()
{
Exception exception = new ApplicationException("This is a test.").AsThrown();
Boolean bubbleException = true;
ExceptionEventArgs original = new ExceptionEventArgs(exception, bubbleException);
ExceptionEventArgs clone = original.SerializeBinary();
Assert.AreNotSame(original, clone);
Assert.AreEqual(original.BubbleException, clone.BubbleException);
Assert.AreEqual(original.Exception.GetType(), clone.Exception.GetType());
Assert.AreEqual(original.Exception.Message, clone.Exception.Message);
Assert.AreEqual(original.Exception.StackTrace, clone.Exception.StackTrace);
}
示例14: OnBackgroundOpenReadAsyncFailed
protected virtual void OnBackgroundOpenReadAsyncFailed(ExceptionEventArgs args)
{
if (BackgroundOpenReadAsyncFailed != null)
{
if (ESRI.ArcGIS.Client.Extensibility.MapApplication.Current != null)
{
ESRI.ArcGIS.Client.Extensibility.MapApplication.Current.Dispatcher.BeginInvoke((Action)delegate
{
BackgroundOpenReadAsyncFailed(this, args);
});
}
else
BackgroundOpenReadAsyncFailed(this, args);
}
}
示例15: SymbolConfigProvider_GetDefaultSymbolFailed
void SymbolConfigProvider_GetDefaultSymbolFailed(object sender, ExceptionEventArgs e)
{
GraphicsLayer layer = e.UserState as GraphicsLayer;
if (layer == null)
return;
if (Core.LayerExtensions.GetRunLayerPostInitializationActions(layer))
{
PerformPostLayerInitializationActions(layer, true);
Core.LayerExtensions.SetRunLayerPostInitializationActions(layer, false);
return;
}
AddLayer(layer, true, null);
}