<commit_before>using System;
using MonoTouch.Dialog;
using System.Drawing;
#if XAMCORE_2_0
using UIKit;
using Foundation;
using CoreGraphics;
#else
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.CoreGraphics;
#endif

#if !XAMCORE_2_0
using nint = global::System.Int32;
using nuint = global::System.UInt32;
using nfloat = global::System.Single;

using CGSize = global::System.Drawing.SizeF;
using CGPoint = global::System.Drawing.PointF;
using CGRect = global::System.Drawing.RectangleF;
#endif

namespace MonoTouch.Dialog
{
	//	public class SignatureElement : UIViewElement
	//	{
	//		private const string CELL_IDENTIFIER = "SignatureCell";
	//		private DrawView _drawView;
	//		
	//		public SignatureElement (UIViewController parent) : base(string.Empty, new DrawView(new CGRect(5f,5f,1000,200), parent), false)
	//		{
	//			base.Flags = UIViewElement.CellFlags.DisableSelection;
	//			_drawView = (DrawView)base.View;
	//		}
	//		
	//		public override UITableViewCell GetCell (UITableView tv)
	//		{
	//			var cell = base.GetCell (tv);
	//			cell.ContentView.Frame.Height = _drawView.Frame.Height + 50;
	//			_drawView.Frame.Width = cell.Frame.Width - 10;
	//			
	//			return cell;
	//		}
	//	}
	public class CapturePhotoElement : Element, IElementSizing
	{
		public bool Mandatory { get; set; }

		public UIImage Value { get; set; }

		public string Base64Value
		{
			get
			{
				return Convert.ToBase64String(this.Value.AsJPEG().ToArray());
			}
			set
			{
				if (!String.IsNullOrWhiteSpace(value))
					UIImage.LoadFromData(NSData.FromArray(Convert.FromBase64String(value)));
				else
					this.Value = null;
			}
		}

		protected bool _showSelector = false;
		protected string _selectorCancelLabel = "Cancel";
		protected string _selectorTakePhotoLabel = "Take photo";
		protected string _selectorPickImageLabel = "Pick image";


		float newHeight = 1024f;

		static NSString hkey = new NSString("CapturePhotoElement");

		public CapturePhotoElement(string caption) : base(caption)
		{
		}

		public CapturePhotoElement(string caption, string base64value, bool showSelector, string selectorCancelLabel, string selectorTakePhotoLabel, string selectorPickImageLabel) : this(caption)
		{
			this.Base64Value = base64value;
			this._showSelector = showSelector;
			if (!string.IsNullOrWhiteSpace(selectorCancelLabel))
				this._selectorCancelLabel = selectorCancelLabel;
			if (!string.IsNullOrWhiteSpace(selectorPickImageLabel))
				this._selectorPickImageLabel = selectorPickImageLabel;
			if (!string.IsNullOrWhiteSpace(selectorTakePhotoLabel))
				this._selectorTakePhotoLabel = selectorTakePhotoLabel;
		}
		public CapturePhotoElement(string caption, string base64value) : this(caption, base64value, false, null, null, null)
		{
		}

		protected override NSString CellKey
		{
			get
			{
				return hkey;
			}
		}

		#region IElementSizing implementation
		public virtual nfloat GetHeight(UITableView tableView, NSIndexPath indexPath)
		{
			return 200;
		}
		#endregion

		public override UITableViewCell GetCell(UITableView tv)
		{
			var cell = tv.DequeueReusableCell(CellKey);
			if (cell == null)
			{
				cell = new UITableViewCell(UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
			}
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			cell.TextLabel.Font = UIFont.BoldSystemFontOfSize(17);
			//s.agostini
			cell.TextLabel.Text = Caption;
			if (this.Mandatory)<commit_msg>Photo<commit_after>using System;
using MonoTouch.Dialog;
using System.Drawing;
#if XAMCORE_2_0
using UIKit;
using Foundation;
using CoreGraphics;
#else
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using MonoTouch.CoreGraphics;
#endif

#if !XAMCORE_2_0
using nint = global::System.Int32;
using nuint = global::System.UInt32;
using nfloat = global::System.Single;

using CGSize = global::System.Drawing.SizeF;
using CGPoint = global::System.Drawing.PointF;
using CGRect = global::System.Drawing.RectangleF;
#endif

namespace MonoTouch.Dialog
{
	//	public class SignatureElement : UIViewElement
	//	{
	//		private const string CELL_IDENTIFIER = "SignatureCell";
	//		private DrawView _drawView;
	//		
	//		public SignatureElement (UIViewController parent) : base(string.Empty, new DrawView(new CGRect(5f,5f,1000,200), parent), false)
	//		{
	//			base.Flags = UIViewElement.CellFlags.DisableSelection;
	//			_drawView = (DrawView)base.View;
	//		}
	//		
	//		public override UITableViewCell GetCell (UITableView tv)
	//		{
	//			var cell = base.GetCell (tv);
	//			cell.ContentView.Frame.Height = _drawView.Frame.Height + 50;
	//			_drawView.Frame.Width = cell.Frame.Width - 10;
	//			
	//			return cell;
	//		}
	//	}
	public class CapturePhotoElement : Element, IElementSizing
	{
		public bool IsReadOnly { get; set; }

		public bool Mandatory { get; set; }

		public UIImage Value { get; set; }

		public string Base64Value
		{
			get
			{
				return Convert.ToBase64String(this.Value.AsJPEG().ToArray());
			}
			set
			{
				if (!String.IsNullOrWhiteSpace(value))
					UIImage.LoadFromData(NSData.FromArray(Convert.FromBase64String(value)));
				else
					this.Value = null;
			}
		}

		protected bool _showSelector = false;
		protected string _selectorCancelLabel = "Cancel";
		protected string _selectorTakePhotoLabel = "Take photo";
		protected string _selectorPickImageLabel = "Pick image";


		float newHeight = 1024f;

		static NSString hkey = new NSString("CapturePhotoElement");

		public CapturePhotoElement(string caption) : base(caption)
		{
		}

		public CapturePhotoElement(string caption, string base64value, bool showSelector, string selectorTakePhotoLabel, string selectorPickImageLabel) : this(caption)
		{
			this.Base64Value = base64value;
			this._showSelector = showSelector;
			if (!string.IsNullOrWhiteSpace(selectorPickImageLabel))
				this._selectorPickImageLabel = selectorPickImageLabel;
			if (!string.IsNullOrWhiteSpace(selectorTakePhotoLabel))
				this._selectorTakePhotoLabel = selectorTakePhotoLabel;
		}
		public CapturePhotoElement(string caption, string base64value) : this(caption, base64value, false, null, null)
		{
		}

		protected override NSString CellKey
		{
			get
			{
				return hkey;
			}
		}

		#region IElementSizing implementation
		public virtual nfloat GetHeight(UITableView tableView, NSIndexPath indexPath)
		{
			return 200;
		}
		#endregion

		public override UITableViewCell GetCell(UITableView tv)
		{
			var cell = tv.DequeueReusableCell(CellKey);
			if (cell == null)
			{
				cell = new UITableViewCell(UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
			}
			cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
			cell.TextLabel.Font = UIFont.BoldSystemFontOfSize(17);
			//s.agostini
			cell.TextLabel.Text = Caption;
			if (this.Mandatory)
{'fraction_non_alphanumeric': 0.101356278255797, 'fraction_numerical': 0.013416946186378884, 'mean_word_length': 4.148648648648648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6341879', 'n_tokens_mistral': 2550, 'n_tokens_neox': 2163, 'n_words': 465}