本文整理汇总了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();
});
});
}
示例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();