Exemplo n.º 1
0
 public TextWriterPublisher(TextWriter writer, bool ownsWriter = default, IUnhandledExceptionObserver unhandledExceptionObserver = default)
 {
     writer.EnsureNotNull(nameof(writer));
     //
     _writer     = writer;
     _ownsWriter = ownsWriter;
     _syncCtx    = new StatefulSynchronizationContext <Nil>(stateFactory: locCt => VoidVh.Instance, stopToken: default, correlationId: default, autoStart: true, unhandledExceptionObserver: unhandledExceptionObserver);
Exemplo n.º 2
0
 internal P_SignalSubscription(ITrigger trigger, IUnhandledExceptionObserver unhandledExceptionObserver, Action <ITriggerSignalProperties, IDisposable> onSignal)
     : base(trigger: trigger, unhandledExceptionObserver: unhandledExceptionObserver)
 {
     //
     onSignal.EnsureNotNull(nameof(onSignal));
     //
     _onSignal = onSignal;
 }
Exemplo n.º 3
0
 private protected P_SignalSubscriptionBase(ITrigger trigger, IUnhandledExceptionObserver unhandledExceptionObserver)
 {
     trigger.EnsureNotNull(nameof(trigger));
     unhandledExceptionObserver.EnsureNotNull(nameof(unhandledExceptionObserver));
     //
     _trigger = trigger;
     _unhandledExceptionObserver = unhandledExceptionObserver;
     //
     P_SubscribeToNextSignal();
 }
Exemplo n.º 4
0
 public static IUnhandledExceptionObserver DeriveObserver(
     this IUnhandledExceptionObserver baseObserver,
     ArgumentPlaceholder <object> component      = default,
     ArgumentPlaceholder <string> message        = default,
     ArgumentPlaceholder <IContext> exceptionCtx = default)
 {
     //
     if (baseObserver is null)
     {
         return(null);
     }
     else
     {
         return(new P_DelegatedUnhandledExceptionObserver(observe: baseObserver.ObserveException, component: component, message: message, exceptionCtx: exceptionCtx));
     }
 }
Exemplo n.º 5
0
 public static IDisposable SubscribeToSignal <TState1, TState2>(
     this ITrigger trigger,
     Action <ITriggerSignalProperties, IDisposable, TState1, TState2> onSignal,
     TState1 state1,
     TState2 state2,
     IUnhandledExceptionObserver exceptionObserver = default)
 {
     //
     onSignal.EnsureNotNull(nameof(onSignal));
     //
     return
         (new P_SignalSubscription <Tuple <TState1, TState2> >(
              trigger: trigger,
              unhandledExceptionObserver: exceptionObserver ?? UnhandledExceptionObserverOption.Require(),
              onSignal: (locSignalProps, locSubscription, locState) => onSignal(locSignalProps, locSubscription, locState.Item1, locState.Item2),
              state: Tuple(state1, state2)));
 }
Exemplo n.º 6
0
 public XAppContainerControl(IUnhandledExceptionObserver unhandledExceptionObserver = default)
 {
     _configuration =
         new DisposableLazy <IXAppContainerControlConfiguration>(
             factory:
             () => {
         // TODO: Put strings into the resources.
         //
         RequireConfiguration(configuration: out var locConfiguration);
         if (locConfiguration is null)
         {
             throw new EonException(message: $"No configuration provided for this component (see method '{nameof(RequireConfiguration)}').{Environment.NewLine}\tComponent:{this.FmtStr().GNLI2()}");
         }
         return(locConfiguration);
     },
             ownsValue: false);
     P_CtorInitializer(unhandledExceptionObserver: unhandledExceptionObserver);
 }
Exemplo n.º 7
0
 void P_CtorInitializer(IUnhandledExceptionObserver unhandledExceptionObserver = default)
 {
     _unhandledExceptionObserver = unhandledExceptionObserver ?? UnhandledExceptionObserverOption.Require();
     _runControl = new RunControl <XAppContainerControl>(options: RunControlOptions.SingleStart, component: this, start: DoStartAsync, stop: DoShutdownAsync);
 }
Exemplo n.º 8
0
 public XAppContainerControl(IXAppContainerControlConfiguration configuration, bool ownsConfiguration = false, IUnhandledExceptionObserver unhandledExceptionObserver = default)
 {
     configuration.EnsureNotNull(nameof(configuration));
     //
     _configuration = new DisposableLazy <IXAppContainerControlConfiguration>(value: configuration, ownsValue: ownsConfiguration);
     P_CtorInitializer(unhandledExceptionObserver: unhandledExceptionObserver);
 }
Exemplo n.º 9
0
 public UnhandledExceptionObserverOption(IUnhandledExceptionObserver observer)
 {
     observer.EnsureNotNull(nameof(observer));
     //
     Observer = observer;
 }
Exemplo n.º 10
0
 public static IDisposable SubscribeToSignal <TState>(this ITrigger trigger, Action <ITriggerSignalProperties, IDisposable, TState> onSignal, TState state, IUnhandledExceptionObserver exceptionObserver = default)
 => new P_SignalSubscription <TState>(trigger: trigger, unhandledExceptionObserver: exceptionObserver ?? UnhandledExceptionObserverOption.Require(), onSignal: onSignal, state: state);