multiple textboxes in input prompt WP7 - windows-phone-7

coding4fun toolkit's input prompt has one textbox but I can't find any way to add another!
Here is the sample I found from google:
InputPrompt input = new InputPrompt();
input.Completed += new EventHandler<PopUpEventArgs<string, PopUpResult>>(input_Completed);
input.Title = "Test Title";
input.Message = "Test message !";
input.InputScope = new InputScope { Names = { new InputScopeName() { NameValue = InputScopeNameValue.EmailSmtpAddress } } };
input.Show();
Here i can add only single inputscope...but i need to add multiple text boxes here!
can anyone help me ?
Thanks in advance !

The Coding4Fun control does not support this. You'll need to create your own control for such an interface. (hint. You could extend the code of the C4F control.)
My understanding and expectation of the C4F control is that it was intended for quickly gathering an single piece of information which wouldn't warrant the need for its own page.
If you're looking to require the user to enter data into "multiple text boxes" you'll likely be able to create a better user experience (and one that is like the native apps on the phone) if you use a separate page to gather such information.

Related

Xamarin.Forms Accessibilty VoiceReader

Quick question.
When it comes to Xamarin Forms, I noticed that if there is an alert called from the ViewModel
e.g:
DisplayAlertAsync("Title","Message", "Ok");
That the voice assistant only auto reads the first parameter of DisplayAlertAsync ("title") and does not auto-advance to the following parameters.
So, a temporary solution I did was concatenate the 1st and 2nd parameters into the 2nd parameter, so that VoiceReader auto reads both the title and message for accessibility users.
e.g:
DisplayAlertAsync("" ,"Title"+ "\n"+ Message", "Ok");
Is there a way to keep the traditional DisplayAlertAsync("Title","Message", "Ok"); parameter assignment, and have VoiceReader auto advance to the following parameters?
What you are looking at is expected behavior. Since Xamarin Forms uses Native APIs, so the alert dialog in the native platforms also does the same thing- Whenever you open a new page/alert, it should read the Title of that view.
For the most part, what you want to keep an eye out for is images & icons, you have to override the description of those items.
Q. Is there a way to keep the traditional DisplayAlertAsync("Title","Message", "Ok"); parameter assignment, and have VoiceOver/TalkBack auto advance to the following parameters?
A. No there isn't, you would have to create your own custom renderer if you want the reader to read everything.

Automate a reoccuring manual task (generate order number based on name) in Visual Studio

I'm currently working on a EpiServer project where we use the ContentType attribute to set the DisplayName and Order of the blocks. The Order is based on the name of the block. Here's an example:
[ContentType(
DisplayName = "My First Block",
Order = 133536,
GUID = "0f02e38a-a6e2-4333-9bd1-c61cf573d8d3",
Description = "Just an example block.",
GroupName = "Blocks.Content"
)]
public class MyFirstBlock : BaseBlock
{
}
Apparently EpiServer can't sort the blocks alphabetically so we generate the order based on the DisplayName as a work around. A formula was invented to determine the order. One colleague has written a JavaScript function that can be used to generate the order number:
function getEPiOrderNumber(value) {
var alphabeticalIndex = function (character) {
return character.toLowerCase().charCodeAt() - 96;
};
var firstSection = alphabeticalIndex(value[0]);
var secondSection = alphabeticalIndex(value[1]) + 10;
var thirdSection = alphabeticalIndex(value[2]) + 100;
return `${firstSection}${secondSection}${thirdSection}`;
}
This function can be executed in the console of a browser. Better than having to calculate the order by hand, but this requires that I switch to a browser, open the console, paste this code and execute it and finally copy the result and paste it in the model I'm working on.
I figured it would be much more convenient to be able to do generate the order number from within VS. I have been looking into using Visual Studio Extensions but can't really find anything that is to my liking.
The most optimal solution would be to be able to select the (part of the) DisplayName, right click and select a new command from the context menu that will generate the order and paste it at the correct location. Or place it on the clip board so I can easily paste it in the right location myself. A pop-up displaying the order would be fine as well.
Is this even possible?
Another option could be a new command in one of the toolbar menu's, say Tools, that would display a small window where I can enter/ paste the text and to have it generate the order that I can then paste in the code.
I have figured out how to add an Custom Command to the Tools menu and how I could generate the code and display it, but how can I enter the text? Or is it maybe possible to retrieve selected text from the editor window? That would solve my problem as well.
If anyone could point me in the right direction, that would be great!
PS. I'm not too happy with the title of this question so I'm open to suggestions if anyone can think of a title that better describes my question.
You could retrieve selected text from Visual Studio editor window with following code.
DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE));
string text = "";
if (dte.ActiveDocument != null)
{
var selection = (TextSelection)dte.ActiveDocument.Selection;
text = selection.Text;
}

PromptDialog.Choice does not show choices

I'm looking for how we can show choices to user with IDialog<object> and PromtDialog.Choice method. But the thing is below code sample doesn't show the choices. Very difficult to find code sample. Looking for a help. Thank you.
List<string> BotOptions = new List<string>();
BotOptions.Add("Find a Program");
BotOptions.Add("Find an Event");
PromptDialog.Choice(context,
ChoiceSelectAsync,BotOptions,
"I didn't understand you. I'm cable to help you with",
"Didn't get that",
1,
PromptStyle.None);
You need to change the PromptStyle to anything but None.
The available options are:
Auto
Generate buttons for choices and let connector generate the right style based on channel capabilities
AutoText
Show choices as Text.
The prompt decides if it should generate the text inline or perline based on number of choices.
Inline
Show choices on the same line.
PerLine
Show choices with one per line.
None
Do not show possible choices in the prompt
source
I think to get the prompt of choices you must "call" the promptDialog, use 'PromptChoice' option instead of 'choice'
var choosenResult = new PromptDialog.PromptChoice<string>
(new string[] { "Find a Program", "Find an Event" },
"Which one would you like?",
"Didn't get that", 3);
context.Call(choosenResult, AfterUserHasChosenAsync);

Find a button on a web page looking for part of its InnerText string in Visual Studio

I am writing automated tests for a website. On the website there is a button that will have the inner text "All Open" + four random digits. For example: "All Open2957". Is there a way to find the button using only the "All Open" part of the string?
This does not work since the string is missing the four last digits:
HtmlSpan uIAllOpenPane = new HtmlSpan();
uIAllOpenPane.SearchProperties[HtmlDiv.PropertyNames.InnerText] = "All Open";
The simple answer is to use the PropertyExpressionOperator.Contains rather than PropertyExpressionOperator.EqualTo comparator and search for just the required text.
For recorded tests, find the control in the UI Map editor and view its properties panel. Click the "Search properties" field and then click the ellipsis. The window that appears allows the comparator and the required text to be altered.
For hand coded tests use code of the form:
uIAllOpenPane.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText,
"All Open",
PropertyExpressionOperator.Contains);
According to this Microsoft blog the array index style (ie with [ and ]) as used in the question internally calls the SearchProperties.Add(...) but that style has no variation to specify ...Contains, so call the ...Add(...) explicitly.
Check this out
Button allOpenButton = (Button)BrowserWindow.ExecuteScript("allOpenButton = function(){var found; $('input[type=\"button\"]').each(function(){ if($(this).val().indexOf('All Open') > -1){ found = $(this);};}); return found;}; return allOpenButton();");
When trying to locate the controller I only got the FailedToPerformActionOnHiddenC‌​ontrolException. Eventually I was able to locate the DIV container that contained the controller I was trying to locate instead of focusing on finding the controller directly. After finding the container I could locate the controller using
HtmlSpan uIAllOpenPane = new HtmlSpan(container);
uIAllOpenPane.SearchProperties.Add(HtmlDiv.PropertyNames.InnerText, "All Open",
PropertyExpressionOperator.Contains);
The code from #AdrianHHH helped with the problem when part of the string is randomized each time you encounter the controller.

Windows Phone 8: How to bind Data?

I have a question about WP8 coding. I have a TextBox for numbers. I want calculate with the number (who has been typed in the box) on another Page. This means, that I don t want to show the number on the next Page, I want to get access to the typed value.
So what is the best way to do this?
Thanks to all answers!
Your question not seemed very clear to me. But if you are asking how to pass data between pages, you can do:
NavigationService.Navigate(new Uri("/destinationPage.xaml?dataName=",value));
In the destination page you can access the data this way:
string targetValue;
If(NavigationContext.QueryString.TryGetValue("dataName", out targetValue))
{
//targetValue will contain value, you can do anything with it
}
DataBinding to controls is different thing:
<TextBox Binding={tBoxValue, Mode = TwoWay} x:name="tbox"/>
Now in code consider presenter is an object, which contains a property tBoxValue:
If you do:
tBox.DataContext = presenter;
You can access the data entered in the TextBox via presenter.tBoxValue;

Resources