private void Unbind(HybridWebView oldElement)
 {
     if (oldElement != null)
     {
         oldElement.PropertyChanged          -= this.Model_PropertyChanged;
         oldElement.JavaScriptLoadRequested  -= OnInjectRequest;
         oldElement.LoadFromContentRequested -= LoadFromContent;
         oldElement.LoadContentRequested     -= LoadContent;
     }
 }
 private void Unbind(HybridWebView oldElement)
 {
     if (oldElement != null)
     {
         oldElement.PropertyChanged -= this.Model_PropertyChanged;
         oldElement.JavaScriptLoadRequested -= OnInjectRequest;
         oldElement.LoadFromContentRequested -= LoadFromContent;
         oldElement.LoadContentRequested -= LoadContent;
     }
 }
        void PageDataLoaded()
        {
            if (_hybridWebView == null) {
                _hybridWebView = new HybridWebView (new SystemJsonSerializer());
                _hybridWebView.HorizontalOptions = LayoutOptions.FillAndExpand;
                _hybridWebView.VerticalOptions = LayoutOptions.FillAndExpand;

                Content = _hybridWebView;
            }

            var profitReportRazorView = new ProfitReport () { Model = PageModel.ProfitData };
            var html = profitReportRazorView.GenerateString ();
            _hybridWebView.LoadContent (html.Replace("\r\n", ""));
        }
Esempio n. 4
0
        void PageDataLoaded()
        {
            if (_hybridWebView == null) {
                _hybridWebView = new HybridWebView (new JsonNetJsonSerializer());
                _hybridWebView.HorizontalOptions = LayoutOptions.FillAndExpand;
                _hybridWebView.VerticalOptions = LayoutOptions.FillAndExpand;
                _hybridWebView.RegisterCallback ("EditVisible", (data) => {
                    PageModel.EditVisible.Execute(data);
                });
                _hybridWebView.RegisterNativeFunction ("GetGraphData", (input) => {
                    return PageModel.GetGraphData(input);
                });

                _hybridWebView.LoadFinished += (s, e) => {
                    string data = JsonConvert.SerializeObject (PageModel.GraphData).Replace ("\r\n", "");
                    _hybridWebView.InjectJavaScript ("JellyBeanTrackerApp.buildChartStr('" + data + "');");
                };
                Content = _hybridWebView;
            }

            var profitReportRazorView = new JellyBeanGraph ();// { Model = PageModel.GraphData };
            var html = profitReportRazorView.GenerateString ();
            _hybridWebView.LoadContent (html.Replace("\r\n", ""));
        }