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

C# NSObject类代码示例

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

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



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

示例1: earnButtonClicked

partial         void earnButtonClicked(NSObject sender)
        {
            decimal amt = 0;
            try
            {
                amt = Convert.ToDecimal(this.amount.Text);
            }
            catch
            {
                amt = 0;
            }

            var subscription = Observable.Start(
                () =>
                 {
                    var cmd = this.context.NewCommandExecutor<MinionAggregate>();
                    cmd.Execute(new EarnAllowanceCommand
                    {
                        AggregateId = this.minionId,
                        Date = this.dateField.Date,
                        Amount = amt,
                        Description = this.description.Text
                    });
                }).Subscribe();

            this.DismissModalViewControllerAnimated(true);
        }
开发者ID:sgmunn,项目名称:MyMinions,代码行数:27,代码来源:EarnViewController.cs


示例2: GetPosition

		partial void GetPosition (NSObject sender)
		{
			Setup();
			
			this.cancelSource = new CancellationTokenSource();
			
			PositionStatus.Text = String.Empty;
			PositionLatitude.Text = String.Empty;
			PositionLongitude.Text = String.Empty;
			
			this.geolocator.GetPositionAsync (timeout: 10000, cancelToken: this.cancelSource.Token, includeHeading: true)
				.ContinueWith (t =>
				{
					if (t.IsFaulted)
						PositionStatus.Text = ((GeolocationException)t.Exception.InnerException).Error.ToString();
					else if (t.IsCanceled)
						PositionStatus.Text = "Canceled";
					else
					{
						PositionStatus.Text = t.Result.Timestamp.ToString("G");
						PositionLatitude.Text = "La: " + t.Result.Latitude.ToString("N4");
						PositionLongitude.Text = "Lo: " + t.Result.Longitude.ToString("N4");
					}
					
				}, scheduler);
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:26,代码来源:SampleViewController.cs


示例3: SessionCell

		const int buttonSpace = 45; //24;
		
		public SessionCell (UITableViewCellStyle style, NSString ident, Session showSession, string big, string small) : base (style, ident)
		{
			SelectionStyle = UITableViewCellSelectionStyle.Blue;
			
			titleLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			speakerLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = smallFont,
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			locationImageView = new UIImageView();
			locationImageView.Image = building;

			button = UIButton.FromType (UIButtonType.Custom);
			button.TouchDown += delegate {
				UpdateImage (ToggleFavorite ());
				if (AppDelegate.IsPad) {
					NSObject o = new NSObject();
					NSDictionary progInfo = NSDictionary.FromObjectAndKey(o, new NSString("FavUpdate"));

					NSNotificationCenter.DefaultCenter.PostNotificationName(
						"NotificationFavoriteUpdated", o, progInfo);
				}
			};
			UpdateCell (showSession, big, small);
			
			ContentView.Add (titleLabel);
			ContentView.Add (speakerLabel);
			ContentView.Add (button);
			ContentView.Add (locationImageView);
		}
开发者ID:topcbl,项目名称:mobile-samples,代码行数:37,代码来源:SessionCell.cs


示例4: btnShare_Activated

 async partial void btnShare_Activated (UIBarButtonItem sender)
 {
     var text = viewModel.SharingMessage;
     var items = new NSObject[] { new NSString (text) };
     var activityController = new UIActivityViewController (items, null);
     await PresentViewControllerAsync (activityController, true);
 }
开发者ID:MikeCodesDotNet,项目名称:Beer-Drinkin,代码行数:7,代码来源:BeerDescriptionTableView.cs


示例5: DidUpdateBeaconRanges

 public override void DidUpdateBeaconRanges(NSObject[] rangedBeacons)
 {
     if (BeaconsUpdated != null)
     {
         var list = new List<BeaconStatus> ();
         foreach (var b in rangedBeacons) {
             var bStatus = new BeaconStatus ();
             var ndict = b as NSDictionary;
             foreach (var p in ndict) {
                 if (p.Key.ToString() == "beacon_id")
                     bStatus.Id = p.Value.ToString();
                 if (p.Key.ToString() == "beacon_tags")
                     bStatus.Tags = p.Value.ToString();
                 if (p.Key.ToString() == "proximity_value")
                     bStatus.ProximityValue = p.Value.ToString();
                 if (p.Key.ToString() == "beacon_name")
                     bStatus.Name = p.Value.ToString();
                 if (p.Key.ToString() == "proximity_string")
                     bStatus.ProximityString = p.Value.ToString();
             }
             list.Add (bStatus);
         }
         InvokeOnMainThread(() => BeaconsUpdated (this, list));
     }
 }
开发者ID:KaganRoman,项目名称:TreasureHunter,代码行数:25,代码来源:BeaconRangeDelegate.cs


示例6: PrepareForSegue

		public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
		{
			base.PrepareForSegue (segue, sender);

			if (segue.Identifier == "showDetail")
				PrepareForSegue ((DetailViewController)segue.DestinationViewController);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:CollectionViewController.cs


示例7: btnGrayscaleClicked

partial         void btnGrayscaleClicked(NSObject sender)
        {
            UIImage imageOriginal = UIImage.FromFile( @"Images/sample.png" );
            UIImage imageSource = UIImage.FromImage( imageOriginal.CGImage );

            Stopwatch watch = new Stopwatch();

            watch.Start();

            UIImage imageProcessed = ConvertToGrayScale( imageSource );

            watch.Stop();

            long tick = watch.ElapsedTicks;

            long milliSeconds = watch.ElapsedMilliseconds;

            watch.Reset();

            imageViewDiplay.Image = imageProcessed;

            string message = string.Format(@"tick:{0};duration:{1}", tick, milliSeconds);

            lbTime.Text = message;
        }
开发者ID:FangHuaiAn,项目名称:Grayscale-Xamarin,代码行数:25,代码来源:ViewController.cs


示例8: OnPress

		async partial void OnPress (NSObject sender)
		{
			HandlerType = null;
			TheButton.Enabled = false;
			switch (TheTable.SelectedRow) {
			case 0:
				new DotNet (this).HttpSample ();
				break;
			case 1:
				new DotNet (this).HttpSecureSample ();
				break;
			case 2:
				new Cocoa (this).HttpSample ();
				break;
			case 3:
				await new NetHttp (this).HttpSample (false);
				break;
			case 4:
				await new NetHttp (this).HttpSample (true);
				break;
			case 5:
				RunTls12Request ();
				break;
			}
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:25,代码来源:ViewController.cs


示例9: ShowSimpleForm

		partial void ShowSimpleForm (NSObject sender)
		{
			var alertController = UIAlertController.Create (title, message, UIAlertControllerStyle.Alert);

			alertController.AddTextField (textField => {
				textField.Placeholder = "Name";
				textField.InputAccessoryView = new CustomInputAccessoryView ("Enter your name");
			});
				
			alertController.AddTextField (textField => {
				textField.KeyboardType = UIKeyboardType.EmailAddress;
				textField.Placeholder = "[email protected]";
				textField.InputAccessoryView = new CustomInputAccessoryView ("Enter your email address");
			});

			var acceptAction = UIAlertAction.Create (acceptButtonTitle, UIAlertActionStyle.Default, _ => {
				Console.WriteLine ("The \"Text Entry\" alert's other action occured.");
				string enteredText = alertController.TextFields?.First ()?.Text;

				if (string.IsNullOrEmpty (enteredText))
					Console.WriteLine ("The text entered into the \"Text Entry\" alert's text field was \"{0}\"", enteredText);
			});

			var cancelAction = UIAlertAction.Create (cancelButtonTitle, UIAlertActionStyle.Cancel, _ =>
				Console.WriteLine ("The \"Text Entry\" alert's cancel action occured.")
			);

			// Add the actions.
			alertController.AddAction (acceptAction);
			alertController.AddAction (cancelAction);

			PresentViewController (alertController, true, null);
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:33,代码来源:AlertFormViewController.cs


示例10: ShowSecureEntry

		partial void ShowSecureEntry (NSObject sender)
		{
			var alertController = UIAlertController.Create (title, message, UIAlertControllerStyle.Alert);
			alertController.AddTextField (textField => {
				textField.Placeholder = "Password";
				textField.SecureTextEntry = true;
				textField.InputAccessoryView = new CustomInputAccessoryView ("Enter at least 5 characters");
				textField.EditingChanged += HandleTextFieldTextDidChangeNotification;
			});

			var acceptAction = UIAlertAction.Create (acceptButtonTitle, UIAlertActionStyle.Default, _ =>
				Console.WriteLine ("The \"Secure Text Entry\" alert's other action occured.")
			);

			var cancelAction = UIAlertAction.Create (cancelButtonTitle, UIAlertActionStyle.Cancel, _ =>
				Console.WriteLine ("The \"Text Entry\" alert's cancel action occured.")
			);

			acceptAction.Enabled = false;
			secureTextAlertAction = acceptAction;

			// Add the actions.
			alertController.AddAction (acceptAction);
			alertController.AddAction (cancelAction);

			PresentViewController (alertController, true, null);
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:27,代码来源:AlertFormViewController.cs


示例11: PrepareForSegue

		public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
		{
			base.PrepareForSegue (segue, sender);

			var nxtVC =	segue.DestinationViewController as SecondViewController;
			nxtVC.Data = "Hello from Root View";
		}
开发者ID:ctsxamarintraining,项目名称:Xamarin,代码行数:7,代码来源:RootViewController.cs


示例12: Done

		partial void Done (NSObject sender)
		{
			var model = _priceTileModel;
			if (model != null) {
				model.Done();
			}
		}
开发者ID:tomgilder,项目名称:ReactiveTrader,代码行数:7,代码来源:PriceTileTradeAffirmationViewCell.cs


示例13: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
                    _urlTextField.ShouldReturn = doReturn;
                    _browser.Delegate = new customWebViewDelegate(this);

                    var webDocumentView = new NSObject(
                        Messaging.IntPtr_objc_msgSend(_browser.Handle, (new Selector("_documentView").Handle)));
                    var webView = webDocumentView.GetNativeField("_webView");
                    Messaging.void_objc_msgSend_IntPtr(webView.Handle, (new Selector("setCustomUserAgent:")).Handle,
                        (new NSString(@"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.38 Safari/532.0")).Handle);
                     /*
                      *
                      * /* http://d.hatena.ne.jp/KishikawaKatsumi/20090217/1234818025
                      NSString *userAgent =
                            @"Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_1 like Mac OS X; ja-jp) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5F136 Safari/525.20";

                        id webDocumentView;
                        id webView;
                        webDocumentView = objc_msgSend(myWebView, @selector(_documentView));
                        object_getInstanceVariable(webDocumentView, "_webView", (void**)&webView);
                        objc_msgSend(webView, @selector(setCustomUserAgent:), userAgent); */

                    loadURL(_startURL);
        }
开发者ID:reinforce-lab,项目名称:CSharpSamples,代码行数:25,代码来源:UAFakeBrowerController.xib.cs


示例14: PrepareForSegue

		public override void PrepareForSegue (UIStoryboardSegue segue, NSObject sender)
		{
			if (!(segue.DestinationViewController is AssetGridViewController) || !(sender is UITableViewCell))
				return;

			var assetGridViewController = (AssetGridViewController)segue.DestinationViewController;
			var cell = (UITableViewCell)sender;

			// Set the title of the AssetGridViewController.
			assetGridViewController.Title = cell.TextLabel.Text;

			// Get the PHFetchResult for the selected section.
			NSIndexPath indexPath = TableView.IndexPathForCell (cell);
			PHFetchResult fetchResult = sectionFetchResults [indexPath.Section];

			if (segue.Identifier == allPhotosSegue) {
				assetGridViewController.AssetsFetchResults = fetchResult;
			} else if (segue.Identifier == collectionSegue) {
				// Get the PHAssetCollection for the selected row.
				var collection = fetchResult [indexPath.Row] as PHAssetCollection;
				if (collection == null)
					return;
				var assetsFetchResult = PHAsset.FetchAssets (collection, null);

				assetGridViewController.AssetsFetchResults = assetsFetchResult;
				assetGridViewController.AssetCollection = collection;
			}
		}
开发者ID:BytesGuy,项目名称:monotouch-samples,代码行数:28,代码来源:RootListViewController.cs


示例15: GetViewForAnnotation

			UIButton detailButton; // need class-level ref to avoid GC

			/// <summary>
			/// This is very much like the GetCell method on the table delegate
			/// </summary>
			public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation)
			{
				// try and dequeue the annotation view
				MKAnnotationView annotationView = mapView.DequeueReusableAnnotation(annotationIdentifier);
				
				// if we couldn't dequeue one, create a new one
				if (annotationView == null)
					annotationView = new MKPinAnnotationView(annotation, annotationIdentifier);
				else // if we did dequeue one for reuse, assign the annotation to it
					annotationView.Annotation = annotation;
		     
				// configure our annotation view properties
				annotationView.CanShowCallout = true;
				(annotationView as MKPinAnnotationView).AnimatesDrop = true;
				(annotationView as MKPinAnnotationView).PinColor = MKPinAnnotationColor.Green;
				annotationView.Selected = true;
				
				// you can add an accessory view, in this case, we'll add a button on the right, and an image on the left
				detailButton = UIButton.FromType(UIButtonType.DetailDisclosure);
				detailButton.TouchUpInside += (s, e) => { 
					var c = (annotation as MKAnnotation).Coordinate;
					new UIAlertView("Annotation Clicked", "You clicked on " +
					c.Latitude.ToString() + ", " +
					c.Longitude.ToString() , null, "OK", null).Show(); 
				};
				annotationView.RightCalloutAccessoryView = detailButton;
				annotationView.LeftCalloutAccessoryView = new UIImageView(UIImage.FromBundle("Images/Icon/29_icon.png"));
				//annotationView.Image = UIImage.FromBundle("Images/Apress-29x29.png");
				
				return annotationView;
			}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:36,代码来源:AnnotatedMapScreen.xib.cs


示例16: ToDictionary

 public static NSDictionary ToDictionary(this DropboxRace race)
 {
     var keys = new NSString[] {
         new NSString("Code"),
         new NSString("FullName"),
         new NSString("RaceDate"),
         new NSString("BoatsUpdated"),
         new NSString("DetailsUpdated"),
         new NSString("DatastoreID"),
         new NSString("IntermediateLocations"),
     };
     NSDate d1 = DateTime.SpecifyKind(race.Date, DateTimeKind.Utc);
     NSDate d2 = DateTime.SpecifyKind(race.BoatsUpdated, DateTimeKind.Utc);
     NSDate d3 = DateTime.SpecifyKind(race.DetailsUpdated, DateTimeKind.Utc);
     var values = new NSObject[] {
         new NSString(race.Code),
         new NSString(race.Name),
         d1, d2, d3,
         new NSString(race.DataStoreID),
         new NSString(race
             .Locations
             .Select(l => l.Name)
             .Aggregate((h,t) => string.Format("{0},{1}", h,t)))
     };
     return NSDictionary.FromObjectsAndKeys (values, keys);
 }
开发者ID:unsliced,项目名称:head-race-management,代码行数:26,代码来源:DropboxHelper.cs


示例17: InitializeFramework

        public static void InitializeFramework(NSObject[] kits, CrashlyticsManager crashlyticsManager, bool enableDebugging = true)
        {
            if (kits == null)
                throw new ArgumentNullException("kits");
            
            SharedSDK().Debug = enableDebugging;

            if (crashlyticsManager != null)
            {
                SharedSDK().CrashlyticsManager = crashlyticsManager;

                //only initialize Crashlytics with device builds since Xamarin.iOS 
                //doesn't generate dSYM files for simulator builds
                if (Runtime.Arch == Arch.DEVICE)
                {
                    Log(GetKitInitializationMessage(kits));
                    crashlyticsManager.EnableCrashReporting(() => Fabric.WithInternal(kits));
                }
                else
                {
                    Log("[MonoTouch.Fabric] Running on simulator: Crashlytics will not be enabled and crash reports will not be submitted", true);
                    var otherKits = RemoveKit(kits, crashlyticsManager.SharedInstance);
                    if (otherKits.Length > 0)
                    {
                        Log(GetKitInitializationMessage(otherKits));
                        Fabric.WithInternal(otherKits);
                    }
                }
            }
            else
            {
                Log(GetKitInitializationMessage(kits));
                Fabric.WithInternal(kits);
            }
        }
开发者ID:joeisapro,项目名称:MonoTouch.Fabric,代码行数:35,代码来源:Fabric.cs


示例18: CalloutView

		public CalloutView (string text, PointF pt, NSObject target, Selector sel) : base(_initframe)
		{
			SetAnchorPoint (pt);
			Initialize ();
			Text = text;
			AddButtonTarget (target, sel);
		}
开发者ID:21Off,项目名称:21Off,代码行数:7,代码来源:CalloutView.cs


示例19: PrepareForSegue

        public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
        {
            base.PrepareForSegue(segue, sender);

            var view = (AttachmentController) segue.DestinationViewController;
            view.SelectedMessage = CurrentMessage;
        }
开发者ID:elsewhat,项目名称:AltinnApp,代码行数:7,代码来源:CorrespondenceViewController.cs


示例20: ShareUrl

        public void ShareUrl(object sender, Uri uri)
        {
            var item = new NSUrl(uri.AbsoluteUri);
            var activityItems = new NSObject[] { item };
            UIActivity[] applicationActivities = null;
            var activityController = new UIActivityViewController (activityItems, applicationActivities);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) 
            {
                var window = UIApplication.SharedApplication.KeyWindow;
                var pop = new UIPopoverController (activityController);

                var barButtonItem = sender as UIBarButtonItem;
                if (barButtonItem != null)
                {
                    pop.PresentFromBarButtonItem(barButtonItem, UIPopoverArrowDirection.Any, true);
                }
                else
                {
                    var rect = new CGRect(window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0);
                    pop.PresentFromRect (rect, window.RootViewController.View, UIPopoverArrowDirection.Any, true);
                }
            } 
            else 
            {
                var viewController = UIApplication.SharedApplication.KeyWindow.RootViewController;
                viewController.PresentViewController(activityController, true, null);
            }
        }
开发者ID:zdd910,项目名称:CodeHub,代码行数:29,代码来源:ActionMenuFactory.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# NSObjectFlag类代码示例发布时间:2022-05-24
下一篇:
C# NSNotification类代码示例发布时间: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