public override void Load(Uri targetUri, Uri currentUri) { _loader = _parent.ContentLoader; try { if (!_loader.CanLoad(targetUri, currentUri)) { throw new CannotLoadException(_loader, targetUri, currentUri); } _result = _loader.BeginLoad(targetUri, currentUri, res => { try { LoadResult lr = _loader.EndLoad(res); if (lr.LoadedContent != null) { if (!(lr.LoadedContent is UserControl)) { throw new InvalidContentException( lr.LoadedContent); } Complete(lr.LoadedContent); return; } Complete(lr.RedirectUri); return; } catch (Exception e) { var ep = GetErrorPage(e); if (ep == null) { Error(e); return; } ErrorLoad(ep.Map(e), currentUri, e); } }, null); } catch (Exception e) { var ep = GetErrorPage(e); if (ep == null) { Error(e); return; } ErrorLoad(ep.Map(e), currentUri, e); } }
public override void Load(Uri targetUri, Uri currentUri) { _loader = _parent.ContentLoader ?? _defaultLoader; if (_parent.Authorizer != null) { try { _parent.Authorizer.CheckAuthorization(_parent.Principal, targetUri, currentUri); } catch (Exception e) { Error(e); return; } } try { _result = _loader.BeginLoad(targetUri, currentUri, res => { try { var loadResult = _loader.EndLoad(res); if (loadResult.RedirectUri != null) { Complete(loadResult.RedirectUri); } else { Complete(loadResult.LoadedContent); } return; } catch (Exception e) { Error(e); return; } }, null); } catch (Exception e) { Error(e); return; } }
private void ErrorLoad(Uri errorTarget, Uri currentUri, Exception ex) { _loader = _parent.ErrorContentLoader ?? _parent.ContentLoader; try { _result = _loader.BeginLoad(errorTarget, currentUri, res => { try { LoadResult lr = _loader.EndLoad(res); if (lr.LoadedContent != null) { if (lr.LoadedContent is DependencyObject) { SetError( (lr.LoadedContent as DependencyObject), ex); } Complete(lr.LoadedContent); return; } Complete(lr.RedirectUri); return; } catch (Exception e) { Error(e); return; } }, null); } catch (Exception e) { Error(e); return; } }
private void ErrorLoad(Uri errorTarget, Uri currentUri, Exception ex) { _loader = _parent.ErrorContentLoader ?? _parent.ContentLoader; try { _result = _loader.BeginLoad(errorTarget, currentUri, res => { try { LoadResult lr = _loader.EndLoad(res); if (lr.LoadedContent != null) { if (lr.LoadedContent is DependencyObject) SetError( (lr.LoadedContent as DependencyObject), ex); Complete(lr.LoadedContent); return; } Complete(lr.RedirectUri); return; } catch (Exception e) { Error(e); return; } }, null); } catch (Exception e) { Error(e); return; } }
public override void Load(Uri targetUri, Uri currentUri) { _loader = _parent.ContentLoader; try { if (!_loader.CanLoad(targetUri, currentUri)) throw new CannotLoadException(_loader, targetUri, currentUri); _result = _loader.BeginLoad(targetUri, currentUri, res => { try { LoadResult lr = _loader.EndLoad(res); if (lr.LoadedContent != null) { if (!(lr.LoadedContent is UserControl)) throw new InvalidContentException( lr.LoadedContent); Complete(lr.LoadedContent); return; } Complete(lr.RedirectUri); return; } catch (Exception e) { var ep = GetErrorPage(e); if (ep == null) { Error(e); return; } ErrorLoad(ep.Map(e), currentUri, e); } }, null); } catch (Exception e) { var ep = GetErrorPage(e); if (ep == null) { Error(e); return; } ErrorLoad(ep.Map(e), currentUri, e); } }
public override void Load(Uri targetUri, Uri currentUri) { _loader = _parent.ContentLoader ?? _defaultLoader; if (_parent.Authorizer != null) { try { _parent.Authorizer.CheckAuthorization(_parent.Principal, targetUri, currentUri); } catch (Exception e) { Error(e); return; } } try { _result = _loader.BeginLoad(targetUri, currentUri, res => { try { var loadResult = _loader.EndLoad(res); if (loadResult.RedirectUri != null) Complete(loadResult.RedirectUri); else Complete(loadResult.LoadedContent); return; } catch (Exception e) { Error(e); return; } }, null); } catch (Exception e) { Error(e); return; } }