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


C# NSData.ToString方法代码示例

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

示例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;
		}
开发者ID:JudoPay,项目名称:Judo-Xamarin,代码行数:12,代码来源:JudoPKPaymentAuthorizationViewControllerDelegate.cs

示例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);
		}
开发者ID:StrangerMosr,项目名称:PushSharp,代码行数:15,代码来源:AppDelegate.cs

示例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);


		}
开发者ID:kktanpiya,项目名称:kimuraHazuki048,代码行数:23,代码来源:AppDelegate.cs

示例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 ();
		}
开发者ID:King-of-Spades,项目名称:InvokeUia-for-System-Dialogs,代码行数:11,代码来源:AppDelegate.cs

示例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 ()");
			}
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:14,代码来源:MyDocument.cs

示例7: DidReceiveData

 public override void DidReceiveData(MCSession session, NSData data, MCPeerID peerID)
 {
     InvokeOnMainThread (() => {
         var alert = new UIAlertView ("", data.ToString (), null, "OK");
         alert.Show ();
     });
 }
开发者ID:ironstine,项目名称:FindTheMonkey,代码行数:7,代码来源:FindTheMonkeyViewController.cs

示例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");
        }
开发者ID:lsp1357,项目名称:appverse-mobile,代码行数:40,代码来源:UIApplicationWeakDelegate.cs

示例9: RegisteredForRemoteNotifications

		public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
		{
			Hub = new SBNotificationHub(ConnectionString, NotificationHubPath);
			App.StoredNotificationToken.DeviceToken = deviceToken.ToString();
		}
开发者ID:todibbang,项目名称:HowlOutApp,代码行数:5,代码来源:AppDelegate.cs

示例10: ReceivedData

 public override void ReceivedData(NSUrlConnection connection, NSData data)
 {
     if(data != null) {
         _ResponseBuilder.Append(data.ToString());
     }
 }
开发者ID:CodeSensei,项目名称:mobile-samples,代码行数:6,代码来源:RxTermRestClient.cs

示例11: ReceivedData

 public override void ReceivedData (NSUrlConnection connection, NSData data)
 {
     string xml = data.ToString ();
     
     _sb.Append (xml);
 }
开发者ID:enricos,项目名称:learning_monotouch_code,代码行数:6,代码来源:BingServiceGateway.cs

示例12: MobileAppTrackerDidSucceed

 public override void MobileAppTrackerDidSucceed(MobileAppTracker tracker, NSData data)
 {
     Console.WriteLine ("MAT DidSucceed: " + data.ToString ());
 }
开发者ID:netalex,项目名称:sdk-plugins,代码行数:4,代码来源:MATTestViewController.cs

示例13: ReadFromData

		public override bool ReadFromData (NSData data, string typeName, out NSError outError)
		{
			outError = null;
			Code = data.ToString ();
			return true;
		}
开发者ID:michaelstonis,项目名称:NGraphics,代码行数:6,代码来源:Document.cs

示例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(" ", "")
         });
 }
开发者ID:sammyroller,项目名称:Cheesebaron.MvxPlugins,代码行数:7,代码来源:NotificationsAppDelegate.cs


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