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


C# Pubnub.GetChannelsForDevicePush方法代码示例

本文整理汇总了C#中Pubnub.GetChannelsForDevicePush方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.GetChannelsForDevicePush方法的具体用法?C# Pubnub.GetChannelsForDevicePush怎么用?C# Pubnub.GetChannelsForDevicePush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pubnub的用法示例。


在下文中一共展示了Pubnub.GetChannelsForDevicePush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ThenGetAllChannelsForDeviceShouldReturnSuccess

        public void ThenGetAllChannelsForDeviceShouldReturnSuccess()
        {
            string channel = "hello_my_channel";
            string pushToken = "http://sn1.notify.live.net/throttledthirdparty/01.00/AQG2MdvoLlZFT7-VJ2TJ5LnbAgAAAAADAQAAAAQUZm52OkRFNzg2NTMxMzlFMEZFNkMFBlVTU0MwMQ";
            receivedSuccessMessage = false;
            currentUnitTestCase = "ThenGetAllChannelsForDeviceShouldReturnSuccess";

            ThreadPool.QueueUserWorkItem((s) =>
            {
                Pubnub pubnub = new Pubnub(PubnubCommon.PublishKey, PubnubCommon.SubscribeKey, PubnubCommon.SecretKey, "", false);

                PubnubUnitTest unitTest = new PubnubUnitTest();
                unitTest.TestClassName = "WhenPushIsRequested";
                unitTest.TestCaseName = "ThenGetAllChannelsForDeviceShouldReturnSuccess";
                pubnub.PubnubUnitTest = unitTest;

                if (!PubnubCommon.EnableStubTest)
                {
                    mrePush = new ManualResetEvent(false);
                    pubnub.RegisterDeviceForPush<string>(channel, PushTypeService.MPNS, pushToken, DeviceRegisterCallback, DummyErrorCallback);
                    mrePush.WaitOne(60 * 1000);
                }
                else
                {
                    receivedSuccessMessage = true;
                }
                if (receivedSuccessMessage)
                {
                    mrePush = new ManualResetEvent(false);
                    pubnub.GetChannelsForDevicePush<string>(PushTypeService.MPNS, pushToken, GetChannelsFromDeviceCallback, DummyErrorCallback);
                    mrePush.WaitOne(60 * 1000);

                    Assert.IsTrue(receivedSuccessMessage, "WhenPushIsRequested -> ThenGetAllChannelsForDeviceShouldReturnSuccess failed.");
                }
                else
                {
                    Assert.IsTrue(receivedSuccessMessage, "WhenPushIsRequested -> RegisterDeviceForPush failed in ThenGetAllChannelsForDeviceShouldReturnSuccess.");
                }

                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    TestComplete();
                });
            });
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:45,代码来源:WhenPushIsRequested.cs

示例2: Main


//.........这里部分代码省略.........
					Console.WriteLine("Enter Push Token for MPNS");
					string unRegisterPushToken = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Push Token = {0}", unRegisterPushToken));
					Console.ResetColor();

					Console.WriteLine("Running UnregisterDeviceForPush()");
					pubnub.UnregisterDeviceForPush<string>(PushTypeService.MPNS, unRegisterPushToken, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "32":
					Console.WriteLine("Enter channel name");
					string pushRemoveChannel = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Channel = {0}", pushRemoveChannel));
					Console.ResetColor();

					Console.WriteLine("Enter Push Token for MPNS");
					string pushTokenRemove = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Push Token = {0}", pushTokenRemove));
					Console.ResetColor();

					Console.WriteLine("Running RegisterDeviceForPush()");
					pubnub.RemoveChannelForDevicePush<string>(pushRemoveChannel, PushTypeService.MPNS, pushTokenRemove, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "33":
					Console.WriteLine("Enter Push Token for MPNS");
					string pushTokenGetChannel = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Push Token = {0}", pushTokenGetChannel));
					Console.ResetColor();

					Console.WriteLine("Running RegisterDeviceForPush()");
					pubnub.GetChannelsForDevicePush<string>(PushTypeService.MPNS, pushTokenGetChannel, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "34": 
					//Toast message publish
					Console.WriteLine("Enter channel name");
					string toastChannel = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Channel = {0}", toastChannel));
					Console.ResetColor();

					Console.WriteLine("Enter title for Toast");
					string text1 = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Text1 = {0}", text1));
					Console.ResetColor();

					MpnsToastNotification toast = new MpnsToastNotification();
					toast.text1 = text1;
					Dictionary<string, object> dicToast = new Dictionary<string, object>();
					dicToast.Add("pn_mpns", toast);
					pubnub.EnableDebugForPushPublish = true;

					Console.WriteLine("Running Publish for Toast");
					pubnub.Publish<string>(toastChannel, dicToast, DisplayReturnMessage, DisplayErrorMessage);
					break;
				case "35":
					//Flip Tile message publish
					Console.WriteLine("Enter channel name");
					string flipTileChannel = Console.ReadLine();
					Console.ForegroundColor = ConsoleColor.Blue;
					Console.WriteLine(string.Format("Channel = {0}", flipTileChannel));
					Console.ResetColor();
开发者ID:redarrowlabs,项目名称:pubnub-c-sharp,代码行数:66,代码来源:PubnubExample.cs


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