Exemple #1
0
        /// <summary>
        ///     Sends an interaction request to a user
        ///     Отправляет интерактивный запрос пользователю(Вызов модального окна)
        /// </summary>
        /// <typeparam name="TViewModel">
        ///     <see cref="Type" /> that represents the view model of the interaction request
        /// </typeparam>
        /// <param name="provider">
        ///     An instance of <see cref="IInteractionProvider{TViewModel}" /> that represents current
        ///     interaction request provider
        /// </param>
        /// <param name="interactionInterceptor">
        ///     An instance of <see cref="InteractionInterceptor{TViewModel}" /> to use
        /// </param>
        /// <returns>
        ///     An instance of <see cref="IInteractionToken" /> that represents interaction request token
        /// </returns>
        public IInteractionToken Interact <TViewModel>(IInteractionProvider <TViewModel> provider,
                                                       InteractionInterceptor <TViewModel> interactionInterceptor)
            where TViewModel : IInteractionViewModel
        {
            Guard.AgainstNullReference(provider, "provider");

            var interactionEvent = this._eventAggregator.GetEvent <InteractionRequestEvent>();
            var result           = new InteractionToken(interactionEvent);

            interactionEvent.Publish(new InteractionRequestEventArgs
            {
                IsCanceled          = false,
                InteractionProvider = provider,
                InterceptorsInvoker = new InteractionInterceptorsInvoker <TViewModel>(interactionInterceptor),
                Callback            = result.Dispose
            });

            return(result);
        }
 /// <summary>
 ///     Creates an instance of <see cref="InteractionInterceptorsInvoker{TViewModel}" />
 /// </summary>
 /// <param name="interceptors">An instance of <see cref="InteractionInterceptor{TViewModel}" /> to use</param>
 public InteractionInterceptorsInvoker(InteractionInterceptor <TViewModel> interceptors)
 {
     this._interceptors = interceptors;
 }
 /// <summary>
 ///     Does actual explicit disposal of available managed resources
 ///     Уничтожение ресурсов
 /// </summary>
 protected override void OnDisposing()
 {
     this._interceptors = null;
     base.OnDisposing();
 }