本文整理汇总了C#中Subscriber类的典型用法代码示例。如果您正苦于以下问题:C# Subscriber类的具体用法?C# Subscriber怎么用?C# Subscriber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Subscriber类属于命名空间,在下文中一共展示了Subscriber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDisconnected_should_return_true_when_not_connected
public void IsDisconnected_should_return_true_when_not_connected()
{
using (var subscriber = new Subscriber())
{
Assert.IsTrue(subscriber.IsDisconnected);
}
}
示例2: Edit
public ActionResult Edit(Subscriber subscriber)
{
//Edicao feita diretamente atraves do webservice
_webService.AddorUpdateSubscriber(subscriber.Name, subscriber.Email, subscriber.IsActive);
return RedirectToAction("Index", this);
}
示例3: FireGenericEventArgs
public void FireGenericEventArgs(
Publisher publisher,
Subscriber subscriber)
{
const int Value = 42;
"establish a publisher firing an event with generic event args"._(() =>
{
publisher = new Publisher();
});
"establish a subscriber listening to the event of the publisher"._(() =>
{
subscriber = new Subscriber();
subscriber.RegisterEvent(publisher);
});
"when the publisher fires the event"._(() =>
{
publisher.FireEvent(Value);
});
"it should pass value to event handler"._(() =>
{
subscriber.ReceivedValue
.Should().Be(Value);
});
}
示例4: Create
public ActionResult Create(Subscriber subscriber)
{
//chamada ao webservice
_webService.AddorUpdateSubscriber(subscriber.Name, subscriber.Email, subscriber.IsActive);
return RedirectToAction("Index", this);
}
示例5: OnAddSubcriber_Click
private void OnAddSubcriber_Click(object sender, RoutedEventArgs e)
{
string currentMSISDN = this.SubscriberMSISDN.Text;
string currentName = this.SubscriberName.Text;
string currentEGN = this.SubscriberEGN.Text;
string currentTariffPlan = defaultTariffPlan;
double account = 0;
Subscriber currentSubscriber = new Subscriber(currentMSISDN, currentName, currentEGN);
//work with Hashset
Subscriber.AddSubscriber(currentSubscriber);
if (this.SubscriberTariffPlan.SelectedItem != null)
{
currentTariffPlan = this.SubscriberTariffPlan.SelectedItem.ToString();
currentSubscriber.ChangeTariffPlan(currentTariffPlan);
}
if (this.SubscriberAccount.Text != null)
{
account = double.Parse(this.SubscriberAccount.Text.ToString());
currentSubscriber.UpdateAccount(account);
}
billingSystemDB.InsertSubscriber(currentSubscriber);
SubscriberAllTextBoxInit(sender, e);
}
示例6: Trigger
public void Trigger(ExactTargetTriggeredEmail exactTargetTriggeredEmail, RequestQueueing requestQueueing = RequestQueueing.No, Priority priority = Priority.Normal)
{
var clientId = _config.ClientId;
var client = SoapClientFactory.Manufacture(_config);
var subscriber = new Subscriber
{
EmailAddress = exactTargetTriggeredEmail.EmailAddress,
SubscriberKey = exactTargetTriggeredEmail.SubscriberKey ?? exactTargetTriggeredEmail.EmailAddress,
Attributes =
exactTargetTriggeredEmail.ReplacementValues.Select(value => new Attribute
{
Name = value.Key,
Value = value.Value
}).ToArray()
};
// Add sender information if specified. This will send the email with FromAddress in the sender field.
// Official doco here under the section "Determining the From Information at Send Time":
// https://help.exacttarget.com/en/technical_library/web_service_guide/triggered_email_scenario_guide_for_developers/#Determining_the_From_Information_at_Send_Time
if (!string.IsNullOrEmpty(exactTargetTriggeredEmail.FromAddress) && !string.IsNullOrEmpty(exactTargetTriggeredEmail.FromName))
{
subscriber.Owner = new Owner()
{
FromAddress = exactTargetTriggeredEmail.FromAddress,
FromName = exactTargetTriggeredEmail.FromName
};
}
var subscribers = new List<Subscriber> { subscriber };
var tsd = new TriggeredSendDefinition
{
Client = clientId.HasValue ? new ClientID { ID = clientId.Value, IDSpecified = true } : null,
CustomerKey = exactTargetTriggeredEmail.ExternalKey
};
var ts = new TriggeredSend
{
Client = clientId.HasValue ? new ClientID { ID = clientId.Value, IDSpecified = true } : null,
TriggeredSendDefinition = tsd,
Subscribers = subscribers.ToArray()
};
var co = new CreateOptions
{
RequestType = requestQueueing == RequestQueueing.No ? RequestType.Synchronous : RequestType.Asynchronous,
RequestTypeSpecified = true,
QueuePriority = priority == Priority.High ? ExactTargetApi.Priority.High : ExactTargetApi.Priority.Medium,
QueuePrioritySpecified = true
};
string requestId, status;
var result = client.Create(
co,
new APIObject[] { ts },
out requestId, out status);
ExactTargetResultChecker.CheckResult(result.FirstOrDefault()); //we expect only one result because we've sent only one APIObject
}
示例7: ProcessRequest
public void ProcessRequest(HttpContext context)
{
try
{
// Local Variables.
string uRequestID = String.Empty;
string uStatus = String.Empty;
String SOAPEndPoint = context.Session["SOAPEndPoint"].ToString();
String internalOauthToken = context.Session["internalOauthToken"].ToString();
String id = context.Request.QueryString["id"].ToString().Trim();
String status = context.Request.QueryString["status"].ToString().Trim();
// Create the SOAP binding for call.
BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "UserNameSoapBinding";
binding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
binding.MaxReceivedMessageSize = 2147483647;
var client = new SoapClient(binding, new EndpointAddress(new Uri(SOAPEndPoint)));
client.ClientCredentials.UserName.UserName = "*";
client.ClientCredentials.UserName.Password = "*";
using (var scope = new OperationContextScope(client.InnerChannel))
{
// Add oAuth token to SOAP header.
XNamespace ns = "http://exacttarget.com";
var oauthElement = new XElement(ns + "oAuthToken", internalOauthToken);
var xmlHeader = MessageHeader.CreateHeader("oAuth", "http://exacttarget.com", oauthElement);
OperationContext.Current.OutgoingMessageHeaders.Add(xmlHeader);
// Setup Subscriber Object to pass fields for updating.
Subscriber sub = new Subscriber();
sub.ID = int.Parse(id);
sub.IDSpecified = true;
if (status.ToLower() == "unsubscribed")
sub.Status = SubscriberStatus.Unsubscribed;
else
sub.Status = SubscriberStatus.Active;
sub.StatusSpecified = true;
// Call the Update method on the Subscriber object.
UpdateResult[] uResults = client.Update(new UpdateOptions(), new APIObject[] { sub }, out uRequestID, out uStatus);
if (uResults != null && uStatus.ToLower().Equals("ok"))
{
String strResults = string.Empty;
strResults += uResults;
// Return the update results from handler.
context.Response.Write(strResults);
}
else
{
context.Response.Write("Not OK!");
}
}
}
catch (Exception ex)
{
context.Response.Write(ex);
}
}
示例8: Main
static void Main()
{
Timer timer = new Timer();
Subscriber sub = new Subscriber();
sub.Subscribe(timer);
timer.RepeatWithDelegate(Subscriber.PrintHeart, 1,5);
}
示例9: Main
static void Main(string[] args)
{
/*
* Make sure this path contains the umundoNativeCSharp.dll!
*/
SetDllDirectory("C:\\Users\\sradomski\\Desktop\\build\\umundo\\lib");
org.umundo.core.Node node = new org.umundo.core.Node();
Publisher pub = new Publisher("pingpong");
PingReceiver recv = new PingReceiver();
Subscriber sub = new Subscriber("pingpong", recv);
node.addPublisher(pub);
node.addSubscriber(sub);
while (true)
{
Message msg = new Message();
String data = "data";
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
byte[] buffer = enc.GetBytes(data);
msg.setData(buffer);
msg.putMeta("foo", "bar");
Console.Write("o");
pub.send(msg);
System.Threading.Thread.Sleep(1000);
}
}
示例10: Main
static void Main()
{
Console.WriteLine ("Starting");
IceApp app = null;
Subscriber sub = null;
try
{
app = new IceApp("MyTestAdapter", "localhost", 12000);
sub = new Subscriber(app, "MyTestHolon");
Thread.Sleep(100000);
}
catch (Exception ex)
{
Console.WriteLine("Catching" + ex);
}
finally
{
if (sub != null )
{
sub.shutdown();
}
if ( app != null )
{
app.shutdown();
}
}
}
示例11: ConnectToBrokerAsClient
public void ConnectToBrokerAsClient(Config nbConfig)
{
subscriber = new Subscriber(nbConfig);
subscriber.NotificationHandlers = new BrokerConnectionNotifier.NotificationEventHandler[]{
OnNotification
};
}
示例12: Main
static void Main(string[] args)
{
Publisher publish = new Publisher();
Subscriber sub = new Subscriber(publish);
CustemerEventArgs arg = new CustemerEventArgs(3000);
publish.DoSomething(arg);
}
示例13: Index
public ActionResult Index(Subscriber input)
{
if (!IsValidEmailAddress (input.Email)) {
ModelState.AddModelError ("Email", "No es una dirección de email válida.");
}
if (ModelState.IsValid) {
Subscriber item = Subscriber.TryFind (input.Email);
if (item == null) {
using (var session = new SessionScope()) {
input.IsActive = true;
input.CreateAndFlush ();
}
} else {
using (var session = new SessionScope()) {
item.IsActive = true;
item.UpdateAndFlush ();
}
}
return PartialView ("_Success");
}
return PartialView ("_Form", input);
}
示例14: ManageSubscription
public ManageSubscription(GenThreadManager genThreadManager, SystemServices systemServices,
Subscriber.MyTransientSubscriber subscriber, IUpdateDials updateDials)
: base(genThreadManager, systemServices)
{
Subscriber = subscriber;
UpdateDials = updateDials;
}
示例15: UpdateSubscriber
public static void UpdateSubscriber(SoapClient soapClient,
string iEmailAddress,
int iListID)
{
Subscriber sub = new Subscriber();
sub.EmailAddress = iEmailAddress;
// Define the SubscriberList and set the status to Active
SubscriberList subList = new SubscriberList();
subList.ID = iListID;
subList.IDSpecified = true;
subList.Status = SubscriberStatus.Active;
// If no Action is specified at the SubscriberList level, the default action is to
// update the subscriber if they already exist and create them if they do not.
// subList.Action = "create";
//Relate the SubscriberList defined to the Subscriber
sub.Lists = new SubscriberList[] { subList };
string sStatus = "";
string sRequestId = "";
UpdateResult[] uResults =
soapClient.Update(new UpdateOptions(), new APIObject[] { sub }, out sRequestId, out sStatus);
Console.WriteLine("Status: " + sStatus);
Console.WriteLine("Request ID: " + sRequestId);
foreach (UpdateResult ur in uResults)
{
Console.WriteLine("StatusCode: " + ur.StatusCode);
Console.WriteLine("StatusMessage: " + ur.StatusMessage);
Console.WriteLine("ErrorCode: " + ur.ErrorCode);
}
}