public LocalHtmlBaseUrl () { var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource (); htmlSource.Html = @"<html> <head> <link rel=""stylesheet"" href=""default.css""> </head> <body> <h1>Xamarin.Forms</h1> <p>The CSS and image are loaded from local files!</p> <img src='Images/XamarinLogo.png'/> <p><a href=""local.html"">next page</a></p> </body> </html>"; if (Device.OS != TargetPlatform.iOS) { // the BaseUrlWebViewRenderer does this for iOS, until bug is fixed htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); } browser.Source = htmlSource; Content = browser; }
public LocalHtml(PContent content, String userPath) { //var browser = new WebView(); //String imagePfadContent = "SMK.zeug.PContent.p"; String source = (DependencyService.Get<ISaveAndLoad>().PathCombine( (DependencyService.Get<ISaveAndLoad>().PathCombine( DependencyService.Get<ISaveAndLoad>().Getpath(userPath), "p" + content.content_ID.ToString())), content.files[0])); var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); if (DependencyService.Get<ISaveAndLoad>().FileExistExact(source)) { htmlSource.Html = DependencyService.Get<ISaveAndLoad>().LoadText(source); } if (Device.OS != TargetPlatform.iOS) { // the BaseUrlWebViewRenderer does this for iOS, until bug is fixed htmlSource.BaseUrl = (DependencyService.Get<ISaveAndLoad>().PathCombine( DependencyService.Get<ISaveAndLoad>().Getpath(userPath), "p" + content.content_ID.ToString())); } browser.Source = htmlSource; Content = browser; }
public LocalHtmlBaseUrl() { var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); htmlSource.Html = @"<html> <head> <link rel=""stylesheet"" href=""default.css""> </head> <body> <h1>Xamarin.Forms</h1> <p>The CSS and image are loaded from local files!</p> <img src='XamarinLogo.png'/> <p><a href=""local.html"">next page</a></p> </body> </html>"; if (Device.OS != TargetPlatform.iOS) { // the BaseUrlWebViewRenderer does this for iOS, until bug is fixed htmlSource.BaseUrl = DependencyService.Get <IBaseUrl> ().Get(); } browser.Source = htmlSource; Content = browser; }
public ChartPage(String title) { Title = title; var browser = new BaseUrlWebView() // temporarily use this so we can custom-render in iOS { VerticalOptions = LayoutOptions.FillAndExpand }; var htmlSource = new HtmlWebViewSource(); var assembly = typeof(ChartPage).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream("ChartPerformance." + title + ".html"); string text = ""; using (var reader = new System.IO.StreamReader(stream)) { text = reader.ReadToEnd(); } htmlSource.Html = text; if (Device.OS != TargetPlatform.iOS) { // the BaseUrlWebViewRenderer does this for iOS, until bug is fixed var baseUrl = DependencyService.Get <IBaseUrl>(); htmlSource.BaseUrl = baseUrl.Get(); } browser.Source = htmlSource; Padding = new Thickness(10, 10, 10, 10); Content = browser; BackgroundColor = Color.White; }
public Schedules (string title) { ToolbarItem itemPrint = new ToolbarItem { Text = "Printable web version", Order = ToolbarItemOrder.Secondary, }; ToolbarItems.Add(itemPrint); var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS Title=title; var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); string filename = ""; if (title == "Table of study schedules") filename = "schedule1.html"; else if (title == "勉強スケジュールの比較") filename = "schedule2.html"; else if (title == "100-minute lessons") filename = "schedule6.html"; else if (title == "90-minute lessons") filename = "schedule5.html"; else if (title == "80-minute lessons") filename = "schedule4.html"; else if (title == "60-minute lessons") filename = "schedule3.html"; if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+filename; } else { browser.Source = htmlSource.BaseUrl + "/" + filename; } Content = browser; }
public GCO () { var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS Title="Gojūon Collation Order"; var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+"GCO.html"; } else { browser.Source = htmlSource.BaseUrl+"/GCO.html"; } Content = browser; }
public Intro () { var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS Title = "Japanese Phonetic Writing"; var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+"Introduction.html"; } else { browser.Source = htmlSource.BaseUrl+"/Introduction.html"; } Content = browser; }
public Terms () { var browser = new BaseUrlWebView (); Title = "Terms of Use"; this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+"EULA-Google.htm"; } else { browser.Source = htmlSource.BaseUrl+"/EULA-Apple.htm"; } Content = browser; }
public WallChart () { this.Title = "Wall Chart"; var browser = new BaseUrlWebView (); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource (); htmlSource.BaseUrl = DependencyService.Get<IBaseUrl> ().Get (); if (Device.OS != TargetPlatform.iOS) { browser.Source = htmlSource.BaseUrl+"wallchart.html"; } else { browser.Source = htmlSource.BaseUrl+"/wallchart.html"; } Content = browser; }
public AboutusPage() { //this.Title = "About Churchill Knight & Associate Ltd."; var lblTitle = new Label { Text = "About Churchill Knight & Associate Ltd.", BackgroundColor = Color.Black, Font = Font.SystemFontOfSize(NamedSize.Medium), TextColor = Color.White, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, // Center the text in the blue box. YAlign = TextAlignment.Center }; var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); htmlSource.Html = GetContent(); if (Device.OS != TargetPlatform.iOS) { htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); } browser.Source = htmlSource; browser.VerticalOptions = LayoutOptions.FillAndExpand; // Content = browser; var downloadButton = new Button { Text = "Download terms and conditions", BackgroundColor = Color.FromHex("f7941d"), TextColor = Color.White }; var contactUsButton = new Button { Text = "Contact us", BackgroundColor = Color.FromHex("0d9c00"), TextColor = Color.White }; var layout = new StackLayout() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Vertical, Children = { lblTitle, browser, downloadButton, contactUsButton }, WidthRequest = 200, HeightRequest = 200 }; Content = layout; }
public LessonPage() { Label title = new Label { Text = "Theory", FontSize = 40 }; BaseUrlWebView lessonWebview = new BaseUrlWebView(); var htmlSource = new HtmlWebViewSource(); htmlSource.Html = @"<html> <head></head> <body> <h1>Xamarin.Forms</h1> <p>The CSS and image are loaded from local files!</p> <p><a href=""theory_fr.html"">next page</a></p> </body> </html>"; htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); lessonWebview.Source = htmlSource; StackLayout stackLayout = new StackLayout { Children = { title, lessonWebview } }; ScrollView scrollView = new ScrollView { VerticalOptions = LayoutOptions.FillAndExpand, Content = stackLayout }; this.Content = lessonWebview; }
public Home() { var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); htmlSource.Html = @"<html> <head> <link rel=""stylesheet"" href=""default.css""> </head> <body> <h1>Xamarin.Forms</h1> <p>The HOME CSS and image are loaded from local files!</p> <img src='XamarinLogo.png'/> <p><a href=""local.html"">next page</a></p> </body> </html>"; htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); browser.Source = htmlSource; Content = browser; }
public AboutUs() { this.Title = "About Churchill Knight & Associate Ltd."; var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); htmlSource.Html = GetContent(); if (Device.OS != TargetPlatform.iOS) { htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); } browser.Source = htmlSource; browser.VerticalOptions = LayoutOptions.FillAndExpand; // Content = browser; var downloadButton = new Button(); downloadButton.Text = "Download terms and conditions"; var contactUsButton = new Button(); contactUsButton.Text = "Contact us"; var layout = new StackLayout() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Vertical, Children = { browser, downloadButton, contactUsButton }, WidthRequest = 200, HeightRequest = 200 }; Content = layout; }
public MainPage() { InitializeComponent(); //var browser = new WebView //{ // //Source = "http://winecodaveuncilofontario.ca/" // Source = "http://winecouncilofontario.ca/" //}; //// The root page of your application //var content = new ContentPage //{ // Content = browser //}; //Navigation.PushAsync(content); NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasBackButton(this, false); if (App.isOnline) { webURL = App.webURL; MyWeb.Source = webURL; } else { // localURL = App.localURL; var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); /* htmlSource.Html = @"<html> * <head> * <style> * body {background-color: #E7E7E7;} * h1 {color: #455372; text-align: center;} * p {color: #616A7F; text-align: center;} * .ser { * font-family: 'Courier New', Courier, monospace; * } * .sans{ * font - family: Arial, Helvetica, sans - serif; * } * </style> * </head> * <body> * <h1 class='ser'>htmlSource</h1> * <p class='sans'>A local way to write up some html syntax.</p> * </body></html>"; */ // MyWeb.Source = htmlSource; /* * //get file from file system * var assembly = typeof(MainPage).GetTypeInfo().Assembly; * string fullname = assembly.GetName().FullName; * string name = assembly.GetName().Name; * var customAttributes = assembly.GetCustomAttributes(); * //string page = DependencyService.Get<IBaseUrl>().Get(); * var resourceNames = assembly.GetManifestResourceNames(); * Stream stream = assembly.GetManifestResourceStream(name + ".local.html"); * string rawHtml = ""; * using (var reader = new System.IO.StreamReader(stream)) * { * rawHtml = reader.ReadToEnd(); * } * * HtmlWebViewSource htmlFileSource = new HtmlWebViewSource * { * Html = rawHtml //"<html><body>Hello World! Hello World! Hello World!</body></html>" * }; * htmlFileSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get();// + "/local.html"; * MyWeb.Source = htmlFileSource; */ //"" can be used instead ' htmlSource.Html = @"<html> <head> <link rel='stylesheet' href='default.css'> </head> <body> <h1>Xamarin.Forms</h1> <p>The CSS and image are loaded from local files!</p> <img src='XamarinLogo.png'/> <p><a href='local.html'>next page</a></p> <p><a href='react/index.html'>react page</a></p> <p><a href='/react/index.html'>react page</a></p> </body> </html>"; htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); // browser.Source = htmlSource; // MyWeb = browser; MyWeb.Source = htmlSource; } //NetworkStatus internetStatus = Reachability.InternetConnectionStatus(); // NotReachable, ReachableViaCarrierDataNetwork, ReachableViaWiFiNetwork }
public AboutusPage() { var lblTitle = new Label { Text = "About Churchill Knight & Associate Ltd.", BackgroundColor = Color.Black, Font = Font.SystemFontOfSize(NamedSize.Large), TextColor = Color.White, VerticalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, // Center the text in the blue box. YAlign = TextAlignment.Center }; var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource(); htmlSource.Html = GetContent(); if (Device.OS != TargetPlatform.iOS) { htmlSource.BaseUrl = DependencyService.Get <IBaseUrl>().Get(); } browser.Source = htmlSource; browser.VerticalOptions = LayoutOptions.FillAndExpand; var downloadButton = new Button { Text = "Download terms and conditions", BackgroundColor = Color.FromHex("f7941d"), TextColor = Color.White }; downloadButton.Clicked += (object sender, EventArgs e) => { DependencyService.Get <FormSample.Helpers.Utility.IUrlService> ().OpenUrl(Utility.PDFURL); }; var contactUsButton = new Button { Text = "Contact us", BackgroundColor = Color.FromHex("0d9c00"), TextColor = Color.White }; contactUsButton.Clicked += (object sender, EventArgs e) => { App.RootPage.NavigateTo("Contact us"); }; var labelStakeLayout = new StackLayout() { Children = { lblTitle }, Orientation = StackOrientation.Vertical, }; var buttonLayout = new StackLayout() { Orientation = StackOrientation.Vertical, Padding = new Thickness(Device.OnPlatform(5, 5, 5), 0, Device.OnPlatform(5, 5, 5), 0), //new Thickness(5,0,5,0), Children = { downloadButton, contactUsButton } }; var layout = new StackLayout() { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, Orientation = StackOrientation.Vertical, Children = { labelStakeLayout, browser, buttonLayout }, WidthRequest = 200, HeightRequest = 200 }; Content = layout; }
public MapPage() { NavigationPage.SetTitleIcon(this, "allergieradar_tab.png"); //NavigationPage.HeightProperty(this,50); var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource() { Html = @" <html> <head> <link rel=""stylesheet"" href=""default.css""> <script> window.location.replace(""country.html""); </script> </head> <body> </body> </html>", BaseUrl = DependencyService.Get <IBaseUrl>().Get() }; browser.Source = htmlSource; AbsoluteLayout simpleLayout = new AbsoluteLayout { VerticalOptions = LayoutOptions.FillAndExpand }; //var bottomRightLabel = new ActionButton() //{ // Margin = 5 //}; var bottomRightLabel = new NControl.Controls.ActionButton { ButtonColor = Color.FromHex("#2196F3"), //ButtonIcon = FontAwesomeLabel.FAPlus, Margin = 5, }; globalComplaintScore = new Label() { Margin = 15, Text = "0", FontSize = 40, TextColor = Color.White, IsVisible = true }; Label globalComplaintText = new Label() { Margin = 15, Text = "Landelijke\nklachtenscore", FontSize = 16, TextColor = Color.White, IsVisible = true }; GetGlobalComplaintScore(); var command = new Command(() => OpenModal()); bottomRightLabel.Command = command; AbsoluteLayout.SetLayoutFlags(bottomRightLabel, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutFlags(bottomRightLabel, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(bottomRightLabel, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutBounds(globalComplaintScore, new Rectangle(0f, 0f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutBounds(globalComplaintText, new Rectangle(0f, 50f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(browser, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(browser, new Rectangle(0, 0, 1, 1)); simpleLayout.Children.Add(browser); simpleLayout.Children.Add(globalComplaintScore); simpleLayout.Children.Add(globalComplaintText); if (!string.IsNullOrEmpty(LoggedinUser.Password)) { //simpleLayout.Children.Add(bottomRightLabel,new Rectangle((simpleLayout.Width / 4) - (56 / 2), (simpleLayout.Height / 2) - (56 / 2), 56, 56)); simpleLayout.Children.Add(bottomRightLabel); } Content = simpleLayout; }