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


C# NSData类代码示例

本文整理汇总了C#中NSData的典型用法代码示例。如果您正苦于以下问题:C# NSData类的具体用法?C# NSData怎么用?C# NSData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: RegisteredForRemoteNotifications

 public override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
 {
     Task.Run (async () => {
         var service = ServiceContainer.Resolve<APNSManager> ();
         await service.RegisteredForRemoteNotificationsAsync (application, deviceToken);
     });
 }
开发者ID:eatskolnikov,项目名称:mobile,代码行数:7,代码来源:AppDelegate.cs

示例2: SecCertificate

        public SecCertificate(NSData data)
        {
            if (data == null)
                throw new ArgumentNullException ("data");

            Initialize (data);
        }
开发者ID:jorik041,项目名称:maccore,代码行数:7,代码来源:Certificate.cs

示例3: 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

示例4: RegisteredForRemoteNotifications

		public async override void RegisteredForRemoteNotifications (UIApplication application, NSData deviceToken)
		{
			ParseInstallation installation = ParseInstallation.CurrentInstallation;
			installation.SetDeviceTokenFromData (deviceToken);
			await ParsePush.SubscribeAsync ("");
			await installation.SaveAsync ();
		}
开发者ID:arctouch-douglaskazumi,项目名称:ArcTouchPark,代码行数:7,代码来源:AppDelegate.cs

示例5: OnRegisteredSuccess

        public void OnRegisteredSuccess(NSData token)
        {
            Debug.WriteLine("{0} - Succesfully Registered.", PushNotificationKey.DomainName);

            string trimmedDeviceToken =token.Description;
            if (!string.IsNullOrWhiteSpace(trimmedDeviceToken))
            {
                trimmedDeviceToken = trimmedDeviceToken.Trim('<');
                trimmedDeviceToken = trimmedDeviceToken.Trim('>');
                trimmedDeviceToken = trimmedDeviceToken.Trim();
                trimmedDeviceToken = trimmedDeviceToken.Replace(" ","");
            }
            Console.WriteLine("{0} - Token: {1}", PushNotificationKey.DomainName, trimmedDeviceToken);

            if (CrossPushNotification.IsInitialized)
            {
                CrossPushNotification.PushNotificationListener.OnRegistered(trimmedDeviceToken, DeviceType.iOS);
            }
            else
            {
                throw NewPushNotificationNotInitializedException();
            }

            NSUserDefaults.StandardUserDefaults.SetString(trimmedDeviceToken, PushNotificationKey.Token);
            NSUserDefaults.StandardUserDefaults.Synchronize ();
        }
开发者ID:howbazaar,项目名称:xamarin-plugins,代码行数:26,代码来源:PushNotificationImplementation.cs

示例6: ReceivedData

			public override void ReceivedData (NSUrlConnection connection, NSData data)
			{
				if (_view.imageData==null)
					_view.imageData = new NSMutableData();

				_view.imageData.AppendData(data);	
			}
开发者ID:21Off,项目名称:21Off,代码行数:7,代码来源:UIWebImageView.cs

示例7: FromData

 public static NSString FromData(NSData data, NSStringEncoding encoding)
 {
     // Allocate a string, do not init
     IntPtr h = Messaging.IntPtr_objc_msgSend (Class.GetHandle ("NSString"), Selector.Alloc);
     h = Messaging.IntPtr_objc_msgSend_IntPtr_int (h, selInitWithDataEncoding, data.Handle, (int)encoding);
     return new NSString (h);
 }
开发者ID:kangaroo,项目名称:maccore,代码行数:7,代码来源:NSString2.cs

示例8: GetCell

        public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {

            ImageTableCell cell = tableView.DequeueReusableCell(cellIdentifier) as ImageTableCell;
            try
            {
                if (cell == null)
                    cell = new ImageTableCell(cellIdentifier, navigate.View.Bounds.Width);
                NSData data = new NSData();
                if (!String.IsNullOrEmpty(_urls[indexPath.Row]))
                {
                    NSUrl nsUrl = new NSUrl(_urls[indexPath.Row]);
                    data = NSData.FromUrl(nsUrl);
                }
                cell.UpdateCell(new UIImage(data));
                
                OnGotCell();
                CellOn = indexPath.Row;
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }
            return cell;

        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:26,代码来源:ImagesTableView.cs

示例9: GetCell

        public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
        {

            SkatersTableCell cell = tableView.DequeueReusableCell(cellIdentifier) as SkatersTableCell;
            try
            {
                if (cell == null)
                    cell = new SkatersTableCell(cellIdentifier);
                NSData data = new NSData();
                if (!String.IsNullOrEmpty(tableItems[indexPath.Row].ThumbUrl))
                {
                    NSUrl nsUrl = new NSUrl(tableItems[indexPath.Row].ThumbUrl);
                    data = NSData.FromUrl(nsUrl);
                }
                cell.UpdateCell(tableItems[indexPath.Row].DerbyName, tableItems[indexPath.Row].DerbyNumber, new UIImage(data));
                OnGotCell();
                CellOn = indexPath.Row;
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
            }
            return cell;

        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:25,代码来源:SkatersTableView.cs

示例10: ReceivedData

		// Collect all the data
		public override void ReceivedData (NSUrlConnection connection, NSData data)
		{
			byte [] nb = new byte [result.Length + data.Length];
			result.CopyTo (nb, 0);
			Marshal.Copy (data.Bytes, nb, result.Length, (int) data.Length);
			result = nb;
		}
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:8,代码来源:Cocoa.cs

示例11: Clicked

        public override void Clicked(UIActionSheet actionview, int buttonIndex)
        {
            if (buttonIndex == 0)
            {
                Console.Write("Satya!!!!!!");

                /*UIActivityIndicatorView spinner = new UIActivityIndicatorView(new RectangleF(0,0,200,300));
                spinner.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;
                spinner.Center= new PointF(160, 140);
                spinner.HidesWhenStopped = true;
                actionview.AddSubview(spinner);
                InvokeOnMainThread(delegate() {
                    spinner.StartAnimating();
                });

                */

                var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);

                fileName = documents + "/" + fileName;

                data = NSData.FromUrl(_nsurl);
                File.WriteAllBytes(fileName,data.ToArray());

                if (File.Exists(fileName))
                {
                    UIAlertView alert = new UIAlertView();
                    alert.Title = "Download Complete";
                    alert.AddButton("Done");
                    alert.Show();
                }
                    //spinner.StopAnimating();

            }
        }
开发者ID:satendra4u,项目名称:LittelfuseCatalogs,代码行数:35,代码来源:MyActionSheetViewDelegate.cs

示例12: RegisteredForRemoteNotifications

 public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
 {
     if (CrossPushNotification.Current is IPushNotificationHandler)
     {
         ((IPushNotificationHandler)CrossPushNotification.Current).OnRegisteredSuccess(deviceToken);
     }
 }
开发者ID:joaodealmeida,项目名称:EuromillionsDraws,代码行数:7,代码来源:AppDelegate.cs

示例13: RegisteredForRemoteNotifications

 public override void RegisteredForRemoteNotifications(
   UIApplication application, NSData deviceToken)
 {
     DonkyiOS.RegisteredForRemoteNotifications(
     application,
     deviceToken);
 }
开发者ID:Donky-Network,项目名称:DonkySDK-Xamarin-Modular,代码行数:7,代码来源:AppDelegate.cs

示例14: RegisteredForRemoteNotifications

        /// <summary>
        /// We succeeded in registering for notifications
        /// </summary>
        /// <param name="application"></param>
        /// <param name="deviceToken"></param>
        public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            // Get current device token
            var deviceTokenDesc = deviceToken.Description;
            if (!string.IsNullOrWhiteSpace(deviceTokenDesc))
            {
                deviceTokenDesc = deviceTokenDesc.Trim('<').Trim('>').Replace(" ", "");
            }

            UserDialogs.Instance.Alert(deviceTokenDesc);

            // Has the token changed?
            if (!string.IsNullOrEmpty(deviceTokenDesc))
            {
                //Register the user on your server
                DeviceToken apiToken = new DeviceToken
                {
                    Token = deviceTokenDesc,
                    Device = Device.OS.ToString()
                };
                ApiService apiService = new ApiService();
                apiService.PostAsync<DeviceToken>("Devices/Post", apiToken);

            }
        }
开发者ID:datadruid,项目名称:XamarinPushNotifications,代码行数:30,代码来源:AppDelegate.cs

示例15: OnStatusUpdate

 private void OnStatusUpdate(NSData data)
 {
     UserStatuses status;
     if (Enum.TryParse(GetStringFromNSData(data), out status))
     {
         User.Status = status;
     }
 }
开发者ID:sbondini,项目名称:BleChat,代码行数:8,代码来源:PeripheralHandler.cs


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