MonoMobile.Forms.FormDialogViewController._createButtonItemFor C# (CSharp) Method

_createButtonItemFor() private method

private _createButtonItemFor ( string property, JsonValue json, System.Json.JsonObject valuesJson ) : UIBarButtonItem
property string
json System.Json.JsonValue
valuesJson System.Json.JsonObject
return UIBarButtonItem
		private UIBarButtonItem _createButtonItemFor(string property, JsonValue json, JsonObject valuesJson){
			var item = (JsonObject)json[property];
			string datavalue = null, id = null;
			id = item.asString(Constants.Id);
			Activity action = null;
			UIBarButtonItem button;
			if (valuesJson!=null && !string.IsNullOrEmpty(id)){
				datavalue = valuesJson.asString(id);
			}
				
			if (item.ContainsKey(Constants.Action)) {
				action = new ControllerAction(datavalue ?? item.asString(Constants.Action));
			} else if (item.ContainsKey(Constants.Activity)) {
				action = ActivityFactory.Create(item.asString(Constants.Activity));
			}
			
			if (action==null)
				return null;
			
			if (item.ContainsKey(Constants.Image)){
				button = new UIBarButtonItem(UIImage.FromBundle(item.asString(Constants.Image)), UIBarButtonItemStyle.Plain, (object o, EventArgs a)=>{
					action.Execute(this, null, null);
				});
			} else {
				button = new UIBarButtonItem(item.asString(Constants.Caption), UIBarButtonItemStyle.Plain, (object o, EventArgs a)=>{
					action.Execute(this, null, null);
				});
			}	
			return button;
		}