当前位置: 首页>>代码示例>>C#>>正文


C# CancellationToken.RequestCanceled方法代码示例

本文整理汇总了C#中System.Threading.CancellationToken.RequestCanceled方法的典型用法代码示例。如果您正苦于以下问题:C# CancellationToken.RequestCanceled方法的具体用法?C# CancellationToken.RequestCanceled怎么用?C# CancellationToken.RequestCanceled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Threading.CancellationToken的用法示例。


在下文中一共展示了CancellationToken.RequestCanceled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Get

        public Task<Binding> Get(Action<QueueTarget> queue, Action<ExchangeTarget> exchange,
                                 Action<VirtualHostTarget> virtualHost, Action<PropertiesKeyTarget> propertiesKey,
                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            var queueTargetImpl = new QueueTargetImpl();
            queue(queueTargetImpl);

            var virtualHostTargetImpl = new VirtualHostTargetImpl();
            virtualHost(virtualHostTargetImpl);

            var exchangeTargetImpl = new ExchangeTargetImpl();
            exchange(exchangeTargetImpl);

            var propertiesKeyTargetImpl = new PropertiesKeyTargetImpl();
            propertiesKey(propertiesKeyTargetImpl);

            string url = string.Format("api/bindings/{0}/e/{1}/q/{2}/{3}",
                                       virtualHostTargetImpl.Target.SanitizeVirtualHostName(),
                                       exchangeTargetImpl.Target, queueTargetImpl.Target,
                                       propertiesKeyTargetImpl.Target.SanitizePropertiesKey());

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return queue binding between queue '{0}' and exchange '{1}' in virtual host '{2}'.",
                    queueTargetImpl.Target, exchangeTargetImpl.Target, virtualHostTargetImpl.Target));

            return base.Get(url, cancellationToken).As<Binding>(cancellationToken);
        }
开发者ID:ahives,项目名称:HareDu,代码行数:30,代码来源:QueueBindingResourcesImpl.cs

示例2: Delete

        public Task<ServerResponse> Delete(string userName,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/permissions/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), userName);

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:9,代码来源:UserPermissionsClientImpl.cs

示例3: GetAll

        public Task<IEnumerable<Connection>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all connections on current RabbitMQ server.");

            string url = "api/connections";

            return base.Get(url, cancellationToken).As<IEnumerable<Connection>>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:10,代码来源:ConnectionClientImpl.cs

示例4: GetAll

        public Task<IEnumerable<Node>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all nodes on RabbitMQ cluster.");

            string url = "api/nodes";

            return base.Get(url, cancellationToken).As<IEnumerable<Node>>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:10,代码来源:NodeClientImpl.cs

示例5: Get

        public Task<Node> Get(string nodeName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return all information pertaining to all nodes on RabbitMQ cluster.");

            string url = string.Format("api/nodes/{0}", nodeName);

            return base.Get(url, cancellationToken).As<Node>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:10,代码来源:NodeClientImpl.cs

示例6: Get

        public Task<Overview> Get(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo("Sent request to return general information pertaining to current RabbitMQ server.");

            string url = "api/overview";

            return base.Get(url, cancellationToken).As<Overview>(cancellationToken);
        }
开发者ID:ahives,项目名称:HareDu,代码行数:10,代码来源:OverviewResourcesImpl.cs

示例7: GetAll

        public Task<IEnumerable<Parameter>> GetAll(CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                "Sent request to return all information pertaining to all parameters on all virtual hosts on current RabbitMQ server.");

            string url = "api/parameters";

            return base.Get(url, cancellationToken).As<IEnumerable<Parameter>>(cancellationToken);
        }
开发者ID:ahives,项目名称:HareDu,代码行数:11,代码来源:ParameterResourcesImpl.cs

示例8: Get

        public Task<User> Get(string userName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(string.Format(
                "Sent request to the RabbitMQ server to return information pertaining to user '{0}'.", userName));

            string url = string.Format("api/users/{0}", userName);

            return base.Get(url, cancellationToken).As<User>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:11,代码来源:UserClientImpl.cs

示例9: Delete

        public Task<ServerResponse> Delete(string policy,
                                           CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(string.Format("Sent request to RabbitMQ server to delete policy '{0}' from virtual host '{1}'.",
                                  policy, Init.VirtualHost));

            string url = string.Format("api/policies/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), policy);

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:12,代码来源:PolicyClientImpl.cs

示例10: Get

        public Task<Permissions> Get(string userName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/permissions/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), userName);

            LogInfo(
                string.Format(
                    "Sent request to return user permission information pertaining to user '{0}' on virtual host '{1}' users on current RabbitMQ server.",
                    userName, Init.VirtualHost));

            return base.Get(url, cancellationToken).As<Permissions>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:13,代码来源:UserPermissionsClientImpl.cs

示例11: Get

        public Task<Channel> Get(string channelName, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/channels/{0}", channelName);

            LogInfo(
                string.Format(
                    "Sent request to return all information pertaining to channel '{0}' on current RabbitMQ server.",
                    channelName));

            return base.Get(url, cancellationToken).As<Channel>(cancellationToken);
        }
开发者ID:ahives,项目名称:HareDu,代码行数:13,代码来源:ChannelResourcesImpl.cs

示例12: Get

        public Task<Exchange> Get(string exchange, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return information pertaining to exchange '{0}' belonging to virtual host '{1}'.",
                    exchange, Init.VirtualHost));

            string url = string.Format("api/exchanges/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), exchange);

            return base.Get(url, cancellationToken).As<Exchange>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:13,代码来源:ExchangeClientImpl.cs

示例13: Get

        public Task<Policy> Get(string policy, Action<PolicyBehavior> args,
                                CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return policy information pertaining to policy '{0}' belonging to virtual host '{1}'.",
                    policy, Init.VirtualHost));

            string url = string.Format("api/policies/{0}/{1}", Init.VirtualHost.SanitizeVirtualHostName(), policy);

            return base.Get(url, cancellationToken).As<Policy>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:14,代码来源:PolicyClientImpl.cs

示例14: Close

        public Task<ServerResponse> Close(string connectionName,
                                          CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            string url = string.Format("api/connections/{0}", connectionName);

            LogInfo(
                string.Format(
                    "Sent request to return all information pertaining to connection '{0}' on current RabbitMQ server.",
                    connectionName));

            return base.Delete(url, cancellationToken).Response<ServerResponse>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:14,代码来源:ConnectionClientImpl.cs

示例15: GetAll

        public Task<IEnumerable<Binding>> GetAll(string queue,
                                                 CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.RequestCanceled(LogInfo);

            LogInfo(
                string.Format(
                    "Sent request to RabbitMQ server to return all bindings on queue '{0}' belonging to virtual host '{1}'.",
                    queue, Init.VirtualHost));

            string url = string.Format("api/queues/{0}/{1}/bindings", Init.VirtualHost.SanitizeVirtualHostName(), queue);

            return base.Get(url, cancellationToken).As<IEnumerable<Binding>>(cancellationToken);
        }
开发者ID:gnana,项目名称:HareDu,代码行数:14,代码来源:QueueBindingClientImpl.cs


注:本文中的System.Threading.CancellationToken.RequestCanceled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。