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


C# NSObject.ToString方法代码示例

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


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

示例1: DescriptionForValue

		// Returns the description for a provided value, taking the characteristic's metadata and possible values into account.
		public static string DescriptionForValue(this HMCharacteristic self, NSObject value)
		{
			if (self.IsWriteOnly ())
				return "Write-Only Characteristic";

			var number = value as NSNumber;
			return number != null ? self.DescriptionForValue (number.Int32Value) : value.ToString ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:9,代码来源:HMCharacteristicExtensions.cs

示例2: Awake

        public override void Awake(NSObject context)
        {
            base.Awake (context);
            // Configure interface objects here.
            if (context is NSString) {
                contextFromPreviousScreen = context.ToString ();
            }

            Console.WriteLine ("{0} awake with context", this);
        }
开发者ID:jlattimer,项目名称:CrmWatchKit,代码行数:10,代码来源:Table2InterfaceController.cs

示例3: SetObjectValue

        public override void SetObjectValue (NSTableView tableView, NSObject editedVal, NSTableColumn col, nint row)
        {
            try {
                if (Entries != null && !string.IsNullOrEmpty (editedVal.ToString ())) {
                    if (col.Identifier == "Value") {
                        string currKey = this.Entries.Keys.ElementAt ((int)row);
                        if (currKey != "objectClass") {
                            VMDirBagItem currVal = this.Entries [currKey];
                            this.Entries [currKey] = new VMDirBagItem {
                                Description = currVal.Description,
                                IsReadOnly = currVal.IsReadOnly,
                                IsRequired = currVal.IsRequired,
                                Value = Utilities.StringToLdapValue ((NSString)editedVal)
                            };
                            this.PendingMod.Add (currKey, (NSString)Utilities.LdapValueToString (this.Entries [currKey].Value));
                        }
                    }
                }
            } catch (Exception e) {
                System.Diagnostics.Debug.WriteLine ("Error in List Operation " + e.Message);
            }

        }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:23,代码来源:CreateObjectTableViewDataSource.cs

示例4: InsertText

		public override void InsertText (NSObject insertString)
		{
			if (!((TextBoxBase)Host.Host).Multiline && insertString.ToString () == "\n")
				return ;
			base.InsertText (insertString);
		}
开发者ID:Clancey,项目名称:MonoMac.Windows.Form,代码行数:6,代码来源:TextBoxHelper.cs

示例5: SetValueForKey

 public override void SetValueForKey(NSObject value, NSString key)
 {
     if (key == "bindingText")
         BindingText = value.ToString();
 }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:5,代码来源:MvxTableColumn.cs

示例6: ContinueUserActivity

        public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler)
        {
            switch (userActivity.ActivityType) 
            {
				case "com.micjames.beerdrinkin.mybeers":
                    break;
				case "com.micjames.beerdrinkin.wishlist":
                break;
				case "com.micjames.beerdrinkin.search":
                break;
				case "com.micjames.beerdrinkin.profile":
                break;
				case "com.micjames.beerdrinkin.beerdetails":
                    var info = userActivity.UserInfo;
                if (this.Window.RootViewController.ChildViewControllers[0] is UITabBarController) 
                {
					var tabController = this.Window.RootViewController.ChildViewControllers[0] as UITabBarController;
					tabController.SelectedIndex = 2;

						var beerItem = new BeerItem();

						var id = new NSObject();
						info.TryGetValue(new NSString("id"), out id);

						var name = new NSObject();
						info.TryGetValue(new NSString("name"), out name);

						var description = new NSObject();
						info.TryGetValue(new NSString("description"), out description);

						var imageUrl = new NSObject();
						info.TryGetValue(new NSString("imageUrl"), out imageUrl);

						var breweryDbId = new NSObject();
						info.TryGetValue(new NSString("breweryDbId"), out breweryDbId);

						beerItem.Name = name.ToString();
						beerItem.Description = description.ToString();
						beerItem.ImageMedium = imageUrl.ToString();
						beerItem.BreweryDbId = breweryDbId.ToString();

						if (!string.IsNullOrEmpty(beerItem.BreweryDbId))
						{
							var storyboard = UIStoryboard.FromName("Main", null);
							var vc = storyboard.InstantiateViewController ("beerDescriptionTableView") as BeerDescriptionTableView;
							vc.SetBeer (beerItem);
							var navigationControler = tabController.SelectedViewController as UINavigationController;
							navigationControler.PushViewController (vc, true);
						}
                }
                break;
            }

            return true;
        }
开发者ID:xmendoza,项目名称:BeerDrinkin,代码行数:55,代码来源:AppDelegate.cs

示例7: SetObjectValue

        public override void SetObjectValue (NSTableView tableView, NSObject editedVal, NSTableColumn col, nint row)
        {
            try {
                if (data != null && !string.IsNullOrEmpty (editedVal.ToString ())) {
                    if (col.Identifier == "Value") {
                        string currKey = this.data [(int)row].Key;
                        if (currKey != "objectClass") {
                            this.data [(int)row] = new KeyValuePair<string, string> (currKey, (NSString)editedVal);
                            this.PendingMod.Add (currKey, this.data [(int)row].Value);
                        }
                    }
                }
            } catch (Exception e) {
                System.Diagnostics.Debug.WriteLine ("Error in List Operation " + e.Message);
            }

        }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:17,代码来源:PropertiesTableViewDataSource.cs

示例8: ToObject

		/// <summary>
		/// Converts to an object.
		/// </summary>
		/// <returns>The object.</returns>
		/// <param name="nsO">Ns o.</param>
		/// <param name="targetType">Target type.</param>
		public static Object ToObject (NSObject nsO, Type targetType)
		{
			if (nsO is NSString) {
				return nsO.ToString ();
			}

			if (nsO is NSDate) {
				var nsDate = (NSDate)nsO;
				return DateTime.SpecifyKind ((DateTime)nsDate, DateTimeKind.Unspecified);
			}

			if (nsO is NSDecimalNumber) {
				return decimal.Parse (nsO.ToString (), CultureInfo.InvariantCulture);
			}

			if (nsO is NSNumber) {
				var x = (NSNumber)nsO;

				switch (Type.GetTypeCode (targetType)) {
				case TypeCode.Boolean:
					return x.BoolValue;
				case TypeCode.Char:
					return Convert.ToChar (x.ByteValue);
				case TypeCode.SByte:
					return x.SByteValue;
				case TypeCode.Byte:
					return x.ByteValue;
				case TypeCode.Int16:
					return x.Int16Value;
				case TypeCode.UInt16:
					return x.UInt16Value;
				case TypeCode.Int32:
					return x.Int32Value;
				case TypeCode.UInt32:
					return x.UInt32Value;
				case TypeCode.Int64:
					return x.Int64Value;
				case TypeCode.UInt64:
					return x.UInt64Value;
				case TypeCode.Single:
					return x.FloatValue;
				case TypeCode.Double:
					return x.DoubleValue;
				}
			}

			if (nsO is NSValue) {
				var v = (NSValue)nsO;

				if (targetType == typeof(IntPtr)) {
					return v.PointerValue;
				}

				if (targetType == typeof(CGSize)) {
					return v.SizeFValue;
				}

				if (targetType == typeof(CGRect)) {
					return v.RectangleFValue;
				}

				if (targetType == typeof(CGPoint)) {
					return v.PointFValue;
				}           
			}

			return nsO;
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:74,代码来源:NSObjectConverter.cs

示例9: WriteKeyAndValueToOutput

        //========================================================================
        //========================================================================
        /// <summary>
        /// Writes out the key and value information to the console, useful for debugging,
        /// or understanding how the user preferences are stored.
        /// </summary>
        private static void WriteKeyAndValueToOutput(NSDictionary dict, NSObject key)
        {
            Console.Write (key.ToString () + ":");

            if (dict[key] is NSString)
            {
                Console.WriteLine (dict[key].ToString ());
            }
            else
            {
                switch (dict[key].GetType ().ToString ())
                {
                    case "MonoTouch.Foundation.NSNumber":
                        Console.WriteLine ((dict[key] as NSNumber).FloatValue.ToString ());
                        break;
                    case "MonoTouch.Foundation.NSArray":
                        Console.WriteLine ("");
                        NSArray items = dict[key] as NSArray;

                        for (uint j = 0; j < items.Count; j++)
                        {
                            Console.WriteLine ("\t" + NSString.FromHandle (items.ValueAt (j)).ToString ());
                        }
                        break;
                }

            }
        }
开发者ID:tretelny,项目名称:JudgeAppMono,代码行数:34,代码来源:UserDefaultsHelper.cs


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