• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NSData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: CopyData

		public NSData CopyData ()
		{
			var provider = CGDataProviderCopyData (handle);
			var data = new NSData (provider);

			CGDataProviderRelease (provider);
			return data;
		}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:8,代码来源:CGDataProvider-2.cs


示例17: RegisteredForRemoteNotifications

 public override void RegisteredForRemoteNotifications(UIApplication application, NSData token)
 {
     var deviceToken = token.Description.Replace("<", "").Replace(">", "").Replace(" ", "");
     if (!string.IsNullOrEmpty(deviceToken))
     {
         SNSUtils.RegisterDevice(SNSUtils.Platform.IOS, deviceToken);
     }
 }
开发者ID:jamisliao,项目名称:aws-sdk-net-samples,代码行数:8,代码来源:AppDelegate.cs


示例18: CopyMatching

 public static SecurityResult CopyMatching(NSDictionary query, ref NSData result)
 {
     IntPtr handle = IntPtr.Zero;
     SecurityResult osStatus = (SecurityResult)SecItemCopyMatching(query.Handle, ref handle);
     if (osStatus == SecurityResult.Success)
         result = new NSData(handle);
     return osStatus;
 }
开发者ID:tilos,项目名称:KeyChainDemo,代码行数:8,代码来源:SecurityItem.cs


示例19: ParseDeviceToken

        internal static string ParseDeviceToken(NSData deviceToken)
        {
            if (deviceToken == null)
            {
                throw new ArgumentNullException("deviceToken");
            }

            return TrimDeviceToken(deviceToken.Description);
        }
开发者ID:RecursosOnline,项目名称:azure-mobile-services,代码行数:9,代码来源:ApnsRegistration.cs


示例20: SecCertificate

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

            handle = SecCertificateCreateWithData (IntPtr.Zero, data.Handle);
            if (handle == IntPtr.Zero)
                throw new ArgumentException ("Not a valid DER-encoded X.509 certificate");
        }
开发者ID:kangaroo,项目名称:maccore,代码行数:9,代码来源:Certificate.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NSDictionary类代码示例发布时间:2022-05-24
下一篇:
C# NSCoder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap