本文整理汇总了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); }
}
示例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 ());
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例6: Unsubscribe
private void Unsubscribe(Subscription subscription)
{
lock (_subscriptions)
{
_subscriptions.Remove(subscription);
}
}
示例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();
}
示例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;
}
示例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);
}
示例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;
}
示例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");
}
示例12: addSubscription
private void addSubscription(Subscription s)
{
AddBodyRow(row => {
row.Cell(s.Receiver.ToString());
row.Cell(s.MessageType);
});
}
示例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);
}
}
}
示例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);
}
示例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");
}