public void Init(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused, bool hasDelegate) { ActivityHandler = activityHandler; AttributionPackage = attributionPackage; Paused = startPaused; HasDelegate = hasDelegate; }
public IHttpResponse HandleRequest(IHttpRequest request, TokenState tokenState) { _logger.Trace($"{nameof(RequestBroker)}.{nameof(HandleRequest)}", new LogItem("Event", "GetRequestHandler started")); Stopwatch timer = Stopwatch.StartNew(); IActivityHandler handler = GetRequestHandler(request); var handlerName = handler != null?handler.GetType().Name : "null"; _logger.Trace($"{nameof(RequestBroker)}.{nameof(HandleRequest)}", new LogItem("Event", "GetRequestHandler completed"), new LogItem("DurationMilliseconds", timer.Elapsed.TotalMilliseconds), new LogItem("FoundHandler", handlerName)); if (handler == null) { return(null); } IHttpResponse response = _container.GetInstance <IHttpResponse>(true); _logger.Trace($"{nameof(RequestBroker)}.{nameof(HandleRequest)}", new LogItem("Event", "Handler Handle called")); timer.Restart(); handler.Handle(request, response); _logger.Trace($"{nameof(RequestBroker)}.{nameof(HandleRequest)}", new LogItem("Event", "Handler Handle completed"), new LogItem("DurationMilliseconds", timer.Elapsed.TotalMilliseconds)); return(response); }
public SdkClickHandler(IActivityHandler activityHandler, bool startPaused) { Init(activityHandler, startPaused); _requestHandler = new RequestHandler( successCallbac: (responseData) => ProcessSdkClickResponseData(responseData), failureCallback: (_, sdkClickPackage) => RetrySendingI(sdkClickPackage)); }
public void Init(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused) { _activityHandler = activityHandler; _deviceUtil = deviceUtil; _isPaused = startPaused; _basePath = activityHandler.BasePath; }
public RequestHandler( IActivityHandler activityHandler, Action <ResponseData> successCallbac, Action <ResponseData, ActivityPackage> failureCallback) { Init(activityHandler, successCallbac, failureCallback); }
public void Init(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused, bool hasDelegate) { ActivityHandler = activityHandler; AttributionPackage = attributionPackage; Paused = startPaused; HasDelegate = hasDelegate; }
IActivityHandler StartActivity(Guid activityId, IDictionary <string, object> args, string title = null) { IActivityExecutor executor = chatSession.CreateActivity(activityId); IActivity activity = context.PluginLoader.GetActivity(activityId); IActivityHandler handler = activity.Coalesce(a => a.CreateInvite(executor, args)); if (handler == null) { return(null); } if (handler is IVoiceChatHandler) { var voiceHandler = (IVoiceChatHandler)handler; voiceHandler.Dispatcher = Dispatcher; chatTextBox.AddVoiceChatSentRequest(context, voiceHandler, PrimaryBuddy.DisplayName); } else if (handler is IFileTransferHandler) { var fileHandler = (IFileTransferHandler)handler; fileTransfers.Add(fileHandler); chatTextBox.AddFileSentRequest(fileHandler); } else { chatTextBox.AddActivitySentRequest(PrimaryBuddy.DisplayName, title, handler); } handler.Start(); chatState.ChatStarted = true; return(handler); }
public void Init(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused) { _activityHandler = activityHandler; _attributionPackage = attributionPackage; _paused = startPaused; _basePath = activityHandler.BasePath; }
protected IActivityHandler AddChild(IActivityHandler activityHandler) { AddChild(activityHandler as Sandbox); _activityHandlers.Add(activityHandler); activityHandler.OnRequestToStart += load => RequestToStart(load, activityHandler); return(activityHandler); }
public static IPackageHandler GetPackageHandler(IActivityHandler activityHandler, bool startPaused) { if (IPackageHandler == null) return new PackageHandler(activityHandler, startPaused); IPackageHandler.Init(activityHandler, startPaused); return IPackageHandler; }
public PackageHandler(IActivityHandler activityHandler, bool startPaused) { Logger = AdjustFactory.Logger; InternalQueue = new ActionQueue("adjust.PackageQueue"); InternalQueue.Enqueue(() => InitInternal(activityHandler, startPaused)); }
private void InitI(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused) { ReadPackageQueueI(); _internalWaitHandle = new ManualResetEvent(true); // door starts open (signaled) _requestHandler = AdjustFactory.GetRequestHandler(SendNextPackage, CloseFirstPackage); }
public PackageHandler(IActivityHandler activityHandler, bool startPaused) { Logger = AdjustFactory.Logger; InternalQueue = new ActionQueue("adjust.PackageQueue"); InternalQueue.Enqueue(() => InitInternal(activityHandler, startPaused)); }
public SkillHttpAdapter( SkillHttpBotAdapter skillHttpBotAdapter, IAuthenticationProvider authenticationProvider = null, IBotTelemetryClient botTelemetryClient = null) { _skillHttpBotAdapter = skillHttpBotAdapter ?? throw new ArgumentNullException(nameof(SkillHttpBotAdapter)); _authenticationProvider = authenticationProvider; _botTelemetryClient = botTelemetryClient ?? NullBotTelemetryClient.Instance; }
public void Init( IActivityHandler activityHandler, Action <ResponseData> successCallbac, Action <ResponseData, ActivityPackage> failureCallback) { _activityHandlerWeakReference = new WeakReference <IActivityHandler>(activityHandler); _successCallback = successCallbac; _failureCallback = failureCallback; }
public static ISdkClickHandler GetSdkClickHandler(IActivityHandler activityHandler, bool startPaused) { if (_iSdkClickHandler == null) { return(new SdkClickHandler(activityHandler, startPaused)); } _iSdkClickHandler.Init(activityHandler, startPaused); return(_iSdkClickHandler); }
private void InitInternal(IActivityHandler activityHandler, bool startPaused) { Init(activityHandler, startPaused); ReadPackageQueue(); InternalWaitHandle = new ManualResetEvent(true); // door starts open (signaled) RequestHandler = AdjustFactory.GetRequestHandler(this); }
public static IPackageHandler GetPackageHandler(IActivityHandler activityHandler, IDeviceUtil deviceUtil, bool startPaused) { if (_iPackageHandler == null) { return(new PackageHandler(activityHandler, deviceUtil, startPaused)); } _iPackageHandler.Init(activityHandler, deviceUtil, startPaused); return(_iPackageHandler); }
public static IPackageHandler GetPackageHandler(IActivityHandler activityHandler, bool startPaused) { if (IPackageHandler == null) { return(new PackageHandler(activityHandler, startPaused)); } IPackageHandler.Init(activityHandler, startPaused); return(IPackageHandler); }
public AttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused) { Init(activityHandler: activityHandler, attributionPackage: attributionPackage, startPaused: startPaused); _urlQuery = BuildUrlQuery(); _timer = new TimerOnce(actionQueue: _actionQueue, action: SendAttributionRequestI); }
public void Teardown() { if (!CheckActivityHandler()) { return; } _activityHandler.Teardown(); _activityHandler = null; }
public static Task SetFailureResponseAsync <TRequest, TResponse>( this IActivityHandler <TRequest, TResponse> that, IActivityContext <TRequest> activityContext, System.Exception error) where TRequest : IRequest <TResponse>, IRequestBase where TResponse : IResponseBase { var failureResponse = new FailureActivityResponse(error); return(activityContext.SetActivityResponseAsync(failureResponse)); }
public void Teardown() { _timer?.Teardown(); _actionQueue?.Teardown(); _actionQueue = null; _activityHandler = null; _logger = null; _attributionPackage = null; _timer = null; }
public static IRequestHandler GetRequestHandler(IActivityHandler activityHandler, Action <ResponseData> sendNextCallback, Action <ResponseData, ActivityPackage> retryCallback) { if (_iRequestHandler == null) { return(new RequestHandler(activityHandler, sendNextCallback, retryCallback)); } _iRequestHandler.Init(activityHandler, sendNextCallback, retryCallback); return(_iRequestHandler); }
public static Task SetResponseAsync <TRequest, TResponse>( this IActivityHandler <TRequest, TResponse> that, IActivityContext <TRequest> activityContext, TResponse response) where TRequest : IRequest <TResponse>, IRequestBase where TResponse : IResponseBase { var okResponse = new OkResultActivityResponse <TResponse>(response); return(activityContext.SetActivityResponseAsync(okResponse)); }
public IActivityHandler <TRequest, TResponse> CreateHandler <TRequest, TResponse>( RequestRelatedType?requestRelatedType, IActivityContext <TRequest> activityContext ) where TRequest : IRequest <TResponse>, IRequestBase where TResponse : IResponseBase { if (requestRelatedType is null) { if (!this._MediatorService.TryRequestRelatedType(typeof(TRequest), out requestRelatedType) || (requestRelatedType is null)) { throw new NotSupportedException($"Unknown RequestType: {typeof(TRequest).FullName}"); } } if (activityContext is null) { throw new ArgumentNullException(nameof(activityContext)); } IActivityHandler <TRequest, TResponse>?result = null; if (requestRelatedType.DispatcherType is object) { var dispatchActivityHandler = (IDispatchActivityHandler <TRequest, TResponse>) this._ServiceProvider.GetService(requestRelatedType.DispatcherType); if (dispatchActivityHandler is null) { throw new NotSupportedException($"Unknown IDispatchActivityHandler { requestRelatedType.DispatcherType.FullName } RequestType: {typeof(TRequest).FullName} ResponseType: {typeof(TResponse).FullName}"); } result = dispatchActivityHandler.GetActivityHandler( requestRelatedType.HandlerTypes, activityContext, (Type activityHandlerType) => (IActivityHandler <TRequest, TResponse>) this._ServiceProvider.GetService(activityHandlerType) ); } else if (requestRelatedType.HandlerTypes.Length == 1) { result = (IActivityHandler <TRequest, TResponse>) this._ServiceProvider.GetRequiredService(requestRelatedType.HandlerTypes[0]); } else { result = this._ServiceProvider.GetService <IActivityHandler <TRequest, TResponse> >(); } if (result is null) { throw new NotSupportedException($"Unknown IActivityHandler RequestType: {typeof(TRequest).FullName} ResponseType: {typeof(TResponse).FullName}"); } else { return(result); } }
public void ApplicationLaunching(AdjustConfig adjustConfig, IDeviceUtil deviceUtil) { adjustConfig.PreLaunchActions = _preLaunchActions; adjustConfig.StartEnabled = _startEnabled; adjustConfig.StartOffline = _startOffline; AdjustConfig.String2Sha256Func = deviceUtil.HashStringUsingSha256; AdjustConfig.String2Sha512Func = deviceUtil.HashStringUsingSha512; AdjustConfig.String2Md5Func = deviceUtil.HashStringUsingShaMd5; _activityHandler = ActivityHandler.GetInstance(adjustConfig, deviceUtil); }
public static IAttributionHandler GetAttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPacakage, bool startPaused) { if (_iAttributionHandler == null) { return(new AttributionHandler(activityHandler, attributionPacakage, startPaused)); } _iAttributionHandler.Init(activityHandler, attributionPacakage, startPaused); return(_iAttributionHandler); }
public void Teardown() { _actionQueue?.Teardown(); _requestHandler.Teardown(); _packageQueue.Clear(); _actionQueue = null; _requestHandler = null; _activityHandler = null; _packageQueue = null; _logger = null; _backoffStrategy = null; }
public static IAttributionHandler GetAttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPacakage, bool startPaused, bool hasDelegate) { if (IAttributionHandler == null) { return(new AttributionHandler(activityHandler, attributionPacakage, startPaused, hasDelegate)); } IAttributionHandler.Init(activityHandler, attributionPacakage, startPaused, hasDelegate); return(IAttributionHandler); }
public AttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused, bool hasDelegate) { Logger = AdjustFactory.Logger; InternalQueue = new ActionQueue("adjust.AttributionHandler"); Init(activityHandler: activityHandler, attributionPackage: attributionPackage, startPaused: startPaused, hasDelegate: hasDelegate); Timer = new TimerOnce(actionQueue: InternalQueue, action: GetAttributionInternal); }
public static IAttributionHandler GetAttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPacakage, bool startPaused, bool hasDelegate) { if (IAttributionHandler == null) { return new AttributionHandler(activityHandler, attributionPacakage, startPaused, hasDelegate); } IAttributionHandler.Init(activityHandler, attributionPacakage, startPaused, hasDelegate); return IAttributionHandler; }
public AttributionHandler(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused, bool hasDelegate) { Logger = AdjustFactory.Logger; InternalQueue = new ActionQueue("adjust.AttributionHandler"); Init(activityHandler: activityHandler, attributionPackage: attributionPackage, startPaused: startPaused, hasDelegate: hasDelegate); Timer = new TimerOnce(actionQueue: InternalQueue, action: GetAttributionInternal); }
void OnUnknownActivityInvite(string activity, IActivityHandler handler) { Dispatcher.Invoke(() => { FlashWindow(); if (handler == null) { chatTextBox.AddInfo(Translation.Instance.ChatWindow_UnknownActivityInvite); } else { chatTextBox.AddActivityReceiveRequest(PrimaryBuddy.DisplayName, activity, handler); } }); }
public GenericActivityControl(IActivityHandler session, string buddyName, string activityName, bool sending) : this() { this.session = session; this.sending = sending; this.buddyName = buddyName; this.activityName = activityName; Status = String.Format(sending ? Translation.Instance.Activity_Waiting : Translation.Instance.Activity_Invitation, buddyName, activityName); btnCancelTransfer.Content = sending ? Translation.Instance.Activity_Cancel : Translation.Instance.Activity_Reject; session.TransferStarted += session_TransferStarted; session.TransferCancelled += session_TransferCancelled; session.TransferCompleted += session_TransferCompleted; ShowWaiting(); }
public ActivityController(IActivityHandler activityHandler) { _activityHandler = activityHandler; }
public void Init(IActivityHandler activityHandler, ActivityPackage attributionPackage, bool startPaused, bool hasDelegate) { MockLogger.Test("{0} Init, startPaused {1}, hasDelegate {2}", prefix, startPaused, hasDelegate); }
private void InitInternal(IActivityHandler activityHandler, bool startPaused) { Init(activityHandler, startPaused); ReadPackageQueue(); InternalWaitHandle = new ManualResetEvent(true); // door starts open (signaled) RequestHandler = AdjustFactory.GetRequestHandler(this); }
public void Init(IActivityHandler activityHandler, bool startPaused) { ActivityHandler = activityHandler; IsPaused = startPaused; }
public static void SetActivityHandler(IActivityHandler activityHandler) { IActivityHandler = activityHandler; }
public void Init(IActivityHandler activityHandler, bool startPaused) { MockLogger.Test("{0} Init, startPaused: {1}", prefix, startPaused); }