示例#1
0
        private void _processContentOfFile(string file, string values)
        {
            Loading(true);
            var        json      = _parse(file);
            JsonObject valueJson = null;

            if (!string.IsNullOrEmpty(values))
            {
                if (values.StartsWith("http"))
                {
                    Context = new JsonBindingContext(this, json, Title);
                    Loading(true);
                    var req = CreateRequestForUrl(values);
                    new UrlConnection("dialogValues", req, (string result) => {
                        InvokeOnMainThread(() => {
                            JsonValue resultValue = null;
                            try {
                                resultValue = JsonObject.Parse(result);
                            } catch (Exception e) {
                                Console.WriteLine("Exception while parsing result: " + e.ToString() + " Values: " + values);
                                return;
                            }
                            if (resultValue.JsonType == JsonType.Object)
                            {
                                valueJson = (JsonObject)resultValue;
                            }

                            if (!string.IsNullOrEmpty(DataRootName))
                            {
                                resultValue = ((JsonObject)resultValue).o(DataRootName);
                            }

                            Context = new JsonBindingContext(this, json, resultValue, Title);
                            _configureDialog(json, valueJson);
                            PrepareRoot(Context.Root);
                            ReloadData();
                            Loading(false);
                        });
                    }, () => { NetworkFailed(); });
                }
                else
                {
                    var datavalue = JsonObject.Parse(File.ReadAllText(values));
                    Context = new JsonBindingContext(this, json, datavalue, Title);
                }
            }
            else
            {
                Context = new JsonBindingContext(this, json, Title);
                Loading(false);
            }
            _configureDialog(json, valueJson);
            PrepareRoot(Context.Root);
            LoadView();
            ReloadData();
        }
		private void _processContentOfFile(string file, string values){
			Loading(true);
			var json = _parse(file);
			JsonObject valueJson = null;
			
			if (!string.IsNullOrEmpty(values)){
				if (values.StartsWith("http")){
					Context = new JsonBindingContext(this, json, Title);
					Loading(true);
					var req = CreateRequestForUrl(values);
					new UrlConnection("dialogValues", req, (string result)=>{
						InvokeOnMainThread(()=>{
							JsonValue resultValue = null;
							try {
								resultValue = JsonObject.Parse(result);
							
							} catch (Exception e){
								Console.WriteLine("Exception while parsing result: " +e.ToString() +" Values: " + values);
								return;
								
							}
							if (resultValue.JsonType==JsonType.Object)
								valueJson = (JsonObject)resultValue;
						
							if (!string.IsNullOrEmpty(DataRootName)) {
								resultValue = ((JsonObject)resultValue).o(DataRootName);
							}
							
							Context = new JsonBindingContext(this, json,  resultValue, Title);
							_configureDialog(json, valueJson);
							PrepareRoot(Context.Root);
							ReloadData();
							Loading(false);
							
						});
					}, ()=>{ NetworkFailed(); });
					
				} else {
					var datavalue = JsonObject.Parse(File.ReadAllText(values));
					Context = new JsonBindingContext(this, json, datavalue, Title);
				}
					
			} else {
				Context = new JsonBindingContext(this, json, Title);
				Loading(false);
			}
			_configureDialog(json, valueJson);
			PrepareRoot(Context.Root);
			LoadView();
			ReloadData();
		}