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


C# Subscriber类代码示例

本文整理汇总了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);
     }
 }
开发者ID:tleviathan,项目名称:redfoxmq,代码行数:7,代码来源:SubscriberTests.cs

示例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);
        }
开发者ID:lukesodre,项目名称:PubSub--WebService,代码行数:7,代码来源:HomeController.cs

示例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);
                });
        }
开发者ID:bicole,项目名称:fundamentals,代码行数:29,代码来源:EventArgsSpecifications.cs

示例4: Create

        public ActionResult Create(Subscriber subscriber)
        {
            //chamada ao webservice
            _webService.AddorUpdateSubscriber(subscriber.Name, subscriber.Email, subscriber.IsActive);

            return RedirectToAction("Index", this);
        }
开发者ID:lukesodre,项目名称:PubSub--WebService,代码行数:7,代码来源:HomeController.cs

示例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);
        }
开发者ID:peterlambov,项目名称:CSharp,代码行数:28,代码来源:MainWindow.xaml.cs

示例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
        }
开发者ID:yusinto,项目名称:ExactTarget-triggered-email-sender,代码行数:60,代码来源:EmailTrigger.cs

示例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);
            }
        }
开发者ID:haithemaraissia,项目名称:SubscriberSearch-net,代码行数:60,代码来源:SubscriberUpdate.ashx.cs

示例8: Main

 static void Main()
 {
     Timer timer = new Timer();
     Subscriber sub = new Subscriber();
     sub.Subscribe(timer);
     timer.RepeatWithDelegate(Subscriber.PrintHeart, 1,5);
 }
开发者ID:bankova,项目名称:CSharp,代码行数:7,代码来源:EventTEST.cs

示例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);
            }
        }
开发者ID:0790486,项目名称:umundo,代码行数:26,代码来源:Program.cs

示例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();
         }
     }
 }
开发者ID:SintefRaufossManufacturing,项目名称:icehms,代码行数:27,代码来源:subscriber.cs

示例11: ConnectToBrokerAsClient

 public void ConnectToBrokerAsClient(Config nbConfig)
 {
     subscriber = new Subscriber(nbConfig);
     subscriber.NotificationHandlers = new BrokerConnectionNotifier.NotificationEventHandler[]{
         OnNotification
                     };
 }
开发者ID:BrianGoff,项目名称:BITS,代码行数:7,代码来源:RtYieldCurve.cs

示例12: Main

 static void Main(string[] args)
 {
     Publisher publish = new Publisher();
     Subscriber sub = new Subscriber(publish);
     CustemerEventArgs arg = new CustemerEventArgs(3000);
     publish.DoSomething(arg);
 }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:7,代码来源:TimerWithEvents.cs

示例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);
        }
开发者ID:mictlanix,项目名称:websites,代码行数:26,代码来源:NewslettersController.cs

示例14: ManageSubscription

 public ManageSubscription(GenThreadManager genThreadManager, SystemServices systemServices, 
     Subscriber.MyTransientSubscriber subscriber, IUpdateDials updateDials)
     : base(genThreadManager, systemServices)
 {
     Subscriber = subscriber;
     UpdateDials = updateDials;
 }
开发者ID:alberthoekstra,项目名称:PVBeanCounter,代码行数:7,代码来源:ManageSubscription.cs

示例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);
            }
        }
开发者ID:MichaelAllenClark,项目名称:exacttarget-soap-csharp,代码行数:34,代码来源:UpdateSubscriber.cs


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