Inheritance: MonoMobile.Forms.Activities.Activity
        public static Action asAction(this JsonObject json, FormDialogViewController dvc)
        {
            if (json.ContainsKey(Constants.Action))
            {
                string actionName = json[Constants.Action];
                return(() => {
                    ControllerAction act;
                    if (json.ContainsKey(Constants.NavigateTo))
                    {
                        act = new ControllerAction(actionName, json[Constants.NavigateTo]);
                    }
                    else
                    {
                        act = new ControllerAction(actionName);
                    }
                    dvc.Execute(act, null, () => {});
                });
            }

            if (json.ContainsKey(Constants.NavigateTo))
            {
                string file = json[Constants.NavigateTo];
                return(() => {
                    dvc.NavigateTo(file);
                });
            }

            return(null);
        }
Esempio n. 2
0
        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);
        }
		public void Execute(ControllerAction action, Element el, Action completed){
			action.Execute(this, (ActivityElement)el, completed);	
		}
Esempio n. 4
0
 public ButtonElement(string caption, ControllerAction action) : base(caption)
 {
     Action = action;
 }
		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;
		}
Esempio n. 6
0
		public ButtonElement(string caption, ControllerAction action) : base (caption) {
			Action = action;
		}
 public void Execute(ControllerAction action, Element el, Action completed)
 {
     action.Execute(this, (ActivityElement)el, completed);
 }
		public static Action asAction(this JsonObject json, FormDialogViewController dvc){
			
			if (json.ContainsKey(Constants.Action)) {
				string actionName = json[Constants.Action];
				return ()=>{
					ControllerAction act;
					if (json.ContainsKey(Constants.NavigateTo))
						act = new ControllerAction(actionName, json[Constants.NavigateTo]);
					else
						act = new ControllerAction(actionName);
					dvc.Execute(act, null, ()=>{});
				};
			}
			
			if (json.ContainsKey(Constants.NavigateTo)) {
				string file = json[Constants.NavigateTo];
				return ()=>{
					dvc.NavigateTo(file);
				};
			}
			
			return null;
		}