Exemplo n.º 1
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", ""));
        }
        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", ""));
        }