C# Browser Application - c#

I am creating a Kiosk Application for opening a single URL everytime the app run.
But unable to create a frame in c# to open such URL.
Please suggest me hot to do this coding.
Thanks in advance.

You can also use a DotNetBrowser component based on Chromium for your case. Here is an article with code examples for creating browser-based Kiosk applications with C#/VB.NET.

From VS add a WebBrowser component to your 'Kiosk' application..
And when the form loads, simply do this..
private void Form_Load(object sender, EventArgs e){
Uri url = new Uri("http://google.com");
webBrowser1.navigate(url);
}

Related

How to download HTML code from WebView webpage?

I would like to know to know how to download HTML code from a webpage in Xamarin. The webpage is opened on a Android device and requires login, therefore it cannot be downloaded using a url link in WebClient. I am interested if the is a possibilty to download the HTML code from the opened webside, so that it can be used to notify me about changes in the webside.
My code to open the webside (then i need to log in):
void WebViewFunction()
{
webView1 = FindViewById<WebView>(Resource.Id.webView1);
webView1.Settings.JavaScriptEnabled = true;
webView1.SetWebViewClient(new Client());
webView1.LoadUrl($"https://www.strava.cz/Strava/Stravnik/Prihlaseni");
}
I have absolutely no idea how to do it since I am a beginner.
Thanks for your answer.

Launching UWP application in simple C# app (WPF/Console)

I work on .NetFramework WPF app and I need to run some UWP app, like calculator having only APPID (or family package name, I suppose) like:
Microsoft.WindowsCalculator_8wekyb3d8bbwe!App
Honestly I have no idea how to do it. Google doesn't help.
Process.Start() will not manage, as I don't have exe filepath.
Any suggestions?
I tried to reference UWP launcher but it failed.
Launching UWP application in simple C# app (WPF/Console)
WindowsCalculator is open source, you could get app's protocol name here. So you could use Launcher to launch WindowsCalculator app from WPF or Console.
private async void Button_Click(object sender, RoutedEventArgs e)
{
var res = await Launcher.LaunchUriAsync(new Uri("ms-calculator:"));
}
And this is sample. Please note, you need add Windows.winmd and System.Runtime.WindowsRuntime.dll for the WPF app. For more please refer this reply.

Opening bluetooth settings page and returning to application

I have created a Xamarin cross-platform application. In which i have to open Bluetooth setting page of my xamarin cross-platform Android application via clicking on a button created.
As soon as the settings open i need to pair device similar to paring in the normal device.
If i click the back button it should return back to my created application.
I have created the following code in my xamarin.form page:
Bluetooth.xaml.cs:
using Android.Content;
using System.Runtime.InteropServices;
using Android.Support.Design.Widget;// Does not accept this in xamarin forms
using Android.Support.V7.App;// Does not accept this in xamarin forms
private void OnSettingsDevice_Button(object sender, EventArgs e)
{
Intent intentOpenBluetoothSettings = new Intent();
intentOpenBluetoothSettings.SetAction(Android.Provider.Settings.ActionBluetoothSettings);
StartActivity(intentOpenBluetoothSettings);
}
It throws an error stating
The name 'StartActivity' does not exist in the current context.
I even wrote this code in mainactivity.cs which stored in my App.Droid application. I am unable to call this in my xamarin form page.
Even tried with creating a function for this code and call that function in my Xamarin.forms.cs file as well.
Tried with https://jeremylindsayni.wordpress.com/2018/12/16/how-to-detect-nearby-bluetooth-devices-with-net-and-xamarin-android/ Blog but could not execute it.
Please help me out with this issue.
thanks in advance

Toast notification not showing when button is clicked

I am developing an app for Windows Phone 8.0 in VS2012.
I wanted to add a notification system for my app, so I searched for guides and found this one from MDSN.
I used the same methods as those in the guide, but the notification doesn't appear when I click the button.
Here's the event handler method:
private void Button_Click_1(object sender, RoutedEventArgs e)
{
ShellToast toast = new ShellToast();
toast.Content = "Hello!";
toast.Title = "StackOverFlow";
toast.Show();
}
I don't think you can use the native Toasts within your own app. These can be used via background tasks when you app is not running.
An alternative is using Coding4Fun Toolkit which has a ToastPrompt that can be used within the app.
Or if you don't want to get the whole Coding4Fun package, you can get Toastinet instead.
Both are also available on Nuget.

LaunchUriAsync() doesn't launch Windows Store App

I'm trying call my application on OnShareTargetActivated() method by LaunchUriAsync() but it doesn't work.
I have a protocol called "myapp" in appmanifest. When I put "myapp://test" on File Explorer, my application is launched, but when I do it:
protected async override void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
Uri uri = new Uri("myapp://test");
await Windows.System.Launcher.LaunchUriAsync(uri);
}
This occurs when the user clicks on my application that is on Charm Bar in Share option. But the application is never launched.
sharing app sample (http://code.msdn.microsoft.com/windowsapps/Sharing-Content-Target-App-e2689782)
You should check the format , of what you are sharing , metro will only accept some type of content to share , Sharing format are Text,uri,Bitmap,storageitems,Html
share target code and pictures (http://blogs.msdn.com/b/going_metro/archive/2012/05/03/integrating-with-windows-8-share-charm-part-1-receiving-data.aspx)
if u find useful , pls acccept as answer

Categories