本文整理汇总了C#中PubNub_Messaging.Pubnub.EndPendingRequests方法的典型用法代码示例。如果您正苦于以下问题:C# Pubnub.EndPendingRequests方法的具体用法?C# Pubnub.EndPendingRequests怎么用?C# Pubnub.EndPendingRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PubNub_Messaging.Pubnub
的用法示例。
在下文中一共展示了Pubnub.EndPendingRequests方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static public void Main()
{
Console.WriteLine("HINT: TO TEST RE-CONNECT AND CATCH-UP,");
Console.WriteLine(" DISCONNECT YOUR MACHINE FROM NETWORK/INTERNET AND ");
Console.WriteLine(" RE-CONNECT YOUR MACHINE AFTER SOMETIME.");
Console.WriteLine();
Console.WriteLine(" IF NO NETWORK BEFORE MAX RE-TRY CONNECT,");
Console.WriteLine(" NETWORK ERROR MESSAGE WILL BE SENT");
Console.WriteLine();
Console.WriteLine("ENTER Channel Name");
channel = Console.ReadLine();
Console.WriteLine(string.Format("Channel = {0}",channel));
Console.WriteLine();
Console.WriteLine("Enable SSL? ENTER Y for Yes, else N");
string enableSSL = Console.ReadLine();
if (enableSSL.Trim().ToLower() == "y")
{
Console.WriteLine("SSL Enabled");
}
else
{
Console.WriteLine("SSL NOT Enabled");
}
Console.WriteLine();
Console.WriteLine("ENTER cipher key for encryption feature.");
Console.WriteLine("If you don't want to avail at this time, press ENTER.");
string cipheryKey = Console.ReadLine();
if (cipheryKey.Trim().Length > 0)
{
Console.WriteLine("Cipher key provided.");
}
else
{
Console.WriteLine("No Cipher key provided");
}
Console.WriteLine();
pubnub = new Pubnub("demo", "demo", "", cipheryKey,
(enableSSL.Trim().ToLower() == "y") ? true : false);
Console.WriteLine("ENTER 1 FOR Subscribe (not implementing connectCallback)");
Console.WriteLine("ENTER 2 FOR Subscribe (implementing connectCallback)");
Console.WriteLine("ENTER 3 FOR Publish");
Console.WriteLine("ENTER 4 FOR Presence");
Console.WriteLine("ENTER 5 FOR Detailed History");
Console.WriteLine("ENTER 6 FOR Here_Now");
Console.WriteLine("ENTER 7 FOR Unsubscribe");
Console.WriteLine("ENTER 8 FOR Presence-Unsubscribe");
Console.WriteLine("ENTER 9 FOR Time");
Console.WriteLine("ENTER 0 FOR EXIT OR QUIT");
bool exitFlag = false;
Console.WriteLine("");
while (!exitFlag)
{
string userinput = Console.ReadLine();
switch (userinput)
{
case "0":
exitFlag = true;
pubnub.EndPendingRequests();
break;
case "1":
Console.WriteLine("Running subscribe() (not implementing connectCallback)");
pubnub.subscribe<string>(channel, DisplayReturnMessage);
break;
case "2":
Console.WriteLine("Running subscribe() (implementing connectCallback)");
pubnub.subscribe<string>(channel, DisplayReturnMessage, DisplayConnectStatusMessage);
break;
case "3":
Console.WriteLine("Running publish()");
Console.WriteLine("Enter the message for publish. To exit loop, enter QUIT");
string publishMsg = Console.ReadLine();
double doubleData;
int intData;
if (int.TryParse(publishMsg, out intData)) //capture numeric data
{
pubnub.publish<string>(channel, intData, DisplayReturnMessage);
}
else if (double.TryParse(publishMsg, out doubleData)) //capture numeric data
{
pubnub.publish<string>(channel, doubleData, DisplayReturnMessage);
}
else
{
//check whether any numeric is sent in double quotes
if (publishMsg.IndexOf("\"") == 0 && publishMsg.LastIndexOf("\"") == publishMsg.Length - 1)
{
string strMsg = publishMsg.Substring(1, publishMsg.Length - 2);
if (int.TryParse(strMsg, out intData))
{
pubnub.publish<string>(channel, strMsg, DisplayReturnMessage);
}
else if (double.TryParse(strMsg, out doubleData))
//.........这里部分代码省略.........
示例2: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
/*if (ApplicationContext.Resources.Configuration.ScreenLayout = Android.Content.Res.ScreenLayout.SizeLarge) {
SetContentView (Resource.Layout.Mainlarge);
} else {*/
//}
//Build.VERSION.Sdk
SetContentView (Resource.Layout.Main);
string strChannelName = Intent.GetStringExtra("Channel");
channel = strChannelName;
bool bEnableSSL = Convert.ToBoolean((Intent.GetStringExtra("SslOn")));
string strCipher = (Intent.GetStringExtra("Cipher"));
string strSsl= "";
if (bEnableSSL)
strSsl = ", SSL";
if (!String.IsNullOrWhiteSpace (strCipher)) {
strCipher = ", Cipher";
}
string strHead = String.Format ("Channel: {0}{1}{2}", strChannelName, strSsl, strCipher);
pubnub = new Pubnub ("demo", "demo", "", strCipher, bEnableSSL);
Title = strHead;
Button btnSubscribe = FindViewById<Button> (Resource.Id.btnSubscribe);
btnSubscribe.Click += delegate {Subscribe();};
Button btnSubscribeConnCallback = FindViewById<Button> (Resource.Id.btnSubscribeConnCallback);
btnSubscribeConnCallback.Click += delegate {SubscribeConnCallback();};
Button btnCancel = FindViewById<Button> (Resource.Id.btnCancel);
btnCancel.Click += delegate {pubnub.EndPendingRequests();Finish();};
Button btnPresence = FindViewById<Button> (Resource.Id.btnPresence);
btnPresence.Click += delegate {Presence();};
Button btnPublish = FindViewById<Button> (Resource.Id.btnPublish);
btnPublish.Click += delegate {Publish();};
Button btnHereNow = FindViewById<Button> (Resource.Id.btnHereNow);
btnHereNow.Click += delegate {HereNow();};
Button btnDetailedHis = FindViewById<Button> (Resource.Id.btnDetailedHis);
btnDetailedHis.Click += delegate {DetailedHistory();};
Button btnTime = FindViewById<Button> (Resource.Id.btnTime);
btnTime.Click += delegate {GetTime();};
Button btnUnsub = FindViewById<Button> (Resource.Id.btnUnsub);
btnUnsub.Click += delegate {Unsub();};
Button btnUnsubPres = FindViewById<Button> (Resource.Id.btnUnsubPres);
btnUnsubPres.Click += delegate {UnsubPresence();};
}
示例3: Pubnub_MessagingSub
public Pubnub_MessagingSub (string strChannelName, string strCipher, bool bEnableSSL) : base (UITableViewStyle.Grouped, null)
{
_Channel = strChannelName;
_Ssl = bEnableSSL;
_Cipher = strCipher;
string strSsl = "";
if (_Ssl) {
strSsl = ", SSL";
}
string strCip = "";
if (!String.IsNullOrWhiteSpace (_Cipher)) {
strCip = ", Cipher";
}
string strHead = String.Format ("Ch: {0} {1} {2}", _Channel, strSsl, strCip);
_pubnub = new Pubnub ("demo", "demo", "", _Cipher, _Ssl);
Section secAction = new Section ();
bool bIphone = true;
string strHardwareVer = DeviceHardware.Version.ToString ().ToLower ();
if (strHardwareVer.IndexOf ("ipad") >= 0) {
bIphone = false;
}
Dictionary<string, RectangleF> dictRect = null;
int iViewHeight = 140;
if (bIphone) {
dictRect = GetRectanglesForIphone();
iViewHeight = 140;
} else {
dictRect = GetRectanglesForIpad();
iViewHeight = 85;
}
secAction.HeaderView = CreateHeaderView(dictRect, iViewHeight);
_secOutput = new Section("Output");
_root = new RootElement (strHead) {
secAction,
_secOutput
};
Root = _root;
_dvc = new DialogViewController (_root, true);
_dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, delegate {
_pubnub.EndPendingRequests ();
AppDelegate.navigation.PopToRootViewController(true);
});
AppDelegate.navigation.PushViewController (_dvc, true);
}