Post on 27-Jun-2015
Universal Store AppsEmanuele Garofalo
What’s new
Who am I?
Emanuele Garofalo
Agenda
Universal StoreApps
Perché?
Condivisioni a livello di piattaforma di sviluppo• API set • App model• Live Tiles • App distribution format• Controlli
Condivisioni a livello di servizi• Un solo store • Shared app identities + entitlement• Unified Push Services (WNS)• Unified App Data Roaming and backup
Perché?
Sembra entropia…ma non lo è
Serve a darti la…retro-compatibilità
Windows Phone Store App
Windows Store App
Windows Phone Silverlight (8.1) App
Facciamo chiarezza
Store Silverlight
People Hub
VoIP
Emulator, GeolocalizationGeofencing, Accessibility,
Roaming app data, A2A SSOShare contract, Background transfer
Push notification service Bluetooth LE, RFComm, WiFi Direct
NFC Secure Payment, Sensors,MMF (Microsoft Media Foundation),
Photo e Video Capture, AND MUCH MORE
Audio in Background
NuoviControlli XAML
Video editing API
Automated test tools
Alarm
Reminder
Lens App
Creiamo una universal app in visual studio
Il nuovo emulatore
Il nuovo emulatore
Il nuovo emulatore
Il nuovo emulatore
Novità – Punti di convergenza
ControlliApp life cycle
Manifest
BuildDeploy App model
Contratti
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
• L’app viene sempre ripristinata (Resume)• Le app non si chiudono con il tasto back
• Le app vengono CHIUSE usanto l’app switcher
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Panorama Hub
LongListSelectorListView
+ Semantic zoom
• FlipView• GridView• ListView• RichEditBox• PasswordBox• SemanticZoom
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Comuni
Ottimizzati per la piattaforma
Specifici
TextBox
TextBlock
Button CheckBox
Date PickerTime Picker
Pivot (WP)
AppBar
Punti di convergenza – Controlli ottimizzati
Controlli
App life cycle
Manifest
Deploy
App model
<Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="20" /> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions>
<TimePicker/> <DatePicker Grid.Row="2" /></Grid>
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
APPX for everyone (tranne che per Silverlight)
• In questo modo le risorse sono organizzate in bundle• Si riducono le dimensioni dei download• Non c’è molto da fare da parte nostra se usiamo le risorse
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Deploy
App model
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Build
Deploy
App model
Navigation Contracts Background
NavigationServiceFrame
// Simple navigation, no parameters Frame.Navigate(typeof(PaginaTarget));
// Passing a simple type, like an ID or an object Frame.Navigate(typeof(PaginaTarget), “21");
Rispetto alla navigazione basata su URI abbiamo il vantaggio di poter passare parametri di ogni tipo e non solo testuali
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Build
Deploy
App model
Navigation Contracts Background
File Open Picker contract
File Save Picker contract
Share contract
And much more…
SHARE DALLA NOSTRA APPDemo
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Build
Deploy
App model
Navigation Contracts Background
ScheduledTaskAgentWindows Runtime Background Tasks
UserPresent , UserAway, SessionConnected, TimeZoneChange, NetworkStateChange, InternetAvailable, ServicingComplete, TimeTrigger, MaintenanceTrigger, GattCharacteristicNotificationTrigger, DeviceChangeTrigger, DeviceUpdateTrigger, RfcommConnectionTrigger, Geofencing
Novità – Punti di convergenza
Controlli
App life cycle
Manifest
Build
Deploy
App model
Navigation Packaging Contracts Background
Geocircle circle = new Geocircle(terminiCenter, radius: 26); Geofence geofence = new Geofence(“TerminiNikeStore", circle); GeofenceMonitor.Current.Geofences.Add(geofence);
//Registro il background TaskBackgroundTaskBuilder builder =
new BackgroundTaskBuilder(); builder.SetTrigger(
new LocationTrigger(
LocationTriggerType.Geofence));
Novità – Windows Phone
Integrazione con il Notification Center
Cosa devo fare per integrarmi con il notification center?
(quasi) NIENTE!
Integrazione con il notification center
//Scegliete un templateToastTemplateType toastTemplate = ToastTemplateType.ToastText02;
//Recuperatene l’xmlXmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
//trovate i tag textXmlNodeList toastTextElements = toastXml.GetElementsByTagName("text");
//settate il valore dei tagtoastTextElements[0].AppendChild(toastXml.CreateTextNode(toastHeading));toastTextElements[1].AppendChild(toastXml.CreateTextNode(toastBody));
//scegliete la durata della notifica toastIXmlNode toastNode = toastXml.SelectSingleNode("/toast");((XmlElement)toastNode).SetAttribute("duration", "long");
//create la toast notificationToastNotification toast = new ToastNotification(toastXml);
//Mostrate la toast ToastNotificationManager.CreateToastNotifier().Show(toast);
Integrazione con il notification center
Per mostrare la notifica solo nel notification center:
toast.SuppressPopup = true;
NB: Se l’utente scegliesse di non mostrare le vostre notifiche sarebbe tutto (ovviamente) inutile
Integrazione con Cortana
Integrazione con CortanaOperazione in tre step
Creare il nostro file con la definizione dei
comandi vocali
Registrare i comandi vocali all’avvio
dell’applicazione
Gestire l’attivazione da comandi vocali
Comandi Vocali<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1">
<CommandSet xml:lang="en-us" Name="englishCommands">
<CommandPrefix> MyApp </CommandPrefix> <Example> tweet 'welcome to mobileday' </Example>
<Command Name="Tweet"> <Example> tweet 'welcome to mobileday' </Example>
<!-- ListenFor elements provide ways to say the command, including references to {PhraseLists} and {PhraseTopics} as well as [optional] words --> <ListenFor> tweet </ListenFor> <ListenFor> tweet {dictatedSearchTerms} </ListenFor>
<Feedback> tweeting </Feedback>
<!-- Navigate specifies the desired page or invocation destination for the Command--> <Navigate Target="Tweet.xaml" /> </Command>
<PhraseTopic Label="dictatedSearchTerms" Scenario="Search"> <Subject> twitter </Subject> </PhraseTopic>
</CommandSet></VoiceCommands>
Comandi Vocali
string voiceCommandName;
if (NavigationContext.QueryString.TryGetValue("voiceCommandName", out voiceCommandName)) { HandleVoiceCommand(voiceCommandName); } else { // If we just freshly launched this app without a Voice Command, asynchronously try to install the // Voice Commands. // If the commands are already installed, no action will be taken--there's no need to check. Task.Run(() => InstallVoiceCommands());
// Just for fun, we'll also animate the home page buttons FadeInfoButtons(true); }
Comandi Vocali
private async void InstallVoiceCommands() { try { bool using81orAbove = ((Environment.OSVersion.Version.Major >= 8) && (Environment.OSVersion.Version.Minor >= 10));
Uri vcdUri = new Uri("ms-appx:///VoiceCommandDefinition_8.1.xml");
await VoiceCommandService.InstallCommandSetsFromFileAsync(vcdUri); } catch (Exception ex) {
//Gestione dell’errore }
}
Comandi Vocali
void HandleVoiceCommand(string voiceCommandName){ string textToTweet = null; bool tweet = false;
switch (voiceCommandName) { case "Tweet": if (NavigationContext.QueryString.TryGetValue("naturalLanguage", out phraseTopicContents) && !String.IsNullOrEmpty(phraseTopicContents)) {
NavigationContext.QueryString.TryGetValue("dictatedSearchTerms", out textToTweet);
SendTweet(textToTweet); }
break;//…altri comandi…
} }
DA WINDOWS 8.1 A WINDOWS PHONE 8.1
Demo