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.
Related
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.
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
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);
}
I am new to windows phone app development. I am trying to build a simple speech recognition app using SpeechRecognizerUI class. But the problem is whenever i try to debug the app in my Lumia 520 device(working on 8.1 platform), it load the listener as usual and then debugger stopped automatically at the same time it load within a second, don't allow me sufficient time to speak even a single word. I am googling since 2 days but got nothing helpful. I have provided a single button on "MainPage.xml" of my app for which i have given the following code.
namespace Kundali
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private async void button_Click(object sender, RoutedEventArgs e)
{
![SpeechRecognizerUI][1] sprec = new SpeechRecognizerUI();
SpeechRecognitionUIResult result = await sprec.RecognizeWithUIAsync();
MessageBox.Show(string.Format("You said {0} ", result.RecognitionResult.Text));
}
}
When i tried to handle the exception in catch handler it shows the exception "The text associated with this error code could not be found" not even listening the single text. Some one please help me.
Actually i am working with Visual studio 2012 (Express for windows Phone 8) but my device is on 8.1. Is this the problem?? If yes then please provide the solution. How do i integrate the functionality of 8.1 in vs2012?
I can think of two possible causes:
Did you add the Speech capability and the Microphone capability in your manifest WMAppManifest.xml file?
Do you have speech support for your current language? (Try setting to en-US to test)
Did you try using TTS (Text to Speech) which is also compatible with Windows Phone 8.1?
Sample
Windows Phone 8.1 Text to Speech
I am working on a project in which i have to integrate other apps/games with my platform. Through which i can run them. So their is one bad test solution is that i make them hardcodedly integrate them inside my framework as a part of framework. But that is crap.
So, my question is can i run other installed apps(these apps will be downloaded from store separately) through some code from my platform and I know data can be transfer from one app to other apps.
It should be like when i click on Play App Button then an installed app will get start and i transfer some settings to it and when user finish playing that app some data get transfer back to my platform and my platform resumes to corresponding state.
For opening other app form your app you have to know the uri for the app for example You want to open "another app"
string anotherappURI = "anotherapp_uri_value:///?anyVariable=value";
Uri uri = new Uri(anotherappURI);
await Launcher.LaunchUriAsync(uri);
And if you want to make a uri for your app so that it can be open from another app please follow the steps
Double click on package.appxmanifest file in the project
In the Declaration tab, select "Protocol" in the drop-down list and click on add
Enter "your_app_URI_displayname" as Display Name and "your_app_URI" as the Name
Save these changes
Now after activation (when your app is called and opened) how get the activation
Go to App.xaml.cs file
Override the OnActivated method
Insert this piece of code within :
Code:
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Protocol)
{
ProtocolActivatedEventArgs eventArgs = args as
ProtocolActivatedEventArgs;
// TODO: Handle URI activation
// The received URI is eventArgs.Uri.AbsoluteUri
}
}
NOTE: Please upvote and accept it as answer if helpful