Professional: Windows® 8 Programming by Nick Lecrenski & Doug Holland & Allen Sanders & Kevin Ashley
Author:Nick Lecrenski & Doug Holland & Allen Sanders & Kevin Ashley
Language: eng
Format: epub
Publisher: John Wiley & Sons
Published: 2012-12-04T16:00:00+00:00
2. Launch the Data Samples on both PCs with proximity initiated, and bring the apps to the foreground.
3. Click the Proximity example on both PCs, select the Subscribe for Messages option on one, and the Publish Message option on another, and you should publish and receive a message. Figure 6-8 shows the screen of the receiving PC with a Hello World message transmitted and received via proximity. FIGURE 6-8
Listing 6-17 shows the ProximityDemo.xaml.cs code-behind file with publishing and receiving messages via PublishMessage and SubscribeForMessage methods of ProximityDevice type.
LISTING 6-17: ProximityDemo.xaml.cs
private void send_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { if (Message.Text.Length > 0) { _publishedMessage = _proximityDevice .PublishMessage("Windows.SampleMessageType", Message.Text); log.Items.Add("Published, tap another device to transmit."); } else { Message.Text = "Type a message"; } } private void subscribe_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { _receivedMessage = _proximityDevice .SubscribeForMessage("Windows.SampleMessageType", OnMessageReceived); log.Items.Add( "Subscribed, enter proximity to receive" ); } void OnMessageReceived(ProximityDevice proximityDevice, ProximityMessage message) { Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { log.Items.Add( String.Format("Message received: {0}", message.DataAsString)); }); }
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12607)
Hello! Python by Anthony Briggs(9929)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9805)
The Mikado Method by Ola Ellnestam Daniel Brolund(9796)
Dependency Injection in .NET by Mark Seemann(9353)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8316)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7774)
Grails in Action by Glen Smith Peter Ledbrook(7707)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7572)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7237)
Microservices with Go by Alexander Shuiskov(7001)
Practical Design Patterns for Java Developers by Miroslav Wengner(6910)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6865)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6430)
Angular Projects - Third Edition by Aristeidis Bampakos(6277)
The Art of Crafting User Stories by The Art of Crafting User Stories(5795)
NetSuite for Consultants - Second Edition by Peter Ries(5724)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5546)
Kotlin in Action by Dmitry Jemerov(5077)
