01/01/2019 |
Admin |
Xamarin
Pour supprimer l'historique d'une recherche dans un composant de type SearchBox sur Windows Phone ou du composant SearchBar sur Xamarin avec Windows, il suffit d'éxécuter ce code:
// Clear SearchBar history
var searchManager = new Windows.ApplicationModel.Search.Core.SearchSuggestionManager();
searchManager.ClearHistory();
Avec Xamarin, il suffit d'éxécuter ce code dans le App.xaml.cs de l'application Windows après cette ligne de code:
// Place the frame in the current Window
Window.Current.Content = rootFrame;
Lire >>
01/01/2019 |
Admin |
Xamarin
Voici un exemple d'implémentation du plugin UserDialogs pour la plateforme Windows.
L'auteur du plugin a indiqué qu'il ne supportera pas Windows 8. Il préfère se concentrer sur le développement du plugin pour Windows 10.
ConfirmAsync
public async Task<bool> ConfirmAsync(string message, string title = null, string okText = "OK", string cancelText = "Cancel")
{
var messgeDialog = new MessageDialog(message, title);
messgeDialog.Commands.Add(new UICommand(okText));
messgeDialog.Commands.Add(new UICommand(cancelText));
messgeDialog.DefaultCommandIndex = 0;
messgeDialog.CancelCommandIndex = 1;
var result = await messgeDialog.ShowAsync();
if (result.Label.Equals(okText))
{
return true;
}
else
{
return false;
}
}
AlertAsync
public async Task AlertAsync(string message, string title = null, string okText = "OK")
{
var md = new MessageDialog(message, title);
await md.ShowAsync();
}
PromptAsync
public async Task PromptAsync(string message, string title = null, string okText = "OK", string cancelText = "Cancel", string placeholder = "", bool secure = false)
{
var dialog = new PromptDialog(message, placeholder);
var result = await dialog.ShowAsync();
if (result != null)
{
return result;
}
else
{
...
Lire >>