SlideShare uma empresa Scribd logo
1 de 57
Windows Phone 8 Sensors




David Isbitski
Technical Evangelist, Microsoft
http://blogs.msdn.com/davedev
@TheDaveDev
Windows Phone 8 Sensors
Windows Phone 8 Sensors
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
Geoposition myLocation = await
geolocator.GetGeopositionAsync(maximumAge, timeout);

// We need to convert the Geoposition to a GeoCoordinate to show it on the map
GeoCoordinate geoCord = new
GeoCoordinate(myLocation.Coordinate.Latitude, myLocation.Coordinate.Longitude);
MyMapControl.Center = geoCord;

// Set up an event handler to watch for location updates
geolocator.PositionChanged += updatePosition;
void newPosition(Geolocator sender, PositionChangedEventArgs args)
{
    Deployment.Current.Dispatcher.BeginInvoke(() =>
    {
        GeoCoordinate geoCord =
            new GeoCoordinate(args.Position.Coordinate.Latitude,
                                args.Position.Coordinate.Longitude);
        MyMapControl.Center = geoCord;
    });
}
<Grid x:Name="ContentPanel" >
      <maps:Map x:Name="MyMap"/>
</Grid>



private void CreateMap()
 {
     Map MyMap = new Map();
     ContentPanel.Children.Add(MyMap);
 }
MapDownloaderTask mdt = new MapDownloaderTask();
mdt.Show();
ProximityDevice device = ProximityDevice.GetDefault();

// Make sure NFC is supported
if (device != null)
{
    _device.DeviceArrived += device_DeviceArrived;
    _device.SubscribeForMessage(“StringMessage", StringMessageHandler);
    _device.SubscribeForMessage(“ByteMessage", ByteMessageHandler);

    PeerFinder.Start();
}
void device_DeviceArrived(ProximityDevice sender)
{
    if (sendingString)
    {
        sender.PublishMessage("MyStringMessage", someString);
    }
    else if (sendingBytes)
    {
        var messageWriter = new DataWriter();
        messageWriter.UnicodeEncoding = UnicodeEncoding.Utf16LE;
        messageWriter.WriteBytes(someBytes);
        sender.PublishBinaryMessage("MyBinaryMessage",
          messageWriter.DetachBuffer());
    }
}
private void StringMessageHandler(ProximityDevice
sender, ProximityMessage message)
{
    string messageRecieved = message.DataAsString;
}
private void ByteMessageHandler(ProximityDevice sender, ProximityMessage
message)
{
    byte[] messageBytes;
    using (DataReader dReader = DataReader.FromBuffer(message.Data))
    {
         messageBytes = new byte[dReader.UnconsumedBufferLength];
         dReader.ReadBytes(messageBytes);
    }
}
ProximityDevice device = ProximityDevice.GetDefault();

// Make sure NFC is supported
if (device != null)
{
    PeerFinder.TriggeredConnectionStateChanged +=
OnTriggeredConnectionStateChanged;
    // Start finding peer apps, while making app discoverable by peers
    PeerFinder.Start();
}
void OnTriggeredConnectionStateChanged(object sender,
                                       TriggeredConnectionStateChangedEventArgs args) {
    switch (args.State)    {
        case TriggeredConnectState.Listening: // Connecting as host
            break;
        case TriggeredConnectState.PeerFound: // Proximity gesture is complete – setting up link
            break;
        case TriggeredConnectState.Connecting: // Connecting as a client
            break;
        case TriggeredConnectState.Completed: // Connection completed, get the socket
            streamSocket = args.Socket;
            break;
        case TriggeredConnectState.Canceled: // ongoing connection canceled
            break;
        case TriggeredConnectState.Failed:    // Connection was unsuccessful
            break;
    }
}
PeerFinder.AllowBluetooth = true;
PeerFinder.AllowInfrastructure = true;
async void CheeseLiker()
{
    SpeechSynthesizer synth = new SpeechSynthesizer();

    await synth.SpeakTextAsync("I like cheese.");
}
foreach (VoiceInformation vi in InstalledVoices.All)
{
    if (vi.Language == "de-DE")
    {
        _speechSynth = new SpeechSynthesizer();
        _speechSynth.SetVoice(vi);
    }
}
SpeechRecognizerUI recoWithUI;

async private void ListenButton_Click(object sender, RoutedEventArgs e)
{
    this.recoWithUI = new SpeechRecognizerUI();

    SpeechRecognitionUIResult recoResult =
        await recoWithUI.RecognizeWithUIAsync();
    if ( recoResult.ResultStatus == SpeechRecognitionUIStatus.Succeeded )
        MessageBox.Show(string.Format("You said {0}.",
                                       recoResult.RecognitionResult.Text));
}
foreach(SpeechRecognizerInformation sri
        in InstalledSpeechRecognizers.All)
{
    if(sri.Language == "de-DE")
        _speechRecognizer.Recognizer.SetRecognizer(sri);
}
Windows Phone 8
Sensors: Speech APIs
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
<CommandPrefix> Fortune Teller </CommandPrefix>
<Example> Will I find money </Example>
<Command Name="showMoney">
  <Example> Will I find money </Example>
  <ListenFor> [Will I find] {futureMoney} </ListenFor>
  <Feedback> Showing {futureMoney} </Feedback>
  <Navigate Target="/money.xaml"/>
</Command>
<PhraseList Label="futureMoney">
  <Item> money </Item>
  <Item> riches </Item>
  <Item> gold </Item>
</PhraseList>
/Money.xaml/?voiceCommandName=showMoney&futureMoney
=gold&reco=Fortune%20Teller%Will%20I%20find%20gold"
Windows Phone 8 Sensors




David Isbitski
Technical Evangelist, Microsoft
http://blogs.msdn.com/davedev
@TheDaveDev
Windows Phone 8 Sensors

Mais conteúdo relacionado

Mais procurados

ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
Jonathan Wage
 

Mais procurados (20)

History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 
Coding website
Coding websiteCoding website
Coding website
 
JSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than TwilightJSON and Swift, Still A Better Love Story Than Twilight
JSON and Swift, Still A Better Love Story Than Twilight
 
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboards
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google Glass
 
Using Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer ArchitectureUsing Templates to Achieve Awesomer Architecture
Using Templates to Achieve Awesomer Architecture
 
The (unknown) collections module
The (unknown) collections moduleThe (unknown) collections module
The (unknown) collections module
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Lecture8 php page control by okello erick
Lecture8 php page control by okello erickLecture8 php page control by okello erick
Lecture8 php page control by okello erick
 
Service intergration
Service intergration Service intergration
Service intergration
 
Prototype & jQuery
Prototype & jQueryPrototype & jQuery
Prototype & jQuery
 
Deferred
DeferredDeferred
Deferred
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
jQuery secrets
jQuery secretsjQuery secrets
jQuery secrets
 
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Angular Restmod (english version)
Angular Restmod (english version)Angular Restmod (english version)
Angular Restmod (english version)
 
ZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODMZendCon2010 Doctrine MongoDB ODM
ZendCon2010 Doctrine MongoDB ODM
 

Destaque

Social Sponsorships: Rethinking Sponsorships in the Age of Social Media
Social Sponsorships: Rethinking Sponsorships in the Age of Social MediaSocial Sponsorships: Rethinking Sponsorships in the Age of Social Media
Social Sponsorships: Rethinking Sponsorships in the Age of Social Media
Suzanne Carawan
 
9 мая
9 мая9 мая
9 мая
Yanina
 
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
Suzanne Carawan
 
РЖД
РЖДРЖД
РЖД
Yanina
 
Масленица
МасленицаМасленица
Масленица
Yanina
 

Destaque (6)

Social Sponsorships: Rethinking Sponsorships in the Age of Social Media
Social Sponsorships: Rethinking Sponsorships in the Age of Social MediaSocial Sponsorships: Rethinking Sponsorships in the Age of Social Media
Social Sponsorships: Rethinking Sponsorships in the Age of Social Media
 
9 мая
9 мая9 мая
9 мая
 
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
etouches Presents Moving from Mission-Based to Revenue-Generating Social Netw...
 
РЖД
РЖДРЖД
РЖД
 
5 Words You Never Want to Hear "You didn't have a back-up?!"
5 Words You Never Want to Hear "You didn't have a back-up?!"5 Words You Never Want to Hear "You didn't have a back-up?!"
5 Words You Never Want to Hear "You didn't have a back-up?!"
 
Масленица
МасленицаМасленица
Масленица
 

Semelhante a Windows Phone 8 Sensors

The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
Robert Nyman
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
Yekmer Simsek
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
Pedro Morais
 

Semelhante a Windows Phone 8 Sensors (20)

Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
The Open Web and what it means
The Open Web and what it meansThe Open Web and what it means
The Open Web and what it means
 
Nevermore Unit Testing
Nevermore Unit TestingNevermore Unit Testing
Nevermore Unit Testing
 
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019Managing State in React Apps with RxJS by James Wright at FrontCon 2019
Managing State in React Apps with RxJS by James Wright at FrontCon 2019
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
OWASP Proxy
OWASP ProxyOWASP Proxy
OWASP Proxy
 
Rhino Mocks
Rhino MocksRhino Mocks
Rhino Mocks
 
Building interactivity with websockets
Building interactivity with websocketsBuilding interactivity with websockets
Building interactivity with websockets
 
13 networking, mobile services, and authentication
13   networking, mobile services, and authentication13   networking, mobile services, and authentication
13 networking, mobile services, and authentication
 
Android wearpp
Android wearppAndroid wearpp
Android wearpp
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
Droidjam 2019 flutter isolates pdf
Droidjam 2019 flutter isolates pdfDroidjam 2019 flutter isolates pdf
Droidjam 2019 flutter isolates pdf
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
 
Android Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and IntentAndroid Event and IntentAndroid Event and Intent
Android Event and IntentAndroid Event and Intent
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Pushing the Web: Interesting things to Know
Pushing the Web: Interesting things to KnowPushing the Web: Interesting things to Know
Pushing the Web: Interesting things to Know
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
May 2010 - RestEasy
May 2010 - RestEasyMay 2010 - RestEasy
May 2010 - RestEasy
 

Mais de David Isbitski

Screencast dave dev-introtoask-andecho-july2015
Screencast dave dev-introtoask-andecho-july2015Screencast dave dev-introtoask-andecho-july2015
Screencast dave dev-introtoask-andecho-july2015
David Isbitski
 
Playing music and sound effects in a windows 8 metro style app using html5 an...
Playing music and sound effects in a windows 8 metro style app using html5 an...Playing music and sound effects in a windows 8 metro style app using html5 an...
Playing music and sound effects in a windows 8 metro style app using html5 an...
David Isbitski
 
Building Windows 8 Metro Style casual games using HTML5 and JavaScript
Building Windows 8 Metro Style casual games using HTML5 and JavaScriptBuilding Windows 8 Metro Style casual games using HTML5 and JavaScript
Building Windows 8 Metro Style casual games using HTML5 and JavaScript
David Isbitski
 

Mais de David Isbitski (17)

Screencast dave dev-introtoask-andecho-july2015
Screencast dave dev-introtoask-andecho-july2015Screencast dave dev-introtoask-andecho-july2015
Screencast dave dev-introtoask-andecho-july2015
 
Lap Around Azure Build Updates
Lap Around Azure Build UpdatesLap Around Azure Build Updates
Lap Around Azure Build Updates
 
Hosting a WordPress Blog on Azure Websites
Hosting a WordPress Blog on Azure WebsitesHosting a WordPress Blog on Azure Websites
Hosting a WordPress Blog on Azure Websites
 
Azure Mobile Services for iOS
Azure Mobile Services for iOSAzure Mobile Services for iOS
Azure Mobile Services for iOS
 
Building Apps for the new Windows Store
Building Apps for the new Windows Store Building Apps for the new Windows Store
Building Apps for the new Windows Store
 
More Than An App
More Than An AppMore Than An App
More Than An App
 
Designing for Windows Phone 8
Designing for Windows Phone 8Designing for Windows Phone 8
Designing for Windows Phone 8
 
A Developer Lap Around Windows Phone 8
A Developer Lap Around Windows Phone 8 A Developer Lap Around Windows Phone 8
A Developer Lap Around Windows Phone 8
 
Windows Azure Mobile Services
Windows Azure Mobile ServicesWindows Azure Mobile Services
Windows Azure Mobile Services
 
Windows Store Apps with HTML and JavaScript
Windows Store Apps with HTML and JavaScriptWindows Store Apps with HTML and JavaScript
Windows Store Apps with HTML and JavaScript
 
Designing a Windows Store App
Designing a Windows Store AppDesigning a Windows Store App
Designing a Windows Store App
 
Playing music and sound effects in a windows 8 metro style app using html5 an...
Playing music and sound effects in a windows 8 metro style app using html5 an...Playing music and sound effects in a windows 8 metro style app using html5 an...
Playing music and sound effects in a windows 8 metro style app using html5 an...
 
Windows Phone App Development
Windows Phone App DevelopmentWindows Phone App Development
Windows Phone App Development
 
HTML5 Graphics - Canvas and SVG
HTML5 Graphics - Canvas and SVGHTML5 Graphics - Canvas and SVG
HTML5 Graphics - Canvas and SVG
 
HTML5 Gaming
HTML5 GamingHTML5 Gaming
HTML5 Gaming
 
Living the Dream: Make the Video Game You’ve Always Wanted and Get Paid For It!
Living the Dream: Make the Video Game You’ve Always Wanted and Get Paid For It!Living the Dream: Make the Video Game You’ve Always Wanted and Get Paid For It!
Living the Dream: Make the Video Game You’ve Always Wanted and Get Paid For It!
 
Building Windows 8 Metro Style casual games using HTML5 and JavaScript
Building Windows 8 Metro Style casual games using HTML5 and JavaScriptBuilding Windows 8 Metro Style casual games using HTML5 and JavaScript
Building Windows 8 Metro Style casual games using HTML5 and JavaScript
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Windows Phone 8 Sensors

  • 1. Windows Phone 8 Sensors David Isbitski Technical Evangelist, Microsoft http://blogs.msdn.com/davedev @TheDaveDev
  • 2.
  • 3. Windows Phone 8 Sensors
  • 4. Windows Phone 8 Sensors
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; Geoposition myLocation = await geolocator.GetGeopositionAsync(maximumAge, timeout); // We need to convert the Geoposition to a GeoCoordinate to show it on the map GeoCoordinate geoCord = new GeoCoordinate(myLocation.Coordinate.Latitude, myLocation.Coordinate.Longitude); MyMapControl.Center = geoCord; // Set up an event handler to watch for location updates geolocator.PositionChanged += updatePosition;
  • 10. void newPosition(Geolocator sender, PositionChangedEventArgs args) { Deployment.Current.Dispatcher.BeginInvoke(() => { GeoCoordinate geoCord = new GeoCoordinate(args.Position.Coordinate.Latitude, args.Position.Coordinate.Longitude); MyMapControl.Center = geoCord; }); }
  • 11.
  • 12. <Grid x:Name="ContentPanel" > <maps:Map x:Name="MyMap"/> </Grid> private void CreateMap() { Map MyMap = new Map(); ContentPanel.Children.Add(MyMap); }
  • 13.
  • 14. MapDownloaderTask mdt = new MapDownloaderTask(); mdt.Show();
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. ProximityDevice device = ProximityDevice.GetDefault(); // Make sure NFC is supported if (device != null) { _device.DeviceArrived += device_DeviceArrived; _device.SubscribeForMessage(“StringMessage", StringMessageHandler); _device.SubscribeForMessage(“ByteMessage", ByteMessageHandler); PeerFinder.Start(); }
  • 22. void device_DeviceArrived(ProximityDevice sender) { if (sendingString) { sender.PublishMessage("MyStringMessage", someString); } else if (sendingBytes) { var messageWriter = new DataWriter(); messageWriter.UnicodeEncoding = UnicodeEncoding.Utf16LE; messageWriter.WriteBytes(someBytes); sender.PublishBinaryMessage("MyBinaryMessage", messageWriter.DetachBuffer()); } }
  • 23. private void StringMessageHandler(ProximityDevice sender, ProximityMessage message) { string messageRecieved = message.DataAsString; }
  • 24. private void ByteMessageHandler(ProximityDevice sender, ProximityMessage message) { byte[] messageBytes; using (DataReader dReader = DataReader.FromBuffer(message.Data)) { messageBytes = new byte[dReader.UnconsumedBufferLength]; dReader.ReadBytes(messageBytes); } }
  • 25.
  • 26. ProximityDevice device = ProximityDevice.GetDefault(); // Make sure NFC is supported if (device != null) { PeerFinder.TriggeredConnectionStateChanged += OnTriggeredConnectionStateChanged; // Start finding peer apps, while making app discoverable by peers PeerFinder.Start(); }
  • 27. void OnTriggeredConnectionStateChanged(object sender, TriggeredConnectionStateChangedEventArgs args) { switch (args.State) { case TriggeredConnectState.Listening: // Connecting as host break; case TriggeredConnectState.PeerFound: // Proximity gesture is complete – setting up link break; case TriggeredConnectState.Connecting: // Connecting as a client break; case TriggeredConnectState.Completed: // Connection completed, get the socket streamSocket = args.Socket; break; case TriggeredConnectState.Canceled: // ongoing connection canceled break; case TriggeredConnectState.Failed: // Connection was unsuccessful break; } }
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. async void CheeseLiker() { SpeechSynthesizer synth = new SpeechSynthesizer(); await synth.SpeakTextAsync("I like cheese."); }
  • 37. foreach (VoiceInformation vi in InstalledVoices.All) { if (vi.Language == "de-DE") { _speechSynth = new SpeechSynthesizer(); _speechSynth.SetVoice(vi); } }
  • 38.
  • 39. SpeechRecognizerUI recoWithUI; async private void ListenButton_Click(object sender, RoutedEventArgs e) { this.recoWithUI = new SpeechRecognizerUI(); SpeechRecognitionUIResult recoResult = await recoWithUI.RecognizeWithUIAsync(); if ( recoResult.ResultStatus == SpeechRecognitionUIStatus.Succeeded ) MessageBox.Show(string.Format("You said {0}.", recoResult.RecognitionResult.Text)); }
  • 40. foreach(SpeechRecognizerInformation sri in InstalledSpeechRecognizers.All) { if(sri.Language == "de-DE") _speechRecognizer.Recognizer.SetRecognizer(sri); }
  • 42.
  • 43.
  • 44. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 45. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 46. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 47. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 48. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 49. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 50. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 51. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 52. <CommandPrefix> Fortune Teller </CommandPrefix> <Example> Will I find money </Example> <Command Name="showMoney"> <Example> Will I find money </Example> <ListenFor> [Will I find] {futureMoney} </ListenFor> <Feedback> Showing {futureMoney} </Feedback> <Navigate Target="/money.xaml"/> </Command> <PhraseList Label="futureMoney"> <Item> money </Item> <Item> riches </Item> <Item> gold </Item> </PhraseList>
  • 54.
  • 55.
  • 56. Windows Phone 8 Sensors David Isbitski Technical Evangelist, Microsoft http://blogs.msdn.com/davedev @TheDaveDev