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


C# Subscription类代码示例

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


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


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