Ejemplo n.º 1
0
        internal NSAttributedString(NSData data, NSAttributedStringDataType type, out NSDictionary resultDocumentAttributes)
        {
            switch (type)
            {
            case NSAttributedStringDataType.DocFormat :
                Handle = new NSAttributedString(data, out resultDocumentAttributes).Handle;
                break;

            case NSAttributedStringDataType.HTML:
                Handle = InitWithHTML(data, out resultDocumentAttributes);
                break;

            case NSAttributedStringDataType.RTF:
                Handle = InitWithRtf(data, out resultDocumentAttributes);
                break;

            case NSAttributedStringDataType.RTFD:
                Handle = InitWithRtfd(data, out resultDocumentAttributes);
                break;

            default:
                throw new ArgumentException("Error creating NSAttributedString.");
            }

            if (Handle == IntPtr.Zero)
            {
                throw new ArgumentException("Error creating NSAttributedString.");
            }
        }
Ejemplo n.º 2
0
        internal NSAttributedString(NSData data, NSAttributedStringDataType type, out NSDictionary resultDocumentAttributes)
        {
            switch (type) {
            case NSAttributedStringDataType.DocFormat:
                Handle = new NSAttributedString (data, out resultDocumentAttributes).Handle;
                break;
            case NSAttributedStringDataType.HTML:
                Handle = InitWithHTML (data, out resultDocumentAttributes);
                break;
            case NSAttributedStringDataType.RTF:
                Handle = InitWithRtf (data, out resultDocumentAttributes);
                break;
            case NSAttributedStringDataType.RTFD:
                Handle = InitWithRtfd (data, out resultDocumentAttributes);
                break;
            default:
                throw new ArgumentException("Error creating NSAttributedString.");
            }

            if (Handle == IntPtr.Zero)
                throw new ArgumentException("Error creating NSAttributedString.");
        }