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


C# NSCoder.DecodeObject方法代码示例

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


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

示例1: ListItem

		public ListItem(NSCoder coder)
		{
			Text = (string)(NSString)coder.DecodeObject (ListItemEncodingTextKey);
			NSUuid uid = (NSUuid)coder.DecodeObject (ListItemEncodingUUIDKey);
			UID = new Guid (uid.GetBytes());
			IsComplete = coder.DecodeBool (ListItemEncodingCompletedKey);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:ListItem.cs

示例2: ImageInfo

		public ImageInfo(NSCoder decoder)
		{
			// Decode data
			var name = decoder.DecodeObject("name") as NSString;
			var type = decoder.DecodeObject("imageType") as NSString;

			// Save data
			Name = name.ToString();
			ImageType = type.ToString ();
		}
开发者ID:RangoLee,项目名称:mac-samples,代码行数:10,代码来源:ImageInfo.cs

示例3: BNRMapPoint

 public BNRMapPoint(NSCoder decoder)
 {
     NSString str = (NSString)decoder.DecodeObject(@"Title");
     if (str != null)
         _title = str.ToString();
     str = (NSString)decoder.DecodeObject(@"Subtitle");
     if (str != null)
         _subtitle = str.ToString();
     Coordinate = new CLLocationCoordinate2D(decoder.DecodeDouble(@"Latitude"), decoder.DecodeDouble(@"Longitude"));
 }
开发者ID:yingfangdu,项目名称:BNR,代码行数:10,代码来源:BNRMapPoint.cs

示例4: Car

        public Car(NSCoder decoder)
        {
            NSString str = (NSString)decoder.DecodeObject("makeModel");
            if (str != null)
                this.MakeModel = str.ToString();

            DatePurchased = (NSDate)decoder.DecodeObject("datePurchased");

            this.Condition = decoder.DecodeInt("condition");

            this.OnSpecial = decoder.DecodeBool("onSpecial");

            this.Price = decoder.DecodeFloat("price");

            this.Photo = (NSImage)decoder.DecodeObject("photo");
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:16,代码来源:Car.cs

示例5: Person

 public Person(NSCoder decoder)
 {
     NSString str = (NSString)decoder.DecodeObject("name");
     if (str != null)
         this.Name = str.ToString();
     this.ExpectedRaise = decoder.DecodeFloat("expectedRaise");
 }
开发者ID:yingfangdu,项目名称:BNR,代码行数:7,代码来源:Person.cs

示例6: List

		public List(NSCoder coder)
			: this()
		{
			NSArray array = (NSArray)coder.DecodeObject (ListEncodingItemsKey);
			for (nuint i = 0; i < array.Count; i++)
				items.Add (array.GetItem<ListItem> (i));

			Color = (ListColor)coder.DecodeInt (ListEncodingColorKey);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:9,代码来源:List.cs

示例7: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;

            if (base.InitWithCoder(aDecoder) == null)
                return null;

            if (aDecoder.AllowsKeyedCoding)
            {
                int i;

                _selected_segment = -1;
                _segmentCellFlags._tracking_mode = (uint)NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne;
                if (aDecoder.ContainsValueForKey(@"NSSegmentImages"))
                    _items = (NSMutableArray)aDecoder.DecodeObjectForKey(@"NSSegmentImages");
                else
                    _items = (NSMutableArray)NSMutableArray.Alloc().InitWithCapacity(2);

                for (i = 0; i < _items.Count; i++)
                {
                    if (IsSelectedForSegment(i))
                        _selected_segment = i;
                }

                if (aDecoder.ContainsValueForKey(@"NSSelectedSegment"))
                {
                    _selected_segment = aDecoder.DecodeIntForKey(@"NSSelectedSegment");
                    if (_selected_segment != -1)
                        SelectedSegment = _selected_segment;
                }

                _segmentCellFlags._style = (uint)aDecoder.DecodeIntForKey(@"NSSegmentStyle");
            }
            else
            {
                int style = 0;

                _segmentCellFlags._tracking_mode = (uint)NSSegmentSwitchTracking.NSSegmentSwitchTrackingSelectOne;
                _items = (NSMutableArray)aDecoder.DecodeObject();
                aDecoder.DecodeValueOfObjCType<int>(ref _selected_segment);
                if (_selected_segment != -1)
                    SelectedSegment = _selected_segment;

                aDecoder.DecodeValueOfObjCType<int>(ref style);
                _segmentCellFlags._style = (uint)style;
            }

            return self;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:49,代码来源:NSSegmentedCell.cs

示例8: DecodeState

        /// <summary>
        ///     Occurs on load element state.
        /// </summary>
        public void DecodeState(NSObject item, NSCoder state, IDataContext context = null)
        {
            Should.NotBeNull(item, "item");
            Should.NotBeNull(state, "state");
            RestoreNavigationParameter(item, state);
            if (!state.ContainsKey(VmTypeKey))
                return;
            var vmTypeName = (NSString)state.DecodeObject(VmTypeKey);
            if (vmTypeName == null)
                return;

            object dataContext = item.GetDataContext();
            var vmType = Type.GetType(vmTypeName, false);
            if (vmType != null && (dataContext == null || !dataContext.GetType().Equals(vmType)))
            {
                if (context == null)
                    context = DataContext.Empty;
                RestoreViewModel(vmType, RestoreViewModelState(item, state, context), item, state, context);
            }
        }
开发者ID:windygu,项目名称:MugenMvvmToolkit,代码行数:23,代码来源:ApplicationStateManager.cs

示例9: DecodeRestorableState

		public override void DecodeRestorableState (NSCoder coder)
		{
			base.DecodeRestorableState (coder);
			if (coder.ContainsKey (ImageFilterKey))
				Filter = (ImageFilter)coder.DecodeObject (ImageFilterKey);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:6,代码来源:FilterViewController.cs

示例10: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;

            if (aDecoder.AllowsKeyedCoding)
            {
                int colorSpace = aDecoder.DecodeIntForKey(@"NSColorSpace");

                if ((colorSpace == 1) || (colorSpace == 2))
                {
                    int length = 0;
                    byte[] data = null;
                    double red = 0.0;
                    double green = 0.0;
                    double blue = 0.0;
                    double alpha = 1.0;
                    NSString str = null;
                    NSScanner scanner = null;

                    if (aDecoder.ContainsValueForKey(@"NSRGB"))
                    {
                        data = aDecoder.DecodeBytesForKey(@"NSRGB", ref length);
                        str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
                        scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
                        scanner.ScanDouble(ref red);
                        scanner.ScanDouble(ref green);
                        scanner.ScanDouble(ref blue);
                        scanner.ScanDouble(ref alpha);
                    }
                    if (colorSpace == 1)
                    {
                        self = NSColor.ColorWithCalibratedRed((double)red, (double)green, (double)blue, (double)alpha);
                    }
                    else
                    {
                        self = NSColor.ColorWithDeviceRed((double)red, (double)green, (double)blue, (double)alpha);
                    }
                }
                else if ((colorSpace == 3) || (colorSpace == 4))
                {
                    int length = 0;
                    byte[] data = null;
                    double white = 0.0;
                    double alpha = 0.0;
                    NSString str = null;
                    NSScanner scanner = null;

                    if (aDecoder.ContainsValueForKey(@"NSWhite"))
                    {
                        data = aDecoder.DecodeBytesForKey(@"NSWhite", ref length);
                        str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
                        scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
                        scanner.ScanDouble(ref white);
                        scanner.ScanDouble(ref alpha);
                    }
                    if (colorSpace == 3)
                    {
                        self = NSColor.ColorWithCalibratedWhite((double)white, (double)alpha);
                    }
                    else
                    {
                        self = NSColor.ColorWithDeviceWhite((double)white, (double)alpha);
                    }
                }
                else if (colorSpace == 5)
                {
                    int length = 0;
                    byte[] data = null;
                    double cyan = 0.0;
                    double yellow = 0.0;
                    double magenta = 0.0;
                    double black = 0.0;
                    double alpha = 1.0;
                    NSString str = null;
                    NSScanner scanner = null;

                    if (aDecoder.ContainsValueForKey(@"NSCYMK"))
                    {
                        data = aDecoder.DecodeBytesForKey(@"NSCYMK", ref length);
                        str = (NSString)NSString.Alloc().InitWithBytes(data, (uint)data.Length, NSStringEncoding.NSASCIIStringEncoding);
                        scanner = (NSScanner)NSScanner.Alloc().InitWithString(str);
                        scanner.ScanDouble(ref cyan);
                        scanner.ScanDouble(ref yellow);
                        scanner.ScanDouble(ref magenta);
                        scanner.ScanDouble(ref black);
                        scanner.ScanDouble(ref alpha);
                    }

                    self = NSColor.ColorWithDeviceCyan((double)cyan, (double)magenta, (double)yellow, (double)black, (double)alpha);
                }
                else if (colorSpace == 6)
                {
                    NSString catalog = (NSString)aDecoder.DecodeObjectForKey(@"NSCatalogName");
                    NSString name = (NSString)aDecoder.DecodeObjectForKey(@"NSColorName");
                    //NSColor color = (NSColor)aDecoder.DecodeObjectForKey(@"NSColor");

                    self = NSColor.ColorWithCatalogName(catalog, name);
                }
                else if (colorSpace == 10)
                {
//.........这里部分代码省略.........
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:101,代码来源:NSColor.cs

示例11: DecodeRestorableState

		public override void DecodeRestorableState (NSCoder coder)
		{
			base.DecodeRestorableState (coder);
			filter = coder.DecodeObject ("kImageFilterKey") as ImageFilter;
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:5,代码来源:FilterViewController.cs

示例12: DecodeRestorableState

		public override void DecodeRestorableState (NSCoder coder)
		{
			base.DecodeRestorableState (coder);

			// TODO: https://trello.com/c/TydBAJP0
			ImageIdentifier = (NSString)coder.DecodeObject (kImageIdentifierKey);
			DataSource = (DataSource)coder.DecodeObject (kDataSourceKey);

			NSObject nDict;
			if (coder.TryDecodeObject (kImageFiltersKey, out nDict))
				filters = ((NSDictionary)nDict).Convert<ImageFilter> ();

			// TODO: https://trello.com/c/TydBAJP0
			currentlyPresentedFilterTitle = (NSString)coder.DecodeObject (kFilterButtonKey);

			NSObject avc;
			if (coder.TryDecodeObject (kActivityViewControllerKey, out avc))
				activityViewController = (UIActivityViewController)avc;

			SetupActivityCompletion ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:21,代码来源:DetailViewController.cs

示例13: DidDecodeRestorableState

 public override void DidDecodeRestorableState(UIApplication application, NSCoder coder)
 {
     var controller = (UIViewController)coder.DecodeObject(RootViewControllerKey);
     if (controller != null)
         _window.RootViewController = controller;
 }
开发者ID:Fezzer,项目名称:MugenMvvmToolkit.Samples,代码行数:6,代码来源:AppDelegate.cs

示例14: DecodeRestorableState

 public override void DecodeRestorableState(NSCoder coder)
 {
     base.DecodeRestorableState (coder);
     detailViewController = (DetailViewController)coder.DecodeObject (DetailViewControllerKey);
 }
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:5,代码来源:CollectionViewController.cs

示例15: InitWithCoder

        public override id InitWithCoder(NSCoder aDecoder)
        {
            id self = this;

            if (aDecoder.AllowsKeyedCoding)
            {
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemLabel"))
                    Label = (NSString)aDecoder.DecodeObjectForKey(@"NSSegmentItemLabel");
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemImage"))
                    Image = (NSImage)aDecoder.DecodeObjectForKey(@"NSSegmentItemImage");
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemMenu"))
                    Menu = (NSMenu)aDecoder.DecodeObjectForKey(@"NSSegmentItemMenu");
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemEnabled"))
                    _enabled = aDecoder.DecodeBoolForKey(@"NSSegmentItemEnabled");
                else if (aDecoder.ContainsValueForKey(@"NSSegmentItemDisabled"))
                    _enabled = !aDecoder.DecodeBoolForKey(@"NSSegmentItemDisabled");
                else
                    _enabled = true;
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemSelected"))
                    _selected = aDecoder.DecodeBoolForKey(@"NSSegmentItemSelected");
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemWidth"))
                    _width = aDecoder.DecodeFloatForKey(@"NSSegmentItemWidth");
                if (aDecoder.ContainsValueForKey(@"NSSegmentItemTag"))
                    _tag = aDecoder.DecodeIntForKey(@"NSSegmentItemTag");
            }
            else
            {
                _label = (NSString)aDecoder.DecodeObject();
                _image = (NSImage)aDecoder.DecodeObject();
                _menu = (NSMenu)aDecoder.DecodeObject();
                aDecoder.DecodeValueOfObjCType<bool>(ref _enabled);
                aDecoder.DecodeValueOfObjCType<bool>(ref _selected);
                aDecoder.DecodeValueOfObjCType<float>(ref _width);
                aDecoder.DecodeValueOfObjCType<int>(ref _tag);
            }

            return self;
        }
开发者ID:smartmobili,项目名称:CocoaBuilder,代码行数:38,代码来源:NSSegmentItem.cs


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