Ejemplo n.º 1
0
 /// <summary>
 /// Apply to the VisualElement specified the Image properties of the current View.
 /// Derived class can call this method to apply the settings to custom VisualElement.
 /// </summary>
 /// <param name="elementImage"></param>
 protected virtual void PrepareVisualElementImage(CellContext context, DevAge.Drawing.VisualElements.IImage elementImage)
 {
     elementImage.AnchorArea = new DevAge.Drawing.AnchorArea(ImageAlignment, ImageStretch);
     //Read the image
     System.Drawing.Image img      = null;
     Models.IImage        imgModel = (Models.IImage)context.Cell.Model.FindModel(typeof(Models.IImage));
     if (imgModel != null)
     {
         img = imgModel.GetImage(context);
     }
     elementImage.Value = img;
 }
        /// <summary>
        /// Notify that the picture is taken.
        /// In this function, PictureTaken event and PictureTakenCommand are called.
        /// </summary>
        /// <param name="image">taken picture, must not be null</param>
        public void OnPictureTaken(Models.IImage image)
        {
            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            // call event
            if (PictureTaken != null)
            {
                PictureTaken(this, new PictureTakenEventArgs(image));
            }

            // execute command
            if (PictureTakenCommand != null && PictureTakenCommand.CanExecute(image))
            {
                PictureTakenCommand.Execute(image);
            }
        }
 public PictureTakenEventArgs(Models.IImage image)
 {
     Image = image;
 }