コード例 #1
0
 public static IWallAttachmentModel Create(Attachment attachment)
 {
     if (PhotoModel.IsPhoto(attachment))
     {
         return(new PhotoModel(attachment));
     }
     else
     {
         if (DocumentModel.IsDocument(attachment))
         {
             var document = new DocumentModel(attachment);
             if (document.Uri == null)
             {
                 return(null);
             }
             else
             {
                 return(document);
             }
         }
         else
         {
             if (LinkModel.IsLink(attachment))
             {
                 return(new LinkModel(attachment));
             }
             else
             {
                 throw new WrongAttachmentTypeException("no type matched");
                 return(null);
             }
         }
     }
     return(null);
 }
コード例 #2
0
 public static bool IsModel(Attachment attachment)
 {
     return(PhotoModel.IsPhoto(attachment) || DocumentModel.IsDocument(attachment) || LinkModel.IsLink(attachment));
 }