本文整理汇总了C#中NSData.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# NSData.ToString方法的具体用法?C# NSData.ToString怎么用?C# NSData.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NSData
的用法示例。
在下文中一共展示了NSData.ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisteredForRemoteNotifications
public async override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
this.deviceToken = deviceToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
var push = CommonAppSettings.MobileService.GetPush();
var employeeId = CommonAppSettings.FixedEmployeeId;
try
{
var jsonTemplate = "{\"aps\":{\"message\":\"$(message)\"}}";
var expiry = DateTime.Now.AddDays(90).ToString(CultureInfo.CreateSpecificCulture("en-US"));
await push.RegisterTemplateAsync(this.deviceToken, jsonTemplate, expiry, "MyShuttleTemplate",
new string[]
{
string.Format("VehicleApproved-{0}", employeeId),
string.Format("VehicleRejected-{0}", employeeId),
string.Format("VehicleArrived-{0}", employeeId)
});
}
catch (Exception e)
{
var userInteractionService = Mvx.Resolve<IUserInteraction>();
if (userInteractionService != null)
{
userInteractionService.Alert(e.Message, title: "Error registering notifications");
}
}
}
示例2: ConvertToJObject
JObject ConvertToJObject(NSData data)
{
var jObject = new JObject();
var json = data.ToString(NSStringEncoding.UTF8);
if (!string.IsNullOrWhiteSpace(json))
{
jObject = JObject.Parse(json.ToString());
}
return jObject;
}
示例3: RegisteredForRemoteNotifications
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");
var newDeviceToken = deviceToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(newDeviceToken))
{
//TODO: Put your own logic here to notify your server that the device token has changed/been created!
}
//Save device token now
NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "PushDeviceToken");
Console.WriteLine("Device Token: " + newDeviceToken);
}
示例4: RegisteredForRemoteNotifications
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
Console.WriteLine ("[AppDelegate] Registered APNS: {0}",deviceToken.ToString());
// code to register with your server application goes here
NSUuid regVendor = UIDevice.CurrentDevice.IdentifierForVendor;
Console.WriteLine ("[AppDelegate] Registered Vendor: {0}",regVendor);
VendorID = regVendor.AsString();
APNSID = deviceToken.ToString ().Replace ("<", "").Replace (">", "").Replace (" ", "");
Console.WriteLine ("[AppDelegate] Registered APNS Replaced: {0}",APNSID);
Console.WriteLine ("[AppDelegate] Registered Vendor Replaced: {0}",VendorID);
WebServices wbs = new WebServices ();
//var registerAPNS = wbs.setAPNSRegistration (VendorID, APNSID);
//Console.WriteLine ("[AppDelegate] APNS Registration Status: {0}",registerAPNS);
}
示例5: RegisteredForRemoteNotifications
/// <summary>
/// The iOS will call the APNS in the background and issue a device token to the device. when that's
/// accomplished, this method will be called.
///
/// Note: the device token can change, so this needs to register with your server application everytime
/// this method is invoked, or at a minimum, cache the last token and check for a change.
/// </summary>
public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
{
deviceToken = deviceToken.ToString ();
}
示例6: ReloadDocument
void ReloadDocument ()
{
documentData = documentUrl == null ? new NSData () : NSData.FromUrl (documentUrl);
var document = WebView.MainFrame.DomDocument;
var container = document.GetElementById ("markdown-container");
if (container != null) {
using (var sundown = new Sundown.Renderer ()) {
((DomHtmlElement)container).InnerHTML = sundown.Render (documentData.ToString ());
}
document.EvaluateWebScript ("markdownUpdated ()");
}
}
示例7: DidReceiveData
public override void DidReceiveData(MCSession session, NSData data, MCPeerID peerID)
{
InvokeOnMainThread (() => {
var alert = new UIAlertView ("", data.ToString (), null, "OK");
alert.Show ();
});
}
示例8: RegisteredForRemoteNotifications
public void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
// The deviceToken is what the push notification server needs to send out a notification
// to the device. Most times application needs to send the device Token to its servers when it has changed
#if DEBUG
log ("Success registering for Remote Notifications");
#endif
// ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******
// First, get the last device token we know of
// string lastDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("deviceToken");
//There's probably a better way to do this
//NSString strFormat = new NSString("%@");
//NSString newToken = new NSString(ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr(new ObjCRuntime.Class("NSString").Handle, new ObjCRuntime.Selector("stringWithFormat:").Handle, strFormat.Handle, deviceToken.Handle));
NSString newToken = new NSString (deviceToken.ToString ());
var newDeviceToken = newToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "");
#if DEBUG
log ("Device token: " + newDeviceToken);
#endif
// We only want to send the device token to the server if it hasn't changed since last time
// no need to incur extra bandwidth by sending the device token every time
// if (!newDeviceToken.Equals(lastDeviceToken))
//{
// Send the new device token to your application server
// ****** REMOVED "lastDeviceToken storage" feature. Marga 06/08/2013 . Platform will always call the JS listener; same behavior in all platforms ******
RegistrationToken registrationToken = new RegistrationToken();
registrationToken.StringRepresentation = newDeviceToken;
byte[] buffer = new byte[deviceToken.Length];
Marshal.Copy(deviceToken.Bytes, buffer,0,buffer.Length);
registrationToken.Binary = buffer;
PushNotificationsUtils.FireUnityJavascriptEvent("Appverse.PushNotifications.OnRegisterForRemoteNotificationsSuccess", registrationToken);
//Save the new device token for next application launch
// NSUserDefaults.StandardUserDefaults.SetString(newDeviceToken, "deviceToken");
}
示例9: RegisteredForRemoteNotifications
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
Hub = new SBNotificationHub(ConnectionString, NotificationHubPath);
App.StoredNotificationToken.DeviceToken = deviceToken.ToString();
}
示例10: ReceivedData
public override void ReceivedData(NSUrlConnection connection, NSData data)
{
if(data != null) {
_ResponseBuilder.Append(data.ToString());
}
}
示例11: ReceivedData
public override void ReceivedData (NSUrlConnection connection, NSData data)
{
string xml = data.ToString ();
_sb.Append (xml);
}
示例12: MobileAppTrackerDidSucceed
public override void MobileAppTrackerDidSucceed(MobileAppTracker tracker, NSData data)
{
Console.WriteLine ("MAT DidSucceed: " + data.ToString ());
}
示例13: ReadFromData
public override bool ReadFromData (NSData data, string typeName, out NSError outError)
{
outError = null;
Code = data.ToString ();
return true;
}
示例14: RegisteredForRemoteNotifications
public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
{
Mvx.Resolve<IMvxMessenger>()
.Publish(new NotificationRegisterMessage(this) { Registered = true,
RegistrationId = deviceToken.ToString().Replace("<", "").Replace(">", "").Replace(" ", "")
});
}