How to implement a message box like a alert box when button gets clicked or tiles get tapped.
also messagebox or alertbox contain buttons into my windows phone 8 application.
To show an alert you can use,
MessageDialog msgbox = new MessageDialog("Message to be displayed.");
await msgbox.ShowAsync();
Just take a look at the msdn.
There you can get an example and further details about MessageBox.Show Method (String, String, MessageBoxButton):
MessageBoxResult result =
MessageBox.Show("Would you like to see the simple version?",
"MessageBox Example", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
MessageBox.Show("No caption, one button.");
}
Or a overview about the whole MessageBox class.
Related
i'm developing a windows phone application.in my application i want to make input validation for textbox.i'm using windows phone toolkit :PhoneTextBox
need to alert a Message when user fail to fill the textbox after click the submit button.is there any way to do that?
thanks!
In your Button_click event, add a condition,
if (!String.IsNullOrEmpty(PhoneTextBox.Text))
{
//your action here
}
In your Button's event handler make sure you have:
your eventhandler(){
if(string.IsNullOrWhiteSpace(this.textBox1.Text)) //here "tb" is the textbox name, in case of that give your textbox's name.
{
MessageBox.Show("TextBox is empty");
}
}
Or else try using String.IsNullOrWhiteSpace in order to check whether the string is empty.
if (String.IsNullOrWhiteSpace(Name)) //give the name of your textbox.Text
{
//Handled
}
Reference: String.IsNullOrWhiteSpace Method
On Button_click you have to check. Try following code.
if (!String.IsNullOrEmpty(YourTextBox.Text)) // it check it text box is null or empty
{
//your action here
}
consider a grammar like this ; speech.Recognizer.Grammars.AddGrammarFromList("answer",new string[] { "Go.","no" });
When I say something else that are not in grammar, she says "sorry didnt catch" and then tries to start it again. Same goes for null input.
What I want is that it should only recognize the words in grammar and for everything else it should just pass the recognition. I don't want to see anything like "sorry didnt catch" and second time recognotion. Any idea ? thanks.
Edit : with try-catch I can avoid from second time recognotion if the word is unknown but now it's waiting too long on "sorry didnt catch" part.
try
{
SpeechRecognizerUI speech = new SpeechRecognizerUI();
speech.Settings.ReadoutEnabled = false;
speech.Settings.ShowConfirmation = false;
speech.Recognizer.Settings.InitialSilenceTimeout = System.TimeSpan.FromSeconds(0.8);
speech.Recognizer.Grammars.AddGrammarFromList("answer", new string[] { "Go.", "no" });
SpeechRecognitionUIResult result = await speech.RecognizeWithUIAsync();
if (result.RecognitionResult.Text == "Go.") { .... }
}
catch
{
..... }
In my opinion, you must build your own UI to avoid this. So you should use SpeechRecognizer and then you can handle the input as you want.
In my case I even created two SpeechRecognizer, on with own Wordlist, the other one with default dictionary. It works like a charm, but I couldn't get it to work with SpeechRecognizerUI.
I'm a newbie wp dev. I want to create a many text file name like 1.text 2.text 3.text ......1760.text and I want user to type the number in text box then click the button and the result is read that typed number.text. how can I do it ? please help
you can try this method:
1. put these txt-files into a path,like:TxtFiles/1.txt,2.txt...
2. when user type the number and click button, execute a method to combine file-path and read the file. and you should check the number first.
StreamResourceInfo resourceInfo = Application.GetResourceStream(new Uri(string.Format("yourFilePath/{0}.txt",userTypedNumber), UriKind.Relative));
using (StreamReader reader = new StreamReader(resourceInfo.Stream))
{
yourContentControl.Text = reader.ReadToEnd();
reader.Close();
}
We're using Exchange Web Services to set user signature in Outlook Web Access. It works great, we see the signature under Options>Settings and the "Automatically include my signature on messages I send" check box is checked. We also set this programmatically.
However, when the user creates a new e-mail message in OWA the signature does not show up. A work around for this is to go to Options>Setting, uncheck the "Automatically include my signature on messages I send" check box , Save, check the check box again and save.
The code we use to set the signature looks something like this:
Folder rootFolder;
UserConfiguration OWAConfig;
rootFolder = Folder.Bind(service, WellKnownFolderName.Root);
OWAConfig = UserConfiguration.Bind(service, "OWA.UserOptions",rootFolder.ParentFolderId, UserConfigurationProperties.All);
OWAConfig.Dictionary["signaturehtml"] = "Hello World";
OWAConfig.Dictionary["autoaddsignature"] = "True";
OWAConfig.Update();
Any idea how to get around this problem?
I have some old code that does the same thing which is working fine. I have pasted the code below. There are a few minor differences between my code and yours. I am not sure if they make a difference but you may want to try it out. Here is an extract of my code with the differences highlighted with a comment:
private void SetSettingValue(UserConfiguration owaConfig, string propName, object propValue)
{
if (owaConfig.Dictionary.ContainsKey(propName))
{
owaConfig.Dictionary[propName] = propValue;
}
else
{
// Adds a key if it does not explicitly exist.
// I am not sure if it makes a difference.
owaConfig.Dictionary.Add(propName, propValue);
}
}
public void AddSignature()
{
// Extract
UserConfiguration OWAConfig = UserConfiguration.Bind(
service,
"OWA.UserOptions",
WellKnownFolderName.Root, // Binding to Root and not Root.ParentFolderId.
UserConfigurationProperties.Dictionary // Binds to Dictionary and not to All.
);
SetSettingValue(OWAConfig, "autoaddsignature", true);
SetSettingValue(OWAConfig, "signaturehtml", html);
OWAConfig.Update();
}
i am new to Blackberry application development.
now i am trying to make new app using adobe flex4.5 for Blackberry TabOS..
can anyone please guide How to create dialog box and how to call another screen by clicking on button????can anyone give sample code for the same...?
i am trying this code:
private function showLoginDialog():void
{
login = new LoginDialog();
login.title = "Device is locked";
login.message = "Please enter your username and password:";
login.addButton("OK");
login.addButton("Cancel");
login.passwordPrompt = "password";
login.rememberMeLabel = 'Remember me';
login.rememberMe = true;
login.dialogSize= DialogSize.SIZE_SMALL;
login.addEventListener(Event.SELECT, dButtonClicked);
login.show(IowWindow.getAirWindow().group);
}
it showing error as Access of undefined property dButtonClicked.& Access of undefined property group
-Access of undefined property IowWindow
can any one please help me to remove this error..?
Thanks in Advance---
find the following documentation link:
http://docs.blackberry.com/en/developers/deliverables/23959/
http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Flex-for-the-BlackBerry-PlayBook-in-90-Minutes/ta-p/720803