Example #1
0
        public void CreateUIView(Attachment attachment)
        {
            var rectPoint = new ImageRectPoint();

            rectPoint.LeftX  = attachment.X;
            rectPoint.TopY   = attachment.Y;
            rectPoint.Width  = attachment.Width;
            rectPoint.Height = attachment.Height;

            string identifier = DateTime.Now.Ticks.ToString();

            if (attachment.Type == AttachmentTypeEnum.Note)
            {
            }
            else
            {
                string filePath = System.IO.Path.Combine(DocumentPath, attachment.Path);

                Java.IO.File DrawLinePNGFileIO = new Java.IO.File(filePath);
                if (DrawLinePNGFileIO.Exists())
                {
                    Bitmap savePNG   = BitmapFactory.DecodeFile(filePath);
                    var    imageView = new ImageView(this);
                    imageView.SetImageBitmap(savePNG);
                    imageView.SetBackgroundColor(Color.Transparent);
                    imageView.SetX((float)rectPoint.LeftX);
                    imageView.SetY((float)rectPoint.TopY);
                    imageView.SetMaxWidth((int)rectPoint.Width);
                    imageView.SetMaxHeight((int)rectPoint.Height);

                    pdfRelativeLayout.AddView(imageView);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 新增新的附件元素
        /// </summary>
        /// <returns>The new attachment.</returns>
        /// <param name="type">Type.</param>
        public Attachment GetNewAttachment(AttachmentTypeEnum type)
        {
            string identifier = DateTime.Now.Ticks.ToString();
            var    rectPoint  = new ImageRectPoint();
            string systemPath = string.Empty;

            if (type == AttachmentTypeEnum.Note)
            {
            }
            else
            {
                systemPath = string.Empty;
                Bitmap saveBitmap = type == AttachmentTypeEnum.Paint ? drawRectLineBitmap : CameraApp.bitmap;
                systemPath       = getSaveImageLocalSystemPath(identifier, type, saveBitmap);
                rectPoint.LeftX  = type == AttachmentTypeEnum.Paint ? drawLineView.GetRectLeftX() : cameraImageView.GetX() + 600;
                rectPoint.TopY   = type == AttachmentTypeEnum.Paint ? drawLineView.GetRectTopY() : drawLineView.GetY() + 250;
                rectPoint.Width  = type == AttachmentTypeEnum.Paint ? drawLineView.Width : 150;
                rectPoint.Height = type == AttachmentTypeEnum.Paint ? drawLineView.Height : 75;
                string filePath = System.IO.Path.Combine(DocumentPath, systemPath);
            }

            Attachment newAttachment = new Attachment();

            newAttachment.Name      = identifier;
            newAttachment.PageIndex = PageNumber;
            newAttachment.Note      = string.Empty;
            newAttachment.Type      = type;
            newAttachment.Path      = systemPath;
            newAttachment.Width     = (int)rectPoint.Width;
            newAttachment.Height    = (int)rectPoint.Height;
            newAttachment.X         = (float)rectPoint.LeftX;
            newAttachment.Y         = (float)rectPoint.TopY;

            return(newAttachment);
        }