public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.

            var localFile = Path.Combine(NSBundle.MainBundle.BundlePath, "TwitterJson.txt");

            TwitterResponse response;

            using (var reader = new StreamReader(localFile))
            {
                var serializer = DependencyResolver.Current.GetService <IJsonSerializer> ();

                response = serializer.DeserializeFromReader <TwitterResponse>(reader);
            }

            if (response != null)
            {
                var dataSource = new ObservableDataSource <Datum>(response.data);
                dataSource.Bind(this.table);
            }

//          serializer.Deserialize<TwitterResponse>()
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            
            // Perform any additional setup after loading the view, typically from a nib.

            var localFile = Path.Combine (NSBundle.MainBundle.BundlePath, "TwitterJson.txt");

            TwitterResponse response;

            using (var reader = new StreamReader (localFile))
            {
                var serializer = DependencyResolver.Current.GetService<IJsonSerializer> ();

                response = serializer.DeserializeFromReader<TwitterResponse>(reader);
            }

            if (response != null)
            {
                var dataSource = new ObservableDataSource<Datum>(response.data);
                dataSource.Bind (this.table);
            }

//          serializer.Deserialize<TwitterResponse>()
        }
示例#3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.

            string homePageUrl = NSBundle.MainBundle.BundlePath + "/Content/home.html";

            var serializer = new JsonSerializer();

            this.webHybrid = new WebHybrid(this.webView, serializer);

            this.webHybrid.RegisterCallback("test", Console.WriteLine);

            this.buttonSendScript.TouchUpInside += (object sender, EventArgs e) =>
            {
                //this.webHybrid.InjectJavaScript("RunMyItem();");
                //this.webHybrid.CallJsFunction("alert", "test");
            };

//          this.buttonSendScript.OnClick ((s, e) => {
//
//
//              this.webHybrid.CallJsFunction ("onViewModelData", model);
//
//
//          });

            this.webView.LoadRequest(new NSUrlRequest(new NSUrl(homePageUrl, false)));


            var model = ChartViewModel.Dummy;

            var dataSource = new ObservableDataSource <DataPoint> ()
            {
                Data = model.DataPoints
            };

            dataSource.Bind(this.datapointTable);

            foreach (var point in model.DataPoints)
            {
                point.PropertyChanged += (s, e) => this.webHybrid.CallJsFunction("onViewModelData", model);
            }
//          if (this.canvasView != null)
//          {
//              var canvas = new CanvasView (this.canvasView, serializer);
//              canvas.Load ();
//
//              var model = new ColumnModel () {
//                  theme = "theme2",
//                  title = new Title()
//                  {
//                      text = "Canvas Demo"
//                  },
//                  data = new ColumnData()
//                  {
//                      dataPoints = new ObservableCollection<DataPoint>(
//                          new[] {new DataPoint() { label = "Banana", y = 10 }}
//                      )
//                  }
//              };
//
//              canvas.SetModel (model);
//          }
        }
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            
            // Perform any additional setup after loading the view, typically from a nib.

            string homePageUrl = NSBundle.MainBundle.BundlePath + "/Content/home.html";

            var serializer = new JsonSerializer ();
            this.webHybrid = new WebHybrid (this.webView, serializer);

            this.webHybrid.RegisterCallback ("test", Console.WriteLine);

            this.buttonSendScript.TouchUpInside += (object sender, EventArgs e) => 
            {
                //this.webHybrid.InjectJavaScript("RunMyItem();");
                //this.webHybrid.CallJsFunction("alert", "test");
            };

//          this.buttonSendScript.OnClick ((s, e) => {
//
//
//              this.webHybrid.CallJsFunction ("onViewModelData", model);
//
//
//          });

            this.webView.LoadRequest (new NSUrlRequest (new NSUrl (homePageUrl, false)));


            var model = ChartViewModel.Dummy;

            var dataSource = new ObservableDataSource<DataPoint> ()
            {
                Data = model.DataPoints
            };

            dataSource.Bind(this.datapointTable);

            foreach( var point in model.DataPoints) point.PropertyChanged += (s,e) => this.webHybrid.CallJsFunction ("onViewModelData", model);
//          if (this.canvasView != null) 
//          {
//              var canvas = new CanvasView (this.canvasView, serializer);
//              canvas.Load ();
//
//              var model = new ColumnModel () {
//                  theme = "theme2",
//                  title = new Title()
//                  {
//                      text = "Canvas Demo"
//                  },
//                  data = new ColumnData()
//                  {
//                      dataPoints = new ObservableCollection<DataPoint>(
//                          new[] {new DataPoint() { label = "Banana", y = 10 }}
//                      )
//                  }
//              };
//
//              canvas.SetModel (model);
//          }
        }