Inheritance: MonoTouch.Dialog.DialogViewController
コード例 #1
0
        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);
        }
コード例 #2
0
 public override void Execute(FormDialogViewController controller, Element element, Action completed)
 {
     try {
         controller.GetType().InvokeMember(this.ActionName,
                                           BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public,
                                           null, controller, Parameter == null ? new object[] { element } : new object[] { Parameter });
     } catch (Exception e) {
         Console.WriteLine("Could not invoke action '{0}' on dialog '{1}'. {2}", ActionName, controller.GetType().Name, e.ToString());
     }
 }
コード例 #3
0
		public override void Execute (FormDialogViewController controller, Element element,  Action completed)
		{
			try {
				controller.GetType().InvokeMember(this.ActionName,
				    BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.Public,
				    null, controller, Parameter == null ? new object[]{element} : new object[]{Parameter});
				
			} catch (Exception e){
				Console.WriteLine("Could not invoke action '{0}' on dialog '{1}'. {2}", ActionName, controller.GetType().Name, e.ToString());
			}
		}
コード例 #4
0
		public FormBindingContext(FormDialogViewController callbacks, JsonValue json, JsonValue data, string title) {
			_controller = callbacks;
			_elements = new Dictionary<string, Element>();
			
			if (json == null)
				throw new ArgumentNullException ("json");
			
			Root = new RootElement(title);
			try {
				Populate (json, Root, data);
			} catch (Exception e) {
				Console.WriteLine("Exception on JsonBindingContext " + e.ToString());
			}
		}
コード例 #5
0
		public override void Execute (FormDialogViewController controller, Element element, Action completed)
		{
			Console.WriteLine("ShowValuesInConsole");
			ThreadPool.QueueUserWorkItem( delegate { 
				
				System.Threading.Thread.Sleep(2000);
				var values = controller.GetAllValues();
				foreach (var v in values){
					Console.WriteLine("Value => {0} - {1}", v.Key, v.Value);	
				}
				
				element.Caption = "Action completed!";
				completed();
			} );
			
		}	
コード例 #6
0
        public FormBindingContext(FormDialogViewController callbacks, JsonValue json, JsonValue data, string title)
        {
            _controller = callbacks;
            _elements   = new Dictionary <string, Element>();

            if (json == null)
            {
                throw new ArgumentNullException("json");
            }

            Root = new RootElement(title);
            try {
                Populate(json, Root, data);
            } catch (Exception) {
                //Console.WriteLine("Exception on JsonBindingContext " + e.ToString());
            }
        }
コード例 #7
0
		public override void Execute (FormDialogViewController controller, Element element, Action completed)
		{
			controller.SetValue("temperature", "");
			controller.SetValue("humidity", "");
			controller.SetValue("windspeed", "");
			
			var request = new NSMutableUrlRequest(new NSUrl("http://ws.geonames.org/weatherIcaoJSON?ICAO=KORD"), NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 10);
			
			new UrlConnection("weather", request, (result)=>{
				var json = JsonObject.Parse(result);
				var weather = json["weatherObservation"];
				
				controller.SetValue("temperature", weather["temperature"].CleanString()+ " celsius");
				controller.SetValue("humidity", weather["humidity"].CleanString() + "%");
				controller.SetValue("windspeed", weather["windSpeed"].CleanString()+" km/h");
				
				controller.Reload();
				completed();
				
			}, (error)=>{
				controller.NetworkFailed(error);
				completed();
			});
		}
コード例 #8
0
 public FormSectionBuilder(FormDialogViewController controller)
 {
     _controller = controller;
 }
コード例 #9
0
		public FormBindingContext (FormDialogViewController controller, JsonValue json, string title) : this(controller, json, null, title)
		{
		}
コード例 #10
0
 public FormBindingContext(FormDialogViewController controller, JsonValue json, string title) : this(controller, json, null, title)
 {
 }
コード例 #11
0
		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;
		}
コード例 #12
0
		public FormSectionBuilder (FormDialogViewController controller)
		{
			_controller = controller;
		}