• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Subscription类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Subscription的典型用法代码示例。如果您正苦于以下问题:C# Subscription类的具体用法?C# Subscription怎么用?C# Subscription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Subscription类属于命名空间,在下文中一共展示了Subscription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ConnectionAgent

        private void ConnectionAgent()
        {
            while (!_connectionEnd.WaitOne(0) && !Connected)
                try
                {
                    URL url = new URL(_OpcSection.Server.Name);
                    _Server = new Opc.Da.Server(new OpcCom.Factory(), null);
                    _Server.Connect(url, new ConnectData(new NetworkCredential()));

                    _groupRead = (Subscription)_Server.CreateSubscription(_GroupReadState);
                    _groupWrite = (Subscription)_Server.CreateSubscription(_GroupWriteState);

                    for (int i = 0; i < _OpcSection.Server.TagGroup.GetElement(_TagGroup).Tags.Count; i++)
                    {
                        _Items[i] = new Opc.Da.Item();
                        //_Items[i].ItemName = String.Format("{0}{1}", _OpcSection.Server.Channel, _OpcSection.Server.TagGroup.GetElement(_TagGroup).Tags[i].Name);
                        _Items[i].ItemName = _OpcSection.Server.Channel + "." + _OpcSection.Server.Device + "." + _OpcSection.Server.TagGroup.GetElement(_TagGroup).Tags[i].Name;
                        //string itmNam = String.Format("{0}]{1}", _OpcSection.Server.Channel, _OpcSection.Server.TagGroup.GetElement(_TagGroup).Tags[i].Name);
                        _logger.LogInfo(/*Mtd*/ ": recognized element " + _Items[i].ItemName);
                    }
                    _Items = _groupRead.AddItems(_Items);
                    _groupRead.DataChanged += new DataChangedEventHandler(Group_DataChanged);
                }
                catch (Exception ex) { _logger.LogError(ex); }
        }
开发者ID:BdGL3,项目名称:CXPortal,代码行数:25,代码来源:OpcClient.cs


示例2: CreateWithPlanAndInvalidCardCvv

        public void CreateWithPlanAndInvalidCardCvv()
        {
            var plan = CreateTestPlan ();

            plan.Save ();

            Assert.AreNotEqual (plan.Id, 0);

            var subscription = new Subscription {
                CardCvv = "651",
                CardExpirationDate = "0921",
                CardHolderName = "Jose da Silva",
                CardNumber = "4242424242424242",
                Customer = new Customer {
                    Email = "[email protected]"
                },
                Plan = plan
            };

            try {
                subscription.Save ();
            } catch (PagarMeException ex) {
                Assert.IsNotNull (ex.Error.Errors.Where (e => e.Type == "action_forbidden").FirstOrDefault ());
            }
        }
开发者ID:pagarme,项目名称:pagarme-net,代码行数:25,代码来源:SubscriptionTests.cs


示例3: SubscriptionDataExtended

 public SubscriptionDataExtended(Subscription subscription, SubscriptionData subscriptionData,
     string description, Operation operation)
 {
     OperationDescription = description;
     OperationStatus = operation.Status;
     OperationId = operation.OperationTrackingId;
     SubscriptionName = subscriptionData.SubscriptionName;
     SubscriptionId = subscriptionData.SubscriptionId;
     Certificate = subscriptionData.Certificate;
     CurrentStorageAccount = subscriptionData.CurrentStorageAccount;
     ServiceEndpoint = subscriptionData.ServiceEndpoint;
     SqlAzureServiceEndpoint = subscriptionData.SqlAzureServiceEndpoint;
     IsDefault = subscriptionData.IsDefault;
     AccountAdminLiveEmailId = subscription.AccountAdminLiveEmailId;
     CurrentCoreCount = subscription.CurrentCoreCount;
     CurrentHostedServices = subscription.CurrentHostedServices;
     CurrentStorageAccounts = subscription.CurrentStorageAccounts;
     CurrentDnsServers = subscription.CurrentDnsServers;
     CurrentLocalNetworkSites = subscription.CurrentLocalNetworkSites;
     CurrentVirtualNetworkSites = subscription.CurrentVirtualNetworkSites;
     MaxCoreCount = subscription.MaxCoreCount;
     MaxHostedServices = subscription.MaxHostedServices;
     MaxStorageAccounts = subscription.MaxStorageAccounts;
     MaxDnsServers = subscription.MaxDnsServers;
     MaxLocalNetworkSites = subscription.MaxLocalNetworkSites;
     MaxVirtualNetworkSites = subscription.MaxVirtualNetworkSites;
     ServiceAdminLiveEmailId = subscription.ServiceAdminLiveEmailId;
     SubscriptionRealName = subscription.SubscriptionName;
     SubscriptionStatus = subscription.SubscriptionStatus;
 }
开发者ID:xmbms,项目名称:azure-sdk-tools,代码行数:30,代码来源:SubscriptionDataExtended.cs


示例4: UpdateCore

        private void UpdateCore(Peer peer, Subscription subscription, bool isAddOrUpdate)
        {
            if (subscription.IsMatchingAllMessages)
            {
                var list = _peersHandlingAllMessages
                    .Where(i => i.Id != peer.Id)
                    .ToList();

                if (isAddOrUpdate)
                    list.Add(peer);

                _peersHandlingAllMessages = list;
            }
            else
            {
                var list = _dynamicPeerSubscriptions
                    .Where(item => item.Peer.Id != peer.Id || !Equals(item.Subscription, subscription))
                    .ToList();

                if (isAddOrUpdate)
                    list.Add(new PeerSubscription(peer, subscription));

                Interlocked.Exchange(ref _dynamicPeerSubscriptions, list);
            }
        }
开发者ID:MarouenK,项目名称:Zebus,代码行数:25,代码来源:PeerSubscriptionList.cs


示例5: CreateSubscription

        public void CreateSubscription()
        {
            var plan = new Plan(GetMockPlanCode(), GetMockPlanName())
            {
                Description = "Create Subscription Test"
            };
            plan.UnitAmountInCents.Add("USD", 100);
            plan.Create();
            PlansToDeactivateOnDispose.Add(plan);

            var account = CreateNewAccountWithBillingInfo();

            var coup = CreateNewCoupon(3);
            var sub = new Subscription(account, plan, "USD");
            sub.TotalBillingCycles = 5;
            sub.Coupon = coup;
            Assert.Null(sub.TaxInCents);
            Assert.Null(sub.TaxType);
            Assert.Null(sub.TaxRate);
            sub.Create();

            sub.ActivatedAt.Should().HaveValue().And.NotBe(default(DateTime));
            sub.State.Should().Be(Subscription.SubscriptionState.Active);
            Assert.Equal(5, sub.TotalBillingCycles);
            Assert.Equal(coup.CouponCode, sub.Coupon.CouponCode);
            Assert.Equal(9, sub.TaxInCents.Value);
            Assert.Equal("usst", sub.TaxType);
            Assert.Equal(0.0875M, sub.TaxRate.Value);

            var sub1 = Subscriptions.Get(sub.Uuid);
            Assert.Equal(5, sub1.TotalBillingCycles);
        }
开发者ID:Georotzen,项目名称:recurly-client-net,代码行数:32,代码来源:SubscriptionTest.cs


示例6: Unsubscribe

 private void Unsubscribe(Subscription subscription)
 {
     lock (_subscriptions)
     {
         _subscriptions.Remove(subscription);
     }
 }
开发者ID:oryol,项目名称:devicehive-.net,代码行数:7,代码来源:ObjectWaiter.cs


示例7: ListExpiredSubscriptions

        public void ListExpiredSubscriptions()
        {
            var plan = new Plan(GetMockPlanCode(), GetMockPlanName())
            {
                Description = "Subscription Test",
                PlanIntervalLength = 1,
                PlanIntervalUnit = Plan.IntervalUnit.Months
            };
            plan.UnitAmountInCents.Add("USD", 400);
            plan.Create();
            PlansToDeactivateOnDispose.Add(plan);

            for (var x = 0; x < 2; x++)
            {
                var account = CreateNewAccountWithBillingInfo();
                var sub = new Subscription(account, plan, "USD")
                {
                    StartsAt = DateTime.Now.AddMonths(-5)
                };

                sub.Create();
            }

            var subs = Subscriptions.List(Subscription.SubscriptionState.Expired);
            subs.Should().NotBeEmpty();
        }
开发者ID:Georotzen,项目名称:recurly-client-net,代码行数:26,代码来源:SubscriptionListTest.cs


示例8: TrafficManagerProfile

 internal TrafficManagerProfile(XElement xml, Subscription subscription) : this()
 {
     var ns = XmlNamespaces.WindowsAzure;
     xml.HydrateObject(ns, this);
     Enabled = (string) xml.Element(ns + "Status") != "Disabled";
     Subscription = subscription;
 }
开发者ID:mortizzle,项目名称:API,代码行数:7,代码来源:TrafficManagerProfile.cs


示例9: Show

        /// <summary>
        /// Displays the dialog.
        /// </summary>
        public void Show(Subscription subscription, bool useTypeModel)
        {
            if (subscription == null) throw new ArgumentNullException("subscription");
            
            Show();
            BringToFront();

            // remove previous subscription.
            if (m_subscription != null)
            {
                m_subscription.StateChanged -= m_SubscriptionStateChanged;
            }
            
            // start receiving notifications from the new subscription.
            m_subscription = subscription;
  
            if (subscription != null)
            {
                m_subscription.StateChanged += m_SubscriptionStateChanged;
            }                    

            m_subscription = subscription;
            
            BrowseCTRL.AllowPick = true;
            BrowseCTRL.SetView(subscription.Session, (useTypeModel)?BrowseViewType.ObjectTypes:BrowseViewType.Objects, null);

            MonitoredItemsCTRL.Initialize(subscription);
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:31,代码来源:CreateMonitoredItemsDlg.cs


示例10: PendingConnection

 //public XmlRpcValue stickaroundyouwench = null;
 public PendingConnection(XmlRpcClient client, Subscription s, string uri, XmlRpcValue chk)
 {
     this.client = client;
     this.chk = chk;
     parent = s;
     RemoteUri = uri;
 }
开发者ID:uml-robotics,项目名称:ROS.NET,代码行数:8,代码来源:PendingConnection.cs


示例11: MainViewModel

        public MainViewModel()
        {
            XDocument doc = XDocument.Load("Subscriptions.config");

            List<Subscription> subscriptions = new List<Subscription>();

            foreach (XElement elem in doc.Root.Elements("Subscription"))
            {
                Subscription subscription = new Subscription()
                {
                    Title = elem.Attribute("title").Value,
                    AccountName = elem.Attribute("accountName").Value,
                    AccountKey = elem.Attribute("accountKey").Value,
                    Roles = elem.Element("Roles").Elements("Role").Select(r => new Role()
                    {
                        Name = r.Attribute("name").Value,
                        PerformanceCounters = r.Element("PerformanceCounters").Elements("PerformanceCounterConfiguration").Select(o => o.Attribute("counterSpecifier").Value).ToArray()
                    }).ToArray()
                };

                subscriptions.Add(subscription);
            }

            this.Subscriptions = new ObservableCollection<Subscription>(subscriptions);
            RaisePropertyChanged("Subscriptions");

            this.LogEntries = new ObservableCollection<WadLogEntity>();
            RaisePropertyChanged("LogEntries");
        }
开发者ID:dstellakis,项目名称:AzureDiagnosticsViewer,代码行数:29,代码来源:MainViewModel.cs


示例12: addSubscription

 private void addSubscription(Subscription s)
 {
     AddBodyRow(row => {
         row.Cell(s.Receiver.ToString());
         row.Cell(s.MessageType);
     });
 }
开发者ID:kingreatwill,项目名称:fubumvc,代码行数:7,代码来源:SubscriptionsTableTag.cs


示例13: NewToOld

        public void NewToOld()
        {
            var oldSub = new Subscription("the message", new Uri("http://bob/phil"));
            IList<Subscription> oldSubs = new List<Subscription>();
            oldSubs.Add(oldSub);

            using (var newStream = new MemoryStream())
            {
                NewWriter.Serialize(newStream, oldSubs);

                newStream.Position = 0;

                using (var oldStream = new MemoryStream())
                {
                    using (var str = File.OpenRead(_pathToFile))
                    {
                        var buff = new byte[str.Length];
                        str.Read(buff, 0, buff.Length);
                        oldStream.Write(buff, 0, buff.Length);
                    }

                    if (File.Exists(".\\my_msg_2.txt")) File.Delete(".\\my_msg_2.txt");
                    using (var fs = File.OpenWrite(".\\my_msg_2.txt"))
                    {
                        fs.Write(newStream.ToArray(), 0, newStream.ToArray().Length);
                    }

                    StreamAssert.AreEqual(oldStream, newStream);
                }
            }
        }
开发者ID:madmonkey,项目名称:MassTransit,代码行数:31,代码来源:SerializeListOfSubscription.cs


示例14: LookupCouponInvoice

        public void LookupCouponInvoice()
        {
            var discounts = new Dictionary<string, int> { { "USD", 1000 } };
            var coupon = new Coupon(GetMockCouponCode(), GetMockCouponName(), discounts);
            coupon.Create();

            var plan = new Plan(GetMockPlanCode(), GetMockPlanCode())
            {
                Description = "Test Lookup Coupon Invoice"
            };
            plan.UnitAmountInCents.Add("USD", 1500);
            plan.Create();
            PlansToDeactivateOnDispose.Add(plan);

            var account = CreateNewAccountWithBillingInfo();

            var redemption = account.RedeemCoupon(coupon.CouponCode, "USD");

            var sub = new Subscription(account, plan, "USD", coupon.CouponCode);
            sub.Create();

            // TODO complete this test

            var invoices = account.GetInvoices();

            invoices.Should().NotBeEmpty();

            var invoice = Invoices.Get(invoices.First().InvoiceNumber);
            var fromInvoice = invoice.GetRedemption();

            redemption.Should().Be(fromInvoice);
        }
开发者ID:kylelengling,项目名称:recurly-client-net,代码行数:32,代码来源:CouponRedemptionTest.cs


示例15: StorageAccount

        internal StorageAccount(XElement xml, Subscription subscription)
            : this()
        {
            var azureNamespace = XmlNamespaces.WindowsAzure;

            xml.HydrateObject(azureNamespace, this);
            Subscription = subscription;

            var storageServicePropertiesElement = xml.Element(azureNamespace + "StorageServiceProperties");
            storageServicePropertiesElement.HydrateObject(azureNamespace, this);

            if (!string.IsNullOrEmpty(Label)) Label = Label.FromBase64String();

            var extendedProperties = xml.Element(azureNamespace + "ExtendedProperties");
            if (extendedProperties != null)
            {
                ExtendedProperties = extendedProperties.Elements()
                    .ToDictionary(
                        x => (string) x.Element(azureNamespace + "Name"),
                        x => (string) x.Element(azureNamespace + "Value"));
            }

            Endpoints = GetEndpoints(storageServicePropertiesElement, azureNamespace, "Endpoints");
            SecondaryEndpoints = GetEndpoints(storageServicePropertiesElement, azureNamespace, "SecondaryEndpoints");
        }
开发者ID:mortizzle,项目名称:API,代码行数:25,代码来源:StorageAccount.cs


示例16: DeleteAsync

        public async Task DeleteAsync()
        {
            Contract.Requires(Subscription != null);

            await GetRestClient("/" + Name).DeleteAsync();
            Subscription = null;
        }
开发者ID:mortizzle,项目名称:API,代码行数:7,代码来源:ReservedIp.cs


示例17: ShowDialog

        /// <summary>
        /// Prompts the user to specify the browse options.
        /// </summary>
        public bool ShowDialog(Subscription subscription)
        {
            if (subscription == null) throw new ArgumentNullException("subscription");

            DisplayNameTB.Text          = subscription.DisplayName;
            PublishingIntervalNC.Value  = subscription.Created ? (decimal)subscription.CurrentPublishingInterval : (decimal)subscription.PublishingInterval;
            KeepAliveCountNC.Value      = subscription.Created ? subscription.CurrentKeepAliveCount : subscription.KeepAliveCount;
            LifetimeCountCTRL.Value     = subscription.Created ? subscription.CurrentLifetimeCount: subscription.LifetimeCount;
            MaxNotificationsCTRL.Value  = subscription.MaxNotificationsPerPublish;
            PriorityNC.Value            = subscription.Created ? subscription.CurrentPriority : subscription.Priority;
            PublishingEnabledCK.Checked = subscription.Created ? subscription.CurrentPublishingEnabled : subscription.PublishingEnabled;
            
            if (ShowDialog() != DialogResult.OK)
            {
                return false;
            }

            subscription.DisplayName                = DisplayNameTB.Text;
            subscription.PublishingInterval         = (int)PublishingIntervalNC.Value;
            subscription.KeepAliveCount             = (uint)KeepAliveCountNC.Value;
            subscription.LifetimeCount              = (uint)LifetimeCountCTRL.Value;
            subscription.MaxNotificationsPerPublish = (uint)MaxNotificationsCTRL.Value;
            subscription.Priority                   = (byte)PriorityNC.Value;
            if (subscription.Created)
            {
                subscription.SetPublishingMode(PublishingEnabledCK.Checked);            
            }
            else
            {
                subscription.PublishingEnabled = PublishingEnabledCK.Checked;
            }
            return true;
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:36,代码来源:SubscriptionEditDlg.cs


示例18: ShowDialog

        /// <summary>
        /// Prompts the user to specify the browse options.
        /// </summary>
        public async Task<bool> ShowDialog(Subscription subscription)
        {
            if (subscription == null) throw new ArgumentNullException("subscription");

            DisplayNameTB.Text = subscription.DisplayName;
            PublishingIntervalNC.Value = (double)Convert.ToDecimal(subscription.PublishingInterval);
            KeepAliveCountNC.Value = subscription.KeepAliveCount;
            LifetimeCountCTRL.Value = subscription.LifetimeCount;
            MaxNotificationsCTRL.Value = subscription.MaxNotificationsPerPublish;
            PriorityNC.Value = subscription.Priority;
            PublishingEnabledCK.IsChecked = subscription.PublishingEnabled;

            TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
            Popup dialog = new Popup();
            dialog.Child = this;
            dialog.IsOpen = true;
            dialog.Closed += (o, e) =>
            {
                tcs.SetResult(dialogResult);
            };

            bool result = await tcs.Task;

            subscription.DisplayName = DisplayNameTB.Text;
            subscription.PublishingInterval = (int)PublishingIntervalNC.Value;
            subscription.KeepAliveCount = (uint)KeepAliveCountNC.Value;
            subscription.LifetimeCount = (uint)LifetimeCountCTRL.Value;
            subscription.MaxNotificationsPerPublish = (uint)MaxNotificationsCTRL.Value;
            subscription.Priority = (byte)PriorityNC.Value;
            subscription.PublishingEnabled = (bool)PublishingEnabledCK.IsChecked;

            return result;
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:36,代码来源:SubscriptionEditDlg.xaml.cs


示例19: AuditEventForm

        /// <summary>
        /// Initializes a new instance of the <see cref="AuditEventForm"/> class.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="subscription">The subscription.</param>
        public AuditEventForm(Session session, Subscription subscription)
        {
            InitializeComponent();

            m_session = session;
            m_subscription = subscription;

            // a table used to track event types.
            m_eventTypeMappings = new Dictionary<NodeId, NodeId>();

            // the filter to use.
            m_filter = new FilterDefinition();

            m_filter.AreaId = ObjectIds.Server;
            m_filter.Severity = EventSeverity.Min;
            m_filter.IgnoreSuppressedOrShelved = true;
            m_filter.EventTypes = new NodeId[] { ObjectTypeIds.AuditUpdateMethodEventType };

            // find the fields of interest.
            m_filter.SelectClauses = m_filter.ConstructSelectClauses(m_session, ObjectTypeIds.AuditUpdateMethodEventType);

            // declate callback.
            m_MonitoredItem_Notification = new MonitoredItemNotificationEventHandler(MonitoredItem_Notification);

            // create a monitored item based on the current filter settings.
            m_monitoredItem = m_filter.CreateMonitoredItem(m_session);

            // set up callback for notifications.
            m_monitoredItem.Notification += m_MonitoredItem_Notification;

            m_subscription.AddItem(m_monitoredItem);
            m_subscription.ApplyChanges();
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:38,代码来源:AuditEventForm.cs


示例20: Should_call_Nack_on_nested_subscriptions_with_all_delivery_tag

        public void Should_call_Nack_on_nested_subscriptions_with_all_delivery_tag()
        {
            // Arrange
            var channel = Substitute.For<IModel>();
            channel.IsOpen.Returns(true);
            var subs = new CompositeSubscription();
            var subscription = new Subscription
            {
                ConsumerTag = "ConsumerTag",
                QueueName = "QueueName",
                SubscriptionName = "SubscriptionName"
            };
            subscription.SetChannel(channel);
            subs.AddSubscription(subscription);

            // Action
            subs.Nack("ConsumerTag", new[] { (ulong)1, (ulong)2, (ulong)3, (ulong)4, (ulong)5 }, false);

            // Assert
            channel.Received().BasicNack(1, false, false);
            channel.Received().BasicNack(2, false, false);
            channel.Received().BasicNack(3, false, false);
            channel.Received().BasicNack(4, false, false);
            channel.Received().BasicNack(5, false, false);
        }
开发者ID:sovanesyan,项目名称:Burrow.NET,代码行数:25,代码来源:MethodNack.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SubscriptionClient类代码示例发布时间:2022-05-24
下一篇:
C# Subscriber类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap