本文整理汇总了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);
}
示例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 ();
}
示例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"));
}
示例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");
}
示例5: Person
public Person(NSCoder decoder)
{
NSString str = (NSString)decoder.DecodeObject("name");
if (str != null)
this.Name = str.ToString();
this.ExpectedRaise = decoder.DecodeFloat("expectedRaise");
}
示例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);
}
示例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;
}
示例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);
}
}
示例9: DecodeRestorableState
public override void DecodeRestorableState (NSCoder coder)
{
base.DecodeRestorableState (coder);
if (coder.ContainsKey (ImageFilterKey))
Filter = (ImageFilter)coder.DecodeObject (ImageFilterKey);
}
示例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)
{
//.........这里部分代码省略.........
示例11: DecodeRestorableState
public override void DecodeRestorableState (NSCoder coder)
{
base.DecodeRestorableState (coder);
filter = coder.DecodeObject ("kImageFilterKey") as ImageFilter;
}
示例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 ();
}
示例13: DidDecodeRestorableState
public override void DidDecodeRestorableState(UIApplication application, NSCoder coder)
{
var controller = (UIViewController)coder.DecodeObject(RootViewControllerKey);
if (controller != null)
_window.RootViewController = controller;
}
示例14: DecodeRestorableState
public override void DecodeRestorableState(NSCoder coder)
{
base.DecodeRestorableState (coder);
detailViewController = (DetailViewController)coder.DecodeObject (DetailViewControllerKey);
}
示例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;
}