Hi folks,
In this article I’d like to present all the new Windows Phone 7.5 Mango APIs. The goal is to inform developers who aren’t familiar with Mango of what new APIs are available. Since there are “1,500” new APIs we won’t be able to deep-dive into APIs with code samples. We’ll examine the new APIs and their related class diagrams. Most APIs should be fairly straightforward to professional .net developers who should be familiar with Microsoft’s API style. Each section of this article will also contain external links for those wishing to learn more about the APIs, featuresets and their usages.
How was this article composed? Who is it meant for?
This article is geared towards professional .net developers who want to learn about the WP7.5 Mango release. If you can look at a Microsoft API and figure out what it does, then this article is for you. If can’t look at an API and figure it out, then this article isn’t for you. We won’t have any samples of code usage inline in the article. Though there are external links for most topics.
Using the Framework Design Studio I compared all the WP7.0 (NoDo) assemblies with the WP7.5 (Mango) assemblies. We’ll review those changes in this article.
You can download the generated diff reports from @ http://JustinAngel.net/storage/MangoWp7ToWp71Reports.zip
Table of Contents
- How was this article composed? Who is it meant for?
- Sensors API: overview, SensorBase and other supporting classes
- Sensor API: Gyroscope and Compass
- Sensor APIs: Combined Motion API
- Sensor APIs: changes to the Accelerometer API
- Camera API
- Background API: overview and BackgroundTask class
- Background API: Background Audio and streaming background Audio
- Background API: Data Transfer APIs
- Scheduling & Background API: Alarms, Reminders, Periodic Tasks and Resource Intensive Tasks
- Background API: Programmatic Toast Notifications
- Appointments and Contacts API: Overview
- Appointments
- Contacts
- New Launchers and Choosers
- Changes and additions to existing Launchers and Choosers
- Secondary Tiles and primary tile improvements
- Mixed XNA and Silverlight apps
- LINQ-to-SQL and Local Database
- Search Extensibility
- Sockets: IP and DNS Addresses
- Sockets: DNS Resolution
- Sockets: Socket class and SocketAsyncEventArgs
- Sockets: UDP
- Shell UI: New ProgressIndicator, and changes to ApplicationBar & SystemTray
- Bing Maps changes: Random XAML elements positioning
- Removing Pages from the backstack frame journal
- Device Information and Network Information
- WebBrowser control changes: HTML5 GeoLocation and NavigationFailed event
- Network Request Preference and Requirements
- Xbox Live: Render Xbox Live Avatars in XNA
- Xbox Live: Avatar Assets
- Custom Linq Providers
- Dynamically compiled Lambda Expressions and Reflection.Emit
- mscorib.Extensions: SIMD/ARM-NEON XNA support
- mscorlib.Extensions: Mutex
- mscorlib.Extensions: INotifyPropertyChanging
- mscorlib.Extensions: RSA Cryptography
- Silverlight 4: Base-Class Library changes in mscorlib assembly
- Silverlight 4: System.Windows Silverlight changes
Sensors API: overview, SensorBase and other supporting classes
A new overall class hierarchy has been added to support Sensor readings from various sensors. In WP7.1 we only had Acceleromators. In WP7.5 the API has also been expanded to support the Compasses, Gyroscope and combined “Motion” APIs.
As you can see the new SensorBase<TSensorReading> class is the base class for all the new sensor classes. This architecture is a very elegant solution to making Sensor APIs consistent across multiple devices.
publicabstractclassSensorBase<TSensorReading> : IDisposable
where TSensorReading : ISensorReading
{
publiceventEventHandler<SensorReadingEventArgs<TSensorReading>> CurrentValueChanged;
public TSensorReading CurrentValue { get; }
publicbool IsDataValid { get; }
publicTimeSpan TimeBetweenUpdates { get; set; }
publicvirtualvoid Start();
publicvirtualvoid Stop();
}
publicinterfaceISensorReading
{
DateTimeOffset Timestamp { get; }
}
publicclassSensorReadingEventArgs<T> : EventArgs
where T : ISensorReading
{
public T SensorReading { get; set; }
}
Back to the table of contents
Sensor API: Gyroscope and Compass
Two new Sensors now supported in WP7.5 are the Gyroscope and Compass APIs. They follow the pattern we just saw above of inheriting from SensorBase<ISensorReading> and implementing their own sensor reading event arguments.
publicsealedclassCompass : SensorBase<CompassReading>
{
public Compass();
publicstaticbool IsSupported { get; internalset; }
publiceventEventHandler<CalibrationEventArgs> Calibrate;
}
publicstructCompassReading : ISensorReading
{
publicDateTimeOffset Timestamp { get; internalset; }
publicdouble HeadingAccuracy { get; internalset; }
publicdouble TrueHeading { get; internalset; }
public Vector3 MagnetometerReading { get; internalset; }
publicdouble MagneticHeading { get; internalset; }
}
publicsealedclassGyroscope : SensorBase<GyroscopeReading>
{
public Gyroscope();
publicstaticbool IsSupported { get; internalset; }
}
publicstructGyroscopeReading : ISensorReading
{
publicDateTimeOffset Timestamp { get; internalset; }
public Vector3 RotationRate { get; internalset; }
}
Sensor APIs: Combined Motion API
An additional new type of Sensor readings is the new “Motion” API which takes input from all other available sensors and provides sensor-independent motion information. It’s recommended developers use this API whenever applicable to allow apps to work on as many devices as possible regardless of low-level supported sensors.
publicsealedclassMotion : SensorBase<MotionReading>
{
public Motion();
publicstaticbool IsSupported { get; internalset; }
publiceventEventHandler<CalibrationEventArgs> Calibrate;
}
public struct MotionReading : ISensorReading
{
public DateTimeOffset Timestamp { get; internal set; }
public AttitudeReading Attitude { get; internal set; }
public Vector3 DeviceAcceleration { get; internal set; }
public Vector3 Gravity { get; internal set; }
public Vector3 DeviceRotationRate { get; internal set; }
}
publicstructAttitudeReading : ISensorReading
{
publicDateTimeOffset Timestamp { get; internalset; }
publicfloat Yaw { get; internalset; }
publicfloat Pitch { get; internalset; }
publicfloat Roll { get; internalset; }
public Quaternion Quaternion { get; internalset; }
public Matrix RotationMatrix { get; internalset; }
}
Back to the table of contents
Sensor APIs: changes to the Accelerometer API
The original API for WP7 Accelerometer was written back when there was only one Sensor API to support. As you’ve seen there is a new Sensor architectureand some elements of the Accelerometer API are now obsolete in favour of the new Sensor API conventions.
public sealed class Accelerometer : SensorBase<AccelerometerReading>
{
public static bool IsSupported { get; internal set; }
public SensorState State { get; }
[Obsolete("use CurrentValueChanged")]
public event EventHandler<AccelerometerReadingEventArgs> ReadingChanged;
}
publicstructAccelerometerReading : ISensorReading
{
publicDateTimeOffset Timestamp { get; internalset; }
public Vector3 Acceleration { get; internalset; }
}
For more reading on the Sensor APIs and how to use them see MSDN’s section on Sensors for Windows Phone.
Back to the table of contents
Camera API
Managed camera access for non-OEM apps has been added as part of the Mango release. You can read more about how to use this API on MSDN @ Camera and Photos for Windows Phone.
It’s easy to see that the core of this new API is the newly exposed Camera class and its inheriting class PhotoCamera that’s used for still shots.
publicabstractclassCamera : IDisposable
{
publicstaticbool IsCameraTypeSupported(CameraType type);
public CameraType CameraType { get; protectedset; }
publicIEnumerable<Size> AvailableResolutions { get; }
public Size Resolution { get; set; }
public Size PreviewResolution { get; }
publicdouble Orientation { get; }
publiceventEventHandler<CameraOperationCompletedEventArgs> Initialized;
publicvoid Dispose();
}
publicsealedclassPhotoCamera : Camera
{
public PhotoCamera(CameraType type);
public PhotoCamera();
publicvoid Focus();
publicvoid FocusAtPoint(double x, double y);
publicvoid CancelFocus();
publicvoid GetPreviewBufferArgb32(int[] pixelData);
publicvoid GetPreviewBufferY(byte[] pixelData);
publicvoid GetPreviewBufferYCbCr(byte[] pixelData);
publicbool IsFlashModeSupported(FlashMode mode);
publicvoid CaptureImage();
publicbool IsFocusSupported { get; }
publicbool IsFocusAtPointSupported { get; }
public YCbCrPixelLayout YCbCrPixelLayout { get; }
public FlashMode FlashMode { get; set; }
publiceventEventHandler<CameraOperationCompletedEventArgs> AutoFocusCompleted;
publiceventEventHandler CaptureStarted;
publiceventEventHandler<ContentReadyEventArgs> CaptureThumbnailAvailable;
publiceventEventHandler<ContentReadyEventArgs> CaptureImageAvailable;
publiceventEventHandler<CameraOperationCompletedEventArgs> CaptureCompleted;
}
There are a few new event handlers and Enums used in PhotoCamera and Camera classes.
publicenumCameraType
{
Primary,
FrontFacing,
}
publicenumFlashMode
{
On = 1,
Off = 2,
Auto = 3,
RedEyeReduction = 4,
}
publicclassCameraOperationCompletedEventArgs : EventArgs
{
public CameraOperationCompletedEventArgs(bool succeeded, Exception exception);
publicException Exception { get; }
publicbool Succeeded { get; }
}
publicsealedclassContentReadyEventArgs : EventArgs
{
publicStream ImageStream { get; }
}
Video cameras as enabled as an extension method on VideoBrush through CameraVideoBrushExtensions.
publicstaticclassCameraVideoBrushExtensions
{
publicstaticvoid SetSource(this VideoBrush brush, Camera camera);
}
CameraButtons expose static events related to the shutter button.
publicstaticclassCameraButtons
{
publicstaticeventEventHandler ShutterKeyPressed;
publicstaticeventEventHandler ShutterKeyHalfPressed;
publicstaticeventEventHandler ShutterKeyReleased;
}
A preview of the current image in the camera is available via the PhotoCamera.GetPreviewBufferYCbCr() method. The information describing the contents of that preview is available through the YCbCrPixelFormat class.
publicsealedclassYCbCrPixelLayout
{
publicint RequiredBufferSize { get; internalset; }
publicint YPitch { get; internalset; }
publicint YXPitch { get; internalset; }
publicint YOffset { get; internalset; }
publicint CbPitch { get; internalset; }
publicint CbXPitch { get; internalset; }
publicint CbOffset { get; internalset; }
publicint CrPitch { get; internalset; }
publicint CrXPitch { get; internalset; }
publicint CrOffset { get; internalset; }
}
The last API for the Camera Mango featureset is the addition of the MediaLibrary.SavePictureToCameraRoll() method. With it developers can create custom camera apps that save to the same location as the WP7 built-in camera app.
publicsealedclassMediaLibrary : IDisposable
{
public MediaLibrary();
public MediaLibrary(MediaSource mediaSource);
publicvoid Dispose();
publicPicture SavePictureToCameraRoll(string name, byte[] imageBuffer);
publicPicture SavePictureToCameraRoll(string name, Stream source);
publicPicture SavePicture(string name, byte[] imageBuffer);
publicPicture SavePicture(string name, Stream source);
publicPicture GetPictureFromToken(string token);
publicAlbumCollection Albums { get; }
publicArtistCollection Artists { get; }
publicGenreCollection Genres { get; }
publicbool IsDisposed { get; }
publicMediaSource MediaSource { get; }
publicPictureCollection Pictures { get; }
publicPlaylistCollection Playlists { get; }
publicPictureAlbum RootPictureAlbum { get; }
publicPictureCollection SavedPictures { get; }
publicSongCollection Songs { get; }
}
Back to the table of contents
Background API: overview and BackgroundTask class
There are new background processing related featuresets in mango: Audio, scheduled tasks, background transfers and toasts. As you can see from the diagram above there’s a common base class BackgroundAgent used by the 2 music streaming background agents and the 1 scheduled task background agent. Note that background transfers doesn’t have it’s own publicly exposed background agent.
publicabstractclassBackgroundAgent
{
protectedinternal BackgroundAgent();
protectedvoid NotifyComplete();
protectedvoid Abort();
protectedinternalvirtualvoid OnCancel();
}
As with the rest of the featuresets we’ll be discussing in this article, we won’t review how to create a background agent. Read more on background agents on MSDN’s Background Agents for Windows Phone.
Back to the table of contents
Background API: Background Audio and streaming background Audio
As part of the new Mango featureset to support audio playback while apps are in the background there are 2 new background agents we can inherit from and implement. First is the AudioPlayerAgent that can be used for any media type Windows Phone can directly play from a Uri. The second background agent is AudioStreamingAgent for otherwise unsupported streaming media formats that need some pre-processing (such as shoutcast, icecast and RTSP) using a custom Silverlight MediaStreamSource.
publicclassAudioPlayerAgent : BackgroundAgent
{
protectedvirtualvoid OnUserAction(
BackgroundAudioPlayer player, AudioTrack track,
UserAction action, object param);
protectedvirtualvoid OnPlayStateChanged(BackgroundAudioPlayer player,
AudioTrack track, PlayState playState);
protectedvirtualvoid OnError(BackgroundAudioPlayer player, AudioTrack track,
Exception error, bool isFatal);
}
publicclassAudioStreamingAgent : BackgroundAgent
{
protectedvirtualvoid OnBeginStreaming(AudioTrack track, AudioStreamer streamer);
protectedinternaloverridevoid OnCancel();
}
As we can see both of these are based on having an AudioTrack instance that contains information on the currently playing audio.
publicclassAudioTrack : IEditableObject
{
public AudioTrack();
public AudioTrack(Uri source, string title, string artist, string album, Uri albumArt);
public AudioTrack(Uri source, string title, string artist, string album,
Uri albumArt, string tag, EnabledPlayerControls enabledControls);
publicvoid BeginEdit();
publicvoid CancelEdit();
publicvoid EndEdit();
public Uri Source { get; set; }
publicstring Title { get; set; }
publicstring Artist { get; set; }
publicstring Album { get; set; }
publicstring Tag { get; set; }
public Uri AlbumArt { get; set; }
public EnabledPlayerControls PlayerControls { get; set; }
publicTimeSpan Duration { get; }
}
[Flags]
publicenumEnabledPlayerControls : long
{
None = 0,
SkipNext = 1,
SkipPrevious = 2,
FastForward = 4,
Rewind = 8,
Pause = 16,
All = Pause | Rewind | FastForward | SkipPrevious | SkipNext,
}
The AudioPlayerAgent receives notifications whenever a user action happens (in the top media bar) and the playback status has changed.
publicenumPlayState
{
Unknown,
Stopped,
Paused,
Playing,
BufferingStarted,
BufferingStopped,
TrackReady,
TrackEnded,
Rewinding,
FastForwarding,
Shutdown,
Error,
}
publicenumUserAction
{
Stop = 1,
Pause = 2,
Play = 3,
SkipNext = 4,
SkipPrevious = 5,
FastForward = 6,
Rewind = 7,
Seek = 8,
}
Whenever the playstate changes or a user action has occurred, the background agent can respond interacting directly with audio playback through the BackgroundAudioPlayer.
publicsealedclassBackgroundAudioPlayer
{
publicvoid Play();
publicvoid Pause();
publicvoid Stop();
publicvoid FastForward();
publicvoid Rewind();
publicvoid SkipNext();
publicvoid SkipPrevious();
publicvoid Close();
publicstatic BackgroundAudioPlayer Instance { get; }
public PlayState PlayerState { get; }
public AudioTrack Track { get; set; }
publicTimeSpan Position { get; set; }
publicdouble BufferingProgress { get; }
publicbool CanPause { get; }
publicbool CanSeek { get; }
publicdouble Volume { get; set; }
publicException Error { get; }
publiceventEventHandler PlayStateChanged;
}
We previously mentioned there are two background audio agents. The first used for straight up Uri playback, and the other for custom MediaStreamSource playback. For the latter you’ll have to use an AudioStreamer in order to provide the MediaStreamSource.
publicsealedclassAudioStreamer
{
publicvoid SetSource(MediaStreamSource source);
}
For more information on how to implement mango background audio playback see MSDN’s Background Audio Overview for Windows Phone.
Back to the table of contents
Background API: Data Transfer APIs
As part of the mango featureset that allows apps to download and upload files while the app is in the background, developers can add new BackgroundTrasnferRequests to the BackgroundTransferService. The BackgroundTransferService will then schedule the download/upload transfers based on the overall transfer queue and network requirements.
publicstaticclassBackgroundTransferService
{
publicstatic BackgroundTransferRequest Find(string requestId);
publicstaticvoid Add(BackgroundTransferRequest request);
publicstaticvoid Remove(BackgroundTransferRequest request);
publicstaticIEnumerable<BackgroundTransferRequest> Requests { get; }
}
publicsealedclassBackgroundTransferRequest : IDisposable
{
public BackgroundTransferRequest(Uri requestUri);
public BackgroundTransferRequest(Uri requestUri, Uri downloadLocation);
publicvoid Dispose();
publicstring RequestId { get; }
public Uri RequestUri { get; }
publicstring Tag {get;set; }
public Uri DownloadLocation {get;set; }
public Uri UploadLocation {get;set; }
publicIDictionary<string, string> Headers { get; }
publicstring Method {get;set; }
public TransferPreferences TransferPreferences {get;set; }
public TransferStatus TransferStatus { get; }
publicException TransferError { get; }
publiclong TotalBytesToReceive { get; }
publiclong TotalBytesToSend { get; }
publiclong BytesReceived { get; }
publiclong BytesSent { get; }
publiclong StatusCode { get; }
publiceventEventHandler<BackgroundTransferEventArgs> TransferStatusChanged;
publiceventEventHandler<BackgroundTransferEventArgs> TransferProgressChanged;
}
publicenumTransferPreferences
{
None,
AllowCellular,
AllowBattery,
AllowCellularAndBattery,
}
By signing up to events on the BackgroundTransferRequest events it’s possible to receive notifications whenever the download/upload status changes and their respective status.
publicsealedclassBackgroundTransferEventArgs : EventArgs
{
public BackgroundTransferEventArgs(BackgroundTransferRequest request);
public BackgroundTransferRequest Request { get; }
}
publicenumTransferStatus
{
None,
Transferring,
Waiting,
WaitingForWiFi,
WaitingForExternalPower,
WaitingForExternalPowerDueToBatterySaverMode,
WaitingForNonVoiceBlockingNetwork,
Paused,
Completed,
Unknown,
}
publicsealedclassBackgroundTransferInternalException : SystemException
{
}
Back to the table of contents
Scheduling & Background API: Alarms, Reminders, Periodic Tasks and Resource Intensive Tasks
Using the new scheduling API it’s possible to add scheduled reminder, alarms and tasks. Using the ScheduledActionService we can add, retrieve and test any of the aforementioned tasks.
publicsealedclassScheduledActionService
{
publicstaticvoid Add(ScheduledAction action);
publicstatic ScheduledAction Find(string name);
publicstaticIEnumerable<T> GetActions<T>() where T : ScheduledAction;
publicstaticvoid Remove(string name);
publicstaticvoid Replace(ScheduledAction action);
publicstaticvoid LaunchForTest(string name, TimeSpan delay);
}
publicsealedclassSchedulerServiceException : SystemException
{
}
To add Alarms or Reminders simply instantiate those classes and add them to the ScheduleActionService. For more on this topic see MSDN’s Alarms and Reminders Overview for Windows Phone.
publicabstractclassScheduledNotification : ScheduledAction
{
publicvirtualstring Content { get; set; }
public RecurrenceInterval RecurrenceType { get; set; }
publicvirtualstring Title { get; set; }
}
publicenumRecurrenceInterval
{
None,
Daily,
Weekly,
Monthly,
EndOfMonth,
Yearly,
}
publicsealedclassAlarm : ScheduledNotification
{
public Alarm(string name);
public Uri Sound { get; set; }
publicoverridestring Title { get; set; }
}
publicsealedclassReminder : ScheduledNotification
{
public Reminder(string name);
public Uri NavigationUri { get; set; }
}
It’s also possible to create scheduled tasks where we can execute arbitrary code in a ScheduleTaskAgent.
publicabstractclassScheduledTaskAgent : BackgroundAgent
{
protectedinternalabstractvoid OnInvoke(ScheduledTask task);
[EditorBrowsable(EditorBrowsableState.Never)]
protectedinternaloverridesealedvoid OnCancel();
}
To schedule running a ScheduleTaskAgent use either a PeriodicTask or for more resource intensive tasks (execution time, WiFi-only, device lock, etc) use the ResourceIntensiveTask. Both inherit from ScheduledTask. For more on this topic and the distinction between resource intensive and non-resource intensive tasks see MSDN’s Background Agents Overview for Windows Phone.
public abstract class ScheduledTask : ScheduledAction
{
public override DateTime BeginTime { get; set; }
public override DateTime ExpirationTime { get; set; }
public string Description { get; set; }
public DateTime LastScheduledTime { get; internal set; }
public AgentExitReason LastExitReason { get; internal set; }
}
publicenumAgentExitReason
{
None,
Completed,
Aborted,
MemoryQuotaExceeded,
ExecutionTimeExceeded,
UnhandledException,
Terminated,
Other,
}
publicsealedclassPeriodicTask : ScheduledTask
{
public PeriodicTask(string name);
}
publicsealedclassResourceIntensiveTask : ScheduledTask
{
public ResourceIntensiveTask(string name);
}
Back to the table of contents
Background API: Programmatic Toast Notifications
Using the new ShellToast class it is possible for background agents to show a toast notification that’ll act as a deep link back to the application. It’s important to mention that this API will not work for in-app notifications, and will only show toast notifications when invoked from a background agent. For more on that see Den Delimarsky’s ShellToast on Windows Phone.
publicclassShellToast
{
publicvoid Show();
publicstring Title { get; set; }
publicstring Content { get; set; }
public Uri NavigationUri { get; set; }
}
Back to the table of contents
Appointments and Contacts API: Overview
Using the new PhoneDataSharingContext classes it’s possible to search for Appointments and Contacts on the phone, register for a search completed events and check the EventsArgs for the results. We can see the parallels between Appointments and Contacts from the class diagram above. Even though they are both independent they both share the same search-driven architecture. The resulting Contact and Appointment classes are very informative so we’ll address each in its own section in this article.
publicclassPhoneDataSharingContext
{
protected PhoneDataSharingContext(string baseUri);
protectedIEnumerable<T> ExecuteRequest<T>(string query);
protectedstring BaseUri { get; }
}
Both Appointments and Contacts’ search allow to filter based on user accounts with the relevant classes shown here:
publicsealedclassAccount
{
publicstring Name { get; internalset; }
public StorageKind Kind { get; internalset; }
}
publicenumStorageKind
{
Phone,
WindowsLive,
Outlook,
Facebook,
Other,
}
For more on how to access Appointments and Contacts see MSDN’s Contacts and Calendar for Windows Phone.
Back to the table of contents
Appointments
As we’ve previously mentioned access to Appointments starts of with searching for appointments, registering for the async results events and iterating over the EventArgs results.
publicsealedclassAppointments : PhoneDataSharingContext
{
publicconstint DefaultMaximumItems = 100;
publicvoid SearchAsync(DateTime startTimeInclusive, DateTime endTimeInclusive,
object state);
publicvoid SearchAsync(DateTime startTimeInclusive, DateTime endTimeInclusive,
int maximumItems, object state);
publicvoid SearchAsync(DateTime startTimeInclusive, DateTime endTimeInclusive,
Account account, object state);
publicvoid SearchAsync(DateTime startTimeInclusive, DateTime endTimeInclusive,
int maximumItems, Account account, object state);
publicIEnumerable<Account> Accounts { get; }
publiceventEventHandler<AppointmentsSearchEventArgs> SearchCompleted;
}
publicsealedclassAppointmentsSearchEventArgs : EventArgs
{
publicDateTime StartTimeInclusive { get; internalset; }
publicDateTime EndTimeInclusive { get; internalset; }
publicIEnumerable<Appointment> Results { get; internalset; }
publicobject State { get; internalset; }
}
The appointments themselves can be accessed after the search is complete.
publicsealedclassAppointment
{
publicstring Subject { get; internalset; }
publicstring Location { get; internalset; }
publicDateTime StartTime { get; internalset; }
publicDateTime EndTime { get; internalset; }
publicbool IsAllDayEvent { get; internalset; }
public AppointmentStatus Status { get; internalset; }
publicstring Details { get; internalset; }
public Attendee Organizer { get; internalset; }
publicIEnumerable<Attendee> Attendees { get; }
publicbool IsPrivate { get; internalset; }
public Account Account { get; internalset; }
}
publicenumAppointmentStatus
{
Free,
Tentative,
Busy,
OutOfOffice,
}
publicsealedclassAttendee
{
publicstring DisplayName { get; internalset; }
publicstring EmailAddress { get; internalset; }
}
Back to the table of contents
Contacts
Contacts use the same async search pattern used for appointments.
publicsealedclassContacts : PhoneDataSharingContext
{
publicvoid SearchAsync(string filter, FilterKind filterKind, object state);
publicIEnumerable<Account> Accounts { get; }
publiceventEventHandler<ContactsSearchEventArgs> SearchCompleted;
}
publicsealedclassContactsSearchEventArgs : EventArgs
{
public FilterKind FilterKind { get; internalset; }
publicstring Filter { get; internalset; }
publicIEnumerable<Contact> Results { get; internalset; }
publicobject State { get; internalset; }
}
When searching for contacts it’s possible to filter the search based on name, phone number, email address and whether the contact tile is pinned to the phone home screen.
publicenumFilterKind
{
None,
PinnedToStart,
EmailAddress,
PhoneNumber,
DisplayName,
}
The results of a search for contacts is the Contact class which references many additional supporting classes.
publicsealedclassContact
{
publicStream GetPicture();
publicstring DisplayName { get; internalset; }
public CompleteName CompleteName { get; internalset; }
publicIEnumerable<ContactPhoneNumber> PhoneNumbers { get; }
publicIEnumerable<ContactEmailAddress> EmailAddresses { get; }
publicIEnumerable<ContactAddress> Addresses { get; }
publicIEnumerable<ContactCompanyInformation> Companies { get; }
publicIEnumerable<string> Websites { get; }
publicIEnumerable<string> SignificantOthers { get; }
publicIEnumerable<string> Children { get; }
publicIEnumerable<string> Notes { get; }
publicIEnumerable<DateTime> Birthdays { get; }
publicbool IsPinnedToStart { get; internalset; }
publicIEnumerable<Account> Accounts { get; }
}
publicsealedclassCompleteName
{
publicstring FirstName { get; internalset; }
publicstring YomiFirstName { get; internalset; }
publicstring LastName { get; internalset; }
publicstring YomiLastName { get; internalset; }
publicstring MiddleName { get; internalset; }
publicstring Title { get; internalset; }
publicstring Nickname { get; internalset; }
publicstring Suffix { get; internalset; }
}
publicsealedclassContactPhoneNumber
{
publicstring PhoneNumber { get; internalset; }
public PhoneNumberKind Kind { get; internalset; }
publicIEnumerable<Account> Accounts { get; }
}
publicenumPhoneNumberKind
{
Mobile,
Home,
Work,
Company,
Pager,
HomeFax,
WorkFax,
}
publicsealedclassContactEmailAddress
{
publicstring EmailAddress { get; internalset; }
public EmailAddressKind Kind { get; internalset; }
publicIEnumerable<Account> Accounts { get; }
}
publicenumEmailAddressKind
{
Personal,
Work,
Other,
}
publicsealedclassContactAddress
{
public CivicAddress PhysicalAddress { get; internalset; }
public AddressKind Kind { get; internalset; }
publicIEnumerable<Account> Accounts { get; }
}
publicsealedclassContactCompanyInformation
{
publicstring CompanyName { get; internalset; }
publicstring YomiCompanyName { get; internalset; }
publicstring OfficeLocation { get; internalset; }
publicstring JobTitle { get; internalset; }
publicIEnumerable<Account> Accounts { get; }
}
Back to the table of contents
New Launchers and Choosers
There are 8 new Launchers & Choosers in Mango and we’ll review all of them in this section.
The ShareStatusTask and ShareLinkTask share content on social media accounts the user has previously linked to (facebook, twitter, windows live, etc). For more on how to use the sharing tasks see MSDN’s How to: Use the Share Status Task for Windows Phone and How to: Use the Share Link Task for Windows Phone.
publicabstractclassShareTaskBase
{
publicvoid Show();
}
publicsealedclassShareStatusTask : ShareTaskBase
{
publicstring Status { get; set; }
}
publicsealedclassShareLinkTask : ShareTaskBase
{
public Uri LinkUri { get; set; }
publicstring Title { get; set; }
publicstring Message { get; set; }
}
The ConnectionSettingsTask allows apps to launch into 4 settings screen on the phone: Airplane Mode, WiFi Settings, Bluetooth Settings and Cellular & Data settings. For a sample on how to use this task see MSDN’s How to: Use the Connection Settings Task for Windows Phone.
publicsealedclassConnectionSettingsTask
{
publicvoid Show();
public ConnectionSettingsType ConnectionSettingsType { get; set; }
}
publicenumConnectionSettingsType
{
WiFi,
Bluetooth,
Cellular,
AirplaneMode,
}
The BingMapsTask launches the map application with a specific latitude and longitude combination or just a search term. For instructions on how to use this task see MSDN’s How to: Use the Bing Maps Task for Windows Phone.
publicsealedclassBingMapsTask
{
publicvoid Show();
public GeoCoordinate Center { get; set; }
publicstring SearchTerm { get; set; }
publicdouble ZoomLevel { get; set; }
}
The BingMapsDirectionsTask launches the maps app with driving directions between two latitude and longitude coordinates. For instructions on how to use this task see MSDN’s How to: Use the Bing Maps Directions Task for Windows Phone.
publicsealedclassBingMapsDirectionsTask
{
publicvoid Show();
public LabeledMapLocation Start { get; set; }
public LabeledMapLocation End { get; set; }
}
publicsealedclassLabeledMapLocation
{
public LabeledMapLocation();
public LabeledMapLocation(string label, GeoCoordinate location);
publicstring Label { get; set; }
public GeoCoordinate Location { get; set; }
}
The GameInviteTask is an API that can only be used by previously approved Xbox Live titles (currently there are less than 100 of those) to start multiplayer gaming sessions. For more on this task see MSDN’s How to: Use the Game Invite Task for Windows Phone.
publicsealedclassGameInviteTask : ChooserBase<TaskEventArgs>
{
publicoverridevoid Show();
publicstring SessionId { get; set; }
}
The SaveRingtoneTask launches a save dialog for a new phone ringtone based on a Uri. Note that even though the Uri can point to any file Uri there are very specific requirements for the audio file that you’ll want to make sure your ringtone meets. For more information on this task and the aforementioned requirements see MSDN’s How to: Use the Save Ringtone Task for Windows Phone.
publicsealedclassSaveRingtoneTask : ChooserBase<TaskEventArgs>
{
publicoverridevoid Show();
public Uri Source { get; set; }
publicstring DisplayName { get; set; }
publicbool IsShareable { get; set; }
}
The AddressChooserTask allows the user to select an address from their contacts list. For more information on how to use this task see MSDN’s How to: Use the Address Chooser Task for Windows Phone.
publicsealedclassAddressChooserTask : ChooserBase<AddressResult>
{
publicoverridevoid Show();
}
publicsealedclassAddressResult : TaskEventArgs
{
public AddressResult();
public AddressResult(TaskResult taskResult);
publicstring Address { get; internalset; }
publicstring DisplayName { get; internalset; }
}
The SaveContactTask shows the user a pre-populated new contact dialogue and will return if the user actually created a new contact or not. For more on how to use this task see MSDN’s How to: Use the Save Contact Task for Windows Phone.
publicsealedclassSaveContactTask : ChooserBase<SaveContactResult>
{
publicoverridevoid Show();
publicstring FirstName { get; set; }
publicstring LastName { get; set; }
publicstring MiddleName { get; set; }
publicstring Nickname { get; set; }
publicstring Suffix { get; set; }
publicstring Company { get; set; }
publicstring Title { get; set; }
publicstring MobilePhone { get; set; }
publicstring HomePhone { get; set; }
publicstring WorkPhone { get; set; }
publicstring PersonalEmail { get; set; }
publicstring WorkEmail { get; set; }
publicstring OtherEmail { get; set; }
publicstring HomeAddressStreet { get; set; }
publicstring HomeAddressCity { get; set; }
publicstring HomeAddressState { get; set; }
publicstring HomeAddressZipCode { get; set; }
publicstring HomeAddressCountry { get; set; }
publicstring WorkAddressStreet { get; set; }
publicstring WorkAddressCity { get; set; }
publicstring WorkAddressState { get; set; }
publicstring WorkAddressZipCode { get; set; }
publicstring WorkAddressCountry { get; set; }
publicstring Website { get; set; }
publicstring Notes { get; set; }
publicstring JobTitle { get; set; }
}
publicclassSaveContactResult : TaskEventArgs
{
public SaveContactResult();
public SaveContactResult(TaskResult taskResult);
}
Changes and additions to existing Launchers and Choosers
With Mango a few of the existing Launchers and Choosers have received new features. We’ll review these changes in this section.
The MediaPlayerLauncher task can now specify the Orientation of the video player. When trying to playback videos recorded on mobile devices the new portrait setting would be extremely useful.
publicclassMediaPlayerLauncher
{
publicvoid Show();
public Uri Media { get; set; }
public MediaPlaybackControls Controls { get; set; }
public MediaLocationType Location { get; set; }
public MediaPlayerOrientation Orientation { get; set; }
}
publicenumMediaPlayerOrientation
{
Landscape,
Portrait,
}
The EmailComposeTask now allows develoepers to specify suggested BCC emails and the CodePage to be used in globalization scenarios.
publicsealedclassEmailComposeTask
{
publicvoid Show();
publicstring Body { get; set; }
publicstring Bcc { get; set; }
publicstring Cc { get; set; }
publicint? CodePage { get; set; }
publicstring Subject { get; set; }
publicstring To { get; set; }
}
The EmailResult class which is returned from the EmailAddressChooserTask now also contains a DisplayName and in addition to the email address chosen by the user.
publicclassEmailResult : TaskEventArgs
{
public EmailResult();
public EmailResult(TaskResult taskResult);
publicstring Email { get; internalset; }
publicstring DisplayName { get; internalset; }
}
The WebBrowserTask now uses a strongly-typed Uri type property instead of a loosely typed String Url property. For any apps upgraded to Mango that use WebBrowserTask there should be a build warning asking you to switch to the new task.
publicsealedclassWebBrowserTask
{
publicvoid Show();
[Obsolete("Please use Uri property")]
publicstring URL { get; set; }
public Uri Uri { get; set; }
}
Secondary Tiles and primary tile improvements
Using the new StandardTileData and adding those the ShellTile.Create() static method it is possible to add secondary tiles that deep link into application.
publicabstractclassShellTileData
{
publicstring Title { get; set; }
}
publicclassStandardTileData : ShellTileData
{
publicint? Count { get; set; }
public Uri BackgroundImage { get; set; }
publicstring BackContent { get; set; }
publicstring BackTitle { get; set; }
public Uri BackBackgroundImage { get; set; }
}
publicsealedclassShellTile
{
publicstaticvoid Create(Uri navigationUri, ShellTileData initialData);
publicvoid Update(ShellTileData data);
publicvoid Delete();
publicstaticstring ConvertToXMLFormat(string str);
public Uri NavigationUri { get; }
publicstaticIEnumerable<ShellTile> ActiveTiles { get; }
}
An interesting hidden feature of this API is that it allows to also modify the primary tile pinned to the phone home page. So if the application itself is pinned to the homepage it’ll be in the ShellTile.ActiveTiles. That’s extremely useful if you want to add a background image and text to the primary tile. More on that is available on Pavel Yosifovich’s blog post Dynamic Live Tiles in Windows Phone 7.
Another change introduced in Mango is adding an overload for ShellTileSchedule so it can work with secondary tiles. Using this new API it is possible to set an interval in which the secondary tile images are updated from a remote server.
publicclassShellTileSchedule
{
public ShellTileSchedule();
public ShellTileSchedule(ShellTile tileId);
publicvoid Start();
publicvoid Stop();
public UpdateRecurrence Recurrence { get; set; }
publicint MaxUpdateCount { get; set; }
publicDateTime StartTime { get; set; }
public UpdateInterval Interval { get; set; }
public Uri RemoteImageUri { get; set; }
}
For more on secondary tiles see MSDN’s Tiles for Windows Phone.
Back to the table of contents
Mixed XNA and Silverlight apps
With Mango we can now have apps that run both Silverlight content and XNA content. There are two core usecases for this API we need to think about: (1) Adding Silverlight Content (e.g. a menu system) to an XNA game (2) Adding XNA content (e.g. a 3d image) to a Silverlight app. Thinking about these 2 usecases makes it easier to understand the new API introduced for this featureset.
The first step in creating a mixed XNA and Silverlight app is to make sure that SharingMode=Truewhenever we have mixed content rendering on the screen.
publicstaticclassGraphicsDeviceExtensions
{
publicstaticvoid SetSharingMode(this GraphicsDevice device, bool enabled);
}
Use the UIElementRenderer to setup Silverlight elements to render in mixed mode.
publicclassUIElementRenderer : IDisposable
{
public UIElementRenderer(UIElement rootElement, int textureWidth, int textureHeight);
publicvoid Render();
protectedvirtualvoid Dispose(bool disposing);
publicvoid Dispose();
public UIElement Element { get; }
public Texture2D Texture { get; }
}
We would also have to invoke the UIElementRenderer.Render() within our game loop. Use the new GamerTimer timer for your game loop in mixed mode apps.
publicsealedclassGameTimer : IDisposable
{
publicstaticvoid SuppressFrame();
publicstaticvoid ResetElapsedTime();
publicvoid Start();
publicvoid Stop();
publicvoid Dispose();
publicint DrawOrder { get; set; }
publicint FrameActionOrder { get; set; }
publicTimeSpan UpdateInterval { get; set; }
publicint UpdateOrder { get; set; }
publiceventEventHandler<GameTimerEventArgs> Draw;
publiceventEventHandler<EventArgs> FrameAction;
publiceventEventHandler<GameTimerEventArgs> Update;
}
publicsealedclassGameTimerEventArgs : EventArgs
{
public GameTimerEventArgs();
public GameTimerEventArgs(TimeSpan totalTime, TimeSpan elapsedTime);
publicTimeSpan ElapsedTime { get; }
publicTimeSpan TotalTime { get; }
}
For XNA apps that use GraphicsDeviceManager they’ll need to switch over and use the new SharedGraphicsDeviceManager class.
publicclassSharedGraphicsDeviceManager : IGraphicsDeviceService,
IDisposable,
IApplicationService,
IApplicationLifetimeAware
{
publicstaticreadonlyint DefaultBackBufferHeight;
publicstaticreadonlyint DefaultBackBufferWidth;
publicvoid ApplyChanges();
voidIDisposable.Dispose();
void IApplicationService.StartService(ApplicationServiceContext context);
void IApplicationService.StopService();
void IApplicationLifetimeAware.Starting();
void IApplicationLifetimeAware.Started();
void IApplicationLifetimeAware.Exiting();
void IApplicationLifetimeAware.Exited();
publicstatic SharedGraphicsDeviceManager Current { get; }
public GraphicsDevice GraphicsDevice { get; }
public GraphicsProfile GraphicsProfile { get; set; }
publicint MultiSampleCount { get; set; }
public SurfaceFormat PreferredBackBufferFormat { get; set; }
publicint PreferredBackBufferHeight { get; set; }
publicint PreferredBackBufferWidth { get; set; }
public DepthFormat PreferredDepthStencilFormat { get; set; }
public PresentInterval PresentationInterval { get; set; }
public RenderTargetUsage RenderTargetUsage { get; set; }
publicbool SynchronizeWithVerticalRetrace { get; set; }
publiceventEventHandler<EventArgs> DeviceCreated;
publiceventEventHandler<EventArgs> DeviceDisposing;
publiceventEventHandler<EventArgs> DeviceReset;
publiceventEventHandler<EventArgs> DeviceResetting;
publiceventEventHandler<EventArgs> Disposed;
}
For more information on how to setup mixed XNA and Silverlight apps see AppHub’s guide for XNA devs using mixed mode apps, Peter Kuhn’s guide for Silverlight devs using mixed mode apps and AppHub’s sample Paddle Battle game.
Back to the table of contents
LINQ-to-SQL and Local Database
As part of Mango Linq-to-SQL running on SQL CE is now supported. Linq2SQL is huge and contains a lot of classes that are new to WP7. We can’t possibly cover all the API for those classes in this article so we’ll just see a huge class diagram and move on. For more information on the core Linq-to-SQL API see MSDN’s Local Database for Windows Phone.
There are however a few Linq-to-SQL APIs that are WP7 specific and we’ll cover those in a bit more depth. All these Linq2SQL WP7 specific APIs are part of the new Microsoft.Phone.Data.Linq and Microsoft.Phone.Data.Linq.Mapping namespaces.
The DatabaseSchemaUpdater is used to make sure that different versions of the application could upgrade the previously installed databases from older versions. When a database is first created it gets the DatabaseSchemaVersion of 0 or any other value you’d like to give it. It is then possible to use that version number to programmatically add database objects (tables, columns, etc) and update the schema version.
publicsealedclassDatabaseSchemaUpdater
{
publicvoid AddTable<T>();
publicvoid AddColumn<T>(string columnPropertyName);
publicvoid AddIndex<T>(string indexName);
publicvoid AddAssociation<T>(string associationPropertyName);
publicvoid Execute();
public DataContext Context { get; }
publicint DatabaseSchemaVersion { get; set; }
}
publicstaticclassExtensions
{
publicstatic DatabaseSchemaUpdater CreateDatabaseSchemaUpdater(
this DataContext dataContext);
}
The next part of WP7 specific Linq-to-SQL API is adding support for database Indexes which doesn’t exist in the desktop version of Linq-to-SQL. This is an important feature since there is no other way to execute DDL (i.e. “create index” statements) on the WP7 SQL CE database. If you expect a high volume of data in a SQL CE Table it’s best to optimize for query scenarios and index the “where” SQL SELECT query columns.
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
publicsealedclassIndexAttribute : Attribute
{
publicstring Name { get; set; }
publicbool IsUnique { get; set; }
publicstring Columns { get; set; }
}
publicabstractclassMetaIndex
{
publicabstractstring IndexName { get; }
publicabstractReadOnlyCollection<MetaIndexedColumn> Columns { get; }
publicabstractbool IsUnique { get; }
publicabstract MetaType DeclaringType { get; }
}
publicabstractclassMetaIndexedColumn
{
publicabstract MetaDataMember Column { get; }
publicabstract SortOrder SortOrder { get; }
}
publicenumSortOrder
{
Ascending,
Descending,
}
Search Extensibility
If your app has dynamic server data it’s a great idea to expose a few bing consumable XML files on the server that would deep link into your app from the WP7 search. There’s very little new API for the Mango feature that lets WP7 search deep link into apps. The client side changes involve adding the appropriate <Extension> tags to the WmAppManifest and <ExtensionInfo> tags to the Extras file.
Most of the work for this feature would have to happen on the server-side to expose XML files with the appropriate search data and deep links.
For more on this feature see MSDN’s Search Extensibility for Windows Phone.
Sockets: IP and DNS Addresses
Sockets are a pretty large API and most devs will only work with frameworks based on this API. For these reasons we’ll skip the C# definitions for classes in this namespace and instead focus on overall featuresets and class diagrams.
As Sockets are all about direct communication between WP7 and a remote machine DNS and IP addresses classes have been introduced to Mango.
Sockets: DNS Resolution
The DNS resolution API is WP7-specific and is used to convert from a DnsEndPoint (host name and port) to a more specific IPEndPoint that is used by Sockets.
Back to the table of contentsSockets: Socket class and SocketAsyncEventArgs
The Socket class is used to connect to an IPEndPoint and then send & receive SocketAsyncEventArgs from that Socket.
Sockets: UDP
As part of Silverlight 4 UDP support for single-source and multi-source communication has been added to WP7.
Back to the table of contents
Shell UI: New ProgressIndicator, and changes to ApplicationBar & SystemTray
There are parts of the application UI that are actually part of the OS shell. The top “SystemTray” and the bottom “ApplicationBar” are two such UI elements.
The ApplicationBar class has added support to show the ApplicationBar as collapsed (similar to how it’s shown in the Music & Video hub) and specify the height used for both the default and minimal mode.
publicsealedclassApplicationBar : IApplicationBar
{public ApplicationBar();
publicbool IsVisible { get; set; }
publicdouble Opacity { get; set; }
publicbool IsMenuEnabled { get; set; }
public Color BackgroundColor { get; set; }
public Color ForegroundColor { get; set; }
public ApplicationBarMode Mode { get; set; }
publicdouble DefaultSize { get; }
publicdouble MiniSize { get; }publicIList Buttons { get; }
publicIList MenuItems { get; }
publiceventEventHandler<ApplicationBarStateChangedEventArgs> StateChanged;
}
publicinterfaceIApplicationBar
{
bool IsVisible { get; set; }
double Opacity { get; set; }
bool IsMenuEnabled { get; set; }
Color BackgroundColor { get; set; }
Color ForegroundColor { get; set; }
ApplicationBarMode Mode { get; set; }
double DefaultSize { get; }
double MiniSize { get; }
IList Buttons { get; }
IList MenuItems { get; }
eventEventHandler<ApplicationBarStateChangedEventArgs> StateChanged;
}
publicenumApplicationBarMode
{
Default,
Minimized,
}
The SystemTray previously only had an IsVisible property to hide the top bar. The main reason why app developers hid the top bar in apps was due to a theme colour clash. So with Mango you can use your brand colours on the SystemTray by setting the new attached dependency properties. As a reminder a pattern of a static GetFoo, SetFoo and FooProperty members is an attached dependency property pattern.
publicclassSystemTray : DependencyObject
{
publicstaticreadonly DependencyProperty IsVisibleProperty;
publicstaticreadonly DependencyProperty OpacityProperty;
publicstaticreadonly DependencyProperty ForegroundColorProperty;
publicstaticreadonly DependencyProperty BackgroundColorProperty;
publicstaticreadonly DependencyProperty ProgressIndicatorProperty;
public SystemTray();
publicstaticvoid SetIsVisible(DependencyObject element, bool isVisible);
publicstaticbool GetIsVisible(DependencyObject element);
publicstaticvoid SetOpacity(DependencyObject element, double opacity);
publicstaticdouble GetOpacity(DependencyObject element);
publicstaticvoid SetForegroundColor(DependencyObject element, Color color);
publicstatic Color GetForegroundColor(DependencyObject element);
publicstaticvoid SetBackgroundColor(DependencyObject element, Color color);
publicstatic Color GetBackgroundColor(DependencyObject element);
publicstaticvoid SetProgressIndicator(DependencyObject element,
ProgressIndicator progressIndicator);
publicstatic ProgressIndicator GetProgressIndicator(DependencyObject element);
publicstaticbool IsVisible { get; set; }
publicstaticdouble Opacity { get; set; }
publicstatic Color ForegroundColor { get; set; }
publicstatic Color BackgroundColor { get; set; }
publicstatic ProgressIndicator ProgressIndicator { get; set; }
}
A SystemTray.ProgressBar can be set to show a unified WP7 UI for any in-app process progress taking place (e.g. web requests). An example of how to do so can be found on MSDN’s ProgressIndicator Class.
publicclassProgressIndicator : DependencyObject
{
publicstaticreadonly DependencyProperty IsVisibleProperty;
publicstaticreadonly DependencyProperty IsIndeterminateProperty;
publicstaticreadonly DependencyProperty TextProperty;
publicstaticreadonly DependencyProperty ValueProperty;
public ProgressIndicator();
publicbool IsVisible { get; set; }
publicbool IsIndeterminate { get; set; }
publicstring Text { get; set; }
publicdouble Value { get; set; }
}
Bing Maps changes: Random XAML elements positioning
With Mango the Bing Maps SDK has had only 1 change in it. Attached Dependency properties have been added to the MapPlayer class that allow to position random XAML elements in a latitude and longitude coordinate or relative to the rest of the map.
publicsealedclassMapLayer : MapLayerBase, IProjectable
{
publicstaticreadonly DependencyProperty PositionProperty;
publicstaticreadonly DependencyProperty PositionRectangleProperty;
publicstaticreadonly DependencyProperty PositionOriginProperty;
publicstaticreadonly DependencyProperty PositionOffsetProperty;
public MapLayer();
publicoverridevoid AddChild(UIElement element, GeoCoordinate location);
publicoverridevoid AddChild(UIElement element, GeoCoordinate location,
Point offset);
publicoverridevoid AddChild(UIElement element, GeoCoordinate location,
PositionOrigin origin);
publicoverridevoid AddChild(UIElement element, LocationRect locationRect);
publicstatic GeoCoordinate GetPosition(DependencyObject dependencyObject);
publicstaticvoid SetPosition(DependencyObject dependencyObject,
GeoCoordinate position);
publicstatic LocationRect GetPositionRectangle(
DependencyObject dependencyObject);
publicstaticvoid SetPositionRectangle(DependencyObject dependencyObject,
LocationRect rect);
publicstatic PositionOrigin GetPositionOrigin(
DependencyObject dependencyObject);
publicstaticvoid SetPositionOrigin(DependencyObject dependencyObject,
PositionOrigin origin);
publicstatic Point GetPositionOffset(DependencyObject dependencyObject);
publicstaticvoid SetPositionOffset(DependencyObject dependencyObject,
Point point);
publicvoid ProjectionUpdated(ProjectionUpdateLevel updateLevel);
public MapBase ParentMap { get; }
}
Removing Pages from the backstack frame journal
A common requirement in NoDo was to block the automatic frame navigation from navigating back into certain pages (e.g. splash page, registration page, etc). There are a few tricks in NoDo that allowed for a decent UX in the absence of any API for directly controlling the backstack. With Mango it is now possible to remove the last page from the back stack.
publicsealedclassNavigationService
{
publicbool Navigate(Uri source);
publicvoid GoForward();
publicvoid GoBack();
publicvoid StopLoading();
public JournalEntry RemoveBackEntry();
public Uri Source { get; set; }
public Uri CurrentSource { get; internalset; }
publicbool CanGoForward { get; }
publicbool CanGoBack { get; }
publicIEnumerable<JournalEntry> BackStack { get; }
publicevent NavigationFailedEventHandler NavigationFailed;
publicevent NavigatingCancelEventHandler Navigating;
publicevent NavigatedEventHandler Navigated;
publicevent NavigationStoppedEventHandler NavigationStopped;
publicevent FragmentNavigationEventHandler FragmentNavigation;
publiceventEventHandler<JournalEntryRemovedEventArgs> JournalEntryRemoved;
}
publicsealedclassJournalEntry : DependencyObject
{
public Uri Source { get; set; }
}
publicsealedclassJournalEntryRemovedEventArgs : EventArgs
{
public JournalEntry Entry { get; }
}
publicclassPhoneApplicationFrame : Frame
{
publicstaticreadonly DependencyProperty OrientationProperty;
public PhoneApplicationFrame();
public JournalEntry RemoveBackEntry();
public PageOrientation Orientation { get; internalset; }
publicIEnumerable<JournalEntry> BackStack { get; }
publiceventEventHandler<OrientationChangedEventArgs> OrientationChanged;
publiceventEventHandler<ObscuredEventArgs> Obscured;
publiceventEventHandler Unobscured;
publiceventEventHandler<CancelEventArgs> BackKeyPress;
publiceventEventHandler<JournalEntryRemovedEventArgs> JournalEntryRemoved;
}
Pages can respond to being removed from the back stack by overriding the new OnRemovedFromJournal method.
publicclassPhoneApplicationPage : Page
{
publicstaticreadonly DependencyProperty SupportedOrientationsProperty;
publicstaticreadonly DependencyProperty OrientationProperty;
publicstaticreadonly DependencyProperty ApplicationBarProperty;
public PhoneApplicationPage();
protectedvirtualvoid OnOrientationChanged(OrientationChangedEventArgs e);
protectedvirtualvoid OnBackKeyPress(CancelEventArgs e);
protectedvirtualvoid OnRemovedFromJournal(JournalEntryRemovedEventArgs e);
public SupportedPageOrientation SupportedOrientations { get; set; }
public PageOrientation Orientation { get; set; }
public IApplicationBar ApplicationBar { get; set; }
publicIDictionary<string, object> State { get; }
publiceventEventHandler<OrientationChangedEventArgs> BeginLayoutChanged;
publiceventEventHandler<OrientationChangedEventArgs> OrientationChanged;
publiceventEventHandler<CancelEventArgs> BackKeyPress;
}
Device Information and Network Information
The new DeviceStatus class has strongly-typed properties that can be used to replace the older DeviceExtendedProperties and it also has previously unavailable device information properties.
publicstaticclassDeviceStatus
{
publicstaticbool IsKeyboardDeployed { get; }
publicstaticbool IsKeyboardPresent { get; }
publicstatic PowerSource PowerSource { get; }
publicstaticlong ApplicationCurrentMemoryUsage { get; }
publicstaticlong ApplicationPeakMemoryUsage { get; }
publicstaticlong ApplicationMemoryUsageLimit { get; }
publicstaticlong DeviceTotalMemory { get; }
publicstaticstring DeviceName { get; }
publicstaticstring DeviceFirmwareVersion { get; }
publicstaticstring DeviceHardwareVersion { get; }
publicstaticstring DeviceManufacturer { get; }
publicstaticeventEventHandler KeyboardDeployedChanged;
publicstaticeventEventHandler PowerSourceChanged;
}
publicenumPowerSource
{
Battery,
External,
}
The new DeviceNetworkInformation class exposes information about the network status of the mobile device.
publicstaticclassDeviceNetworkInformation
{
publicstaticvoid ResolveHostNameAsync(
DnsEndPoint endPoint, NetworkInterfaceInfo networkInterface,
NameResolutionCallback callback, object context);
publicstaticvoid ResolveHostNameAsync(DnsEndPoint endPoint,
NameResolutionCallback callback, object context);
publicstaticbool IsCellularDataRoamingEnabled { get; }
publicstaticbool IsWiFiEnabled { get; }
publicstaticbool IsCellularDataEnabled { get; }
publicstaticstring CellularMobileOperator { get; }
publicstaticbool IsNetworkAvailable { get; }
publicstaticeventEventHandler<NetworkNotificationEventArgs>
NetworkAvailabilityChanged;
}
publicsealedclassNetworkNotificationEventArgs : EventArgs
{
public NetworkNotificationType NotificationType { get; }
public NetworkInterfaceInfo NetworkInterface { get; }
}
The new MediaCapabilities exposes information on whether or not smooth adaptive video streaming is supported on the current device or not.
publicstaticclassMediaCapabilities
{
publicstaticbool IsMultiResolutionVideoSupported { get; }
}
WebBrowser control changes: HTML5 GeoLocation and NavigationFailed event
The WebBrowser control in Mango supports HTML5 GeoLocation after setting IsGeolocationEnabled=True. It also has a new NavigationFailed event.
publicsealedclassWebBrowser : Control
{
publicstaticreadonly DependencyProperty SourceProperty;
publicstaticreadonly DependencyProperty BaseProperty;
publicstaticreadonly DependencyProperty IsScriptEnabledProperty;
publicstaticreadonly DependencyProperty IsGeolocationEnabledProperty;
public WebBrowser();
publicoverridevoid OnApplyTemplate();
publicvoid Navigate(Uri uri);
publicvoid Navigate(Uri uri, byte[] postData, string additionalHeaders);
publicvoid NavigateToString(string html);
publicobject InvokeScript(string scriptName, paramsstring[] args);
publicobject InvokeScript(string scriptName);
publicstring SaveToString();
public Uri Source { get; set; }
publicstring Base { get; set; }
publicbool IsScriptEnabled { get; set; }
publicbool IsGeolocationEnabled { get; set; }
publiceventEventHandler<NavigatingEventArgs> Navigating;
publiceventEventHandler<NavigationEventArgs> Navigated;
publicevent LoadCompletedEventHandler LoadCompleted;
publicevent NavigationFailedEventHandler NavigationFailed;
publiceventEventHandler<NotifyEventArgs> ScriptNotify;
}
Network Request Preference and Requirements
The new WebRequestExtensions and SocketExtensions classes define extension methods that can be used to associate a specific network interface (e.g. 3G vs. WiFi) with specific network requests.
publicstaticclassWebRequestExtensions
{
publicstaticvoid SetNetworkPreference(this WebRequest request,
NetworkSelectionCharacteristics preference);
publicstaticvoid SetNetworkRequirement(this WebRequest request,
NetworkSelectionCharacteristics requirement);
publicstatic NetworkInterfaceInfo GetCurrentNetworkInterface(
this WebRequest request);
}
publicstaticclassSocketExtensions
{
publicstaticvoid SetNetworkPreference(this Socket socket,
NetworkSelectionCharacteristics preference);
publicstaticvoid SetNetworkRequirement(this Socket socket,
NetworkSelectionCharacteristics requirement);
publicstatic NetworkInterfaceInfo GetCurrentNetworkInterface(
this Socket socket);
publicstaticvoid AssociateToNetworkInterface(this Socket socket,
NetworkInterfaceInfo networkInterface);
}
Xbox Live: Render Xbox Live Avatars in XNA
With the introduction of Microsoft.Xna.Framework.Avatar assembly it is now possible for Xbox Live Titles to render Xbox Live Avatars using the new AvatarRenderer class. Note, only Xbox Live Titles can use this functionality. Because of that limited subset of apps that have access to this functionality and because of the sheer size of the new assembly we’ll only briefly glance at a class diagram and move on.
Xbox Live: Avatar Assets
Xbox Live-titles (and only xbox live titles) can now take advantage of the new SignedInGamerExtensions and award assets to Xbox Live Avatars. Again, this feature is only available for Xbox-Live titles.
publicstaticclassSignedInGamerExtensions
{
publicstaticIAsyncResult BeginAwardAvatarAssets(this SignedInGamer gamer,
string[] assetKeys, AsyncCallback callback, object state);
publicstaticvoid EndAwardAvatarAssets(this SignedInGamer gamer,
IAsyncResult result);
publicstaticvoid AwardAvatarAssets(this SignedInGamer gamer,
string[] assetKeys);
}
Custom Linq Providers
A core piece of LINQ that has been missing from NoDo was the ability to create custom Linq Providers. With Mango the IQueryProvider and IQueryable interfaces have been added. With the new support for custom LINQ providers it is now possible to use one of the many open source LINQ providers. for more on implementing a custom LINQ provider and the importance of IQueryProvider see Matt Warren’s LINQ: Building an IQueryable Provider.
publicinterfaceIQueryProvider
{
IQueryable CreateQuery(Expression expression);
IQueryable<TElement> CreateQuery<TElement>(Expression expression);
object Execute(Expression expression);
TResult Execute<TResult>(Expression expression);
}
publicinterfaceIQueryable : IEnumerable
{
Expression Expression { get; }
Type ElementType { get; }
IQueryProvider Provider { get; }
}
The additional classes of EnurableQuery, EnurableQuery<T>, EnurableExecutor, EnumrableExecutor<T> and Queryable are all helper classes used when implementing a custom LINQ provider. We won’t expend on them further in this blog post.
Dynamically compiled Lambda Expressions and Reflection.Emit
A small chunk of Refleciton.Emit has been added to Mango in order to enable the Expression.Compile() method. Using Expression.Compile() it is possible to build at runtime an expression tree, compile it and then execute it. All at runtime. We’ll only examine the change to LambdaExpression in greater detail. For more information on this topic see MSDN’s Expression(TDelegate).Compile Method.
publicclassLambdaExpression : Expression
{
publicDelegate Compile();
public Expression Body { get; }
publicReadOnlyCollection<ParameterExpression> Parameters { get; }
}
mscorib.Extensions: SIMD/ARM-NEON XNA support
Mango allows to accelerate calculation operations on SIMD/ARM-NEON capable devices. Which means that XNA calculations on Vector, Matrix and other types would be somewhat faster. To take advantage of this new feature apply the attribute wit he SIMD flag on the relevant assemblies. For more on this see Enable SIMD support in Mango.
[AttributeUsage(AttributeTargets.Assembly)]
publicsealedclassCodeGenerationAttribute : Attribute
{
public CodeGenerationAttribute(CodeGenerationFlags flags);
publicint CodeGenerationFlags { get; }
}
[Flags]
publicenumCodeGenerationFlags
{
EnableFPIntrinsicsUsingSIMD = 1,
}
mscorlib.Extensions: Mutex
A trimmed down version of Mutex wait handle class has been added to Mango.
publicsealedclassMutex : WaitHandle
{
public Mutex(bool initiallyOwned, string name);
publicvoid ReleaseMutex();
publicoverridebool WaitOne();
publicoverridebool WaitOne(int millisecondsTimeout);
}
mscorlib.Extensions: INotifyPropertyChanging
The INotifyProperyChanging interface has been added as part of Mango. This API is the counterpart for the existing INotifyPropertyChanged interface. Currently the only feature using this new interface is Linq-to-SQL, but we could definitely take advantage of it for other 3rd party usages. For more on that see Claus Konrad’s WP7/7.1: Where is INotifiyPropertyChanging defined?.
publicinterfaceINotifyPropertyChanging
{
event PropertyChangingEventHandler PropertyChanging;
}
publicdelegatevoid PropertyChangingEventHandler(object sender,
PropertyChangingEventArgs e);
publicclassPropertyChangingEventArgs : EventArgs
{
public PropertyChangingEventArgs(string propertyName);
publicvirtualstring PropertyName { get; }
}
mscorlib.Extensions: RSA Cryptography
With Mango the RsaCryptoServiceProvider has been added to enable asymmetric encryption and decryption. For more information on how to use RsaCryptoServiceProvider with a custom server backend see Dustin Horne’s Asymmetric Encryption and Signing with RSA in Silverlight.
Back to the table of contents
Silverlight 4: Base-Class Library changes in mscorlib assembly
WP7 NoDo was based on Silverlight 3. With the release Mango all the changes done in Silverlight 4 were migrated back to WP7. Most of the changes are in the System.Windows assembly (Silverlight) and the majority of other changes are in the mscorlib BCL (base class library) assembly. All the changes made in Silverlight 4 to the BCL were additions of new members to existing classes. The one exception to that is the removal of the TaiwanCalender class from Mango. The class diagram and code snippets below contain only the new members added to the BCL in Mango.
publicsealedclassAppDomain
{
publicAssembly[] GetAssemblies();
}
publicstaticclassBitConverter
{
publicstaticInt64 DoubleToInt64Bits(Double value);
publicstaticDouble Int64BitsToDouble(Int64 value);
}
publicstaticclassGC
{
publicstaticInt32 MaxGeneration { get; }
}
publicsealedclassGuid
{
publicstaticGuid Parse(String input);
publicstaticGuid ParseExact(String input, String format);
publicstaticBoolean TryParse(String input, outGuid result);
publicstaticBoolean TryParseExact(String input, String format, outGuid result);
}
publicsealedclassString
{
publicstaticString Concat(IEnumerable<String> values);
publicstaticString Concat<T>(IEnumerable<T> values);
publicstaticBoolean IsNullOrWhiteSpace(String value);
publicstaticString Join(String separator, IEnumerable<String> values);
publicstaticString Join<T>(String separator, IEnumerable<T> values);
publicstaticString Join(String separator, paramsObject[] values);
}
publicsealedclassTimeSpan
{
publicString ToString(String format);
publicString ToString(String format, IFormatProvider formatProvider);
publicstaticTimeSpan Parse(String input, IFormatProvider formatProvider);
publicstaticTimeSpan ParseExact(String input, String[] formats,
IFormatProvider formatProvider);
publicstaticTimeSpan ParseExact(String input, String format,
IFormatProvider formatProvider);
publicstaticTimeSpan ParseExact(String input, String format,
IFormatProvider formatProvider, TimeSpanStyles styles);
publicstaticTimeSpan ParseExact(String input, String[] formats,
IFormatProvider formatProvider, TimeSpanStyles styles);
publicstaticBoolean TryParse(String input,
IFormatProvider formatProvider, outTimeSpan result);
publicstaticBoolean TryParseExact(String input, String format,
IFormatProvider formatProvider, outTimeSpan result);
publicstaticBoolean TryParseExact(String input, String[] formats,
IFormatProvider formatProvider, outTimeSpan result);
publicstaticBoolean TryParseExact(String input, String format,
IFormatProvider formatProvider, TimeSpanStyles styles, outTimeSpan result);
publicstaticBoolean TryParseExact(String input, String[] formats,
IFormatProvider formatProvider, TimeSpanStyles styles, outTimeSpan result);
}
publicabstractclassType
{
publicBoolean IsNested { get; }
}
publicsealedclassVersion
{
publicstaticVersion Parse(String input);
publicstaticBoolean TryParse(String input, outVersion result);
}
publicinterfaceISymbolDocumentWriter
{
void SetCheckSum(Guid algorithmId, Byte[] checkSum);
void SetSource(Byte[] source);
}
[FlagsAttribute]
publicenumTimeSpanStyles
{
None,
AssumeNegative
}
publicclassFileStream : Stream, IDisposable
{
publicvirtualvoid Flush(Boolean flushToDisk);
}
publicabstractclassStream : IDisposable
{
publicvoid CopyTo(Stream destination);
publicvoid CopyTo(Stream destination, Int32 bufferSize);
}
publicsealedclassIsolatedStorageFile : IDisposable
{
publicvoid CopyFile(String sourceFileName, String destinationFileName);
publicvoid CopyFile(String sourceFileName, String destinationFileName,
Boolean overwrite);
publicDateTimeOffset GetCreationTime(String path);
publicDateTimeOffset GetLastAccessTime(String path);
publicDateTimeOffset GetLastWriteTime(String path);
publicvoid MoveDirectory(String sourceDirectoryName,
String destinationDirectoryName);
publicvoid MoveFile(String sourceFileName, String destinationFileName);
}
publicclassIsolatedStorageFileStream : FileStream
{
publicoverridevoid Flush(Boolean flushToDisk);
}
publicsealedclassStringBuilder
{
publicStringBuilder Clear();
}
publicstaticclassInterlocked
{
publicstaticObject CompareExchange(refObject location1, Object value,
Object comparand);
}
publicstaticclassMonitor
{
publicstaticvoid Enter(Object obj, refBoolean lockTaken);
publicstaticvoid TryEnter(Object obj, refBoolean lockTaken);
publicstaticvoid TryEnter(Object obj, TimeSpan timeout, refBoolean lockTaken);
publicstaticvoid TryEnter(Object obj, Int32 millisecondsTimeout,
refBoolean lockTaken);
}
Back to the table of contents
Silverlight 4: System.Windows Silverlight changes
Silverlight 4 is it’s own product release and quite an extensive one at that. We’ll briefly cover the new API added to the System.Windows assembly as part of the Mango upgrade to Silverlight 4. For those of you interested in more details on Silverlight 4 changes from Silverlight 3 see Tim Heuer’s Silverlight 4 Beta – A guide to the new features. Please note, the API we’ll see in this section is the API that was added in Mango and not all the API in these classes.
In the System.Collections.ObjectModel namespace we’ve got new constructors for the ObservableCollection class that allow to easy convert a standard List<T> to an ObservableCollection<T>.
publicclassObservableCollection<T>
{
publicObservableCollection<T>(List list);
publicObservableCollection<T>(IEnumerable collection);
}
In the System.ComponentModel namespace we’ve got a few new APIs for databinding and some additions to design-time.
publicsealedclassAlternateContentPropertyAttribute : Attribute
{
public AlternateContentPropertyAttribute();
}
publicsealedclassDataErrorsChangedEventArgs : EventArgs
{
public DataErrorsChangedEventArgs(String propertyName);
publicString PropertyName { get; }
}
publicstaticclassDesignerProperties
{
publicstaticBoolean RefreshOnlyXmlnsDefinitionsOnAssemblyReplace
{
get;
}
}
publicinterfaceICollectionViewFactory
{
ICollectionView CreateView();
}
publicinterfaceIDataErrorInfo
{
String Error { get; }
Stringthis[String columnName] { get; }
}
publicinterfaceIEditableCollectionView
{
Boolean CanAddNew { get; }
Boolean CanCancelEdit { get; }
Boolean CanRemove { get; }
Boolean IsAddingNew { get; }
Boolean IsEditingItem { get; }
NewItemPlaceholderPosition NewItemPlaceholderPosition { get; set; }
Object CurrentAddItem { get; }
Object CurrentEditItem { get; }
Object AddNew();
void CancelEdit();
void CancelNew();
void CommitEdit();
void CommitNew();
void EditItem(Object item);
void Remove(Object item);
void RemoveAt(Int32 index);
}
publicinterfaceINotifyDataErrorInfo
{
Boolean HasErrors { get; }
IEnumerable GetErrors(String propertyName);
eventEventHandler ErrorsChanged;
}
publicinterfaceISupportInitialize
{
void BeginInit();
void EndInit();
}
publicenumNewItemPlaceholderPosition
{
None,
AtEnd
}
There are quite a bit of peer automation related changes in the System.Windows.Automation.* namespaces, but since Automation Peers are not supported on WP7 there’s no point in going over those in any great detail.
In the System.Windows namespace we have a few changes: Support for the new Tap & Hold & DoubleTap events, programmatic control of the Clipboard, Right-To-Left support and a few others. There are also a few “junk” changes to support features that aren’t supported in Mango and we won’t review those here.
publicstaticclassClipboard {
publicstaticBoolean ContainsText();
publicstaticString GetText();
publicstaticvoid SetText(String text);
}
publicclassDependencyObjectCollection<T>
{
publicvirtualsealedInt32 IndexOf(T item);
publicvirtualsealedvoid Insert(Int32 index, T item);
publiceventNotifyCollectionChangedEventHandler CollectionChanged;
}
publicenumFlowDirection {
LeftToRight,
RightToLeft
}
publicabstractclassFrameworkElement : UIElement {
publicFlowDirection FlowDirection { get; set; }
publicstaticreadonlyDependencyProperty FlowDirectionProperty;
}
publicabstractclassUIElement : DependencyObject
{
publiceventEventHandler DoubleTap;
publiceventEventHandler Hold;
publiceventEventHandler Tap;
publiceventTextCompositionEventHandler TextInput;
publiceventTextCompositionEventHandler TextInputStart;
publiceventTextCompositionEventHandler TextInputUpdate;
publicstaticreadonlyDependencyProperty AllowDropProperty;
publicstaticreadonlyRoutedEvent DoubleTapEvent;
publicstaticreadonlyRoutedEvent HoldEvent;
publicstaticreadonlyRoutedEvent TapEvent;
publicstaticreadonlyRoutedEvent TextInputEvent;
publicstaticreadonlyRoutedEvent TextInputStartEvent;
publicstaticreadonlyRoutedEvent TextInputUpdateEvent;
}
publicsealedclassVisualStateGroup : DependencyObject
{
publicVisualState CurrentState { get; }
}
The System.Windows.Controls and System.Windows.Controls.Primitives namespace has a few changes in it: The new ViewBox control, addition of ellipsis (“…”) text trimming to TextBlock, MVVM Button Commanding support, Video playback MediaElement timed markers and a few other features. The really interesting changes here is the introduction of a WP7 API for ScrollViewer.ManipulationMode for fine-tuned scrolling support on the phone. The ScrollViewer additions are exclusive to WP7 Mango.
publicclassListBox
{
publicvoid SelectAll();
}
publicsealedclassMediaElement : FrameworkElement
{
publicTimelineMarkerCollection Markers { get; }
publiceventTimelineMarkerRoutedEventHandler MarkerReached;
}
publicsealedclassPasswordBox : Control
{
publicDouble BaselineOffset { get; }
}
publicsealedclassScrollViewer : ContentControl
{
publicManipulationMode ManipulationMode { get; set; }
publicstaticManipulationMode GetManipulationMode(DependencyObject element);
publicstaticvoid SetManipulationMode(DependencyObject element,
ManipulationMode manipulationMode);
publicstaticreadonlyDependencyProperty ManipulationModeProperty;
}
publicenumManipulationMode
{
Control,
System
}
publicsealedclassTextBlock
{
publicDouble BaselineOffset { get; }
publicTextTrimming TextTrimming { get; set; }
publicstaticreadonlyDependencyProperty TextTrimmingProperty;
}
publicclassTextBox : Control
{
publicDouble BaselineOffset { get; }
}
publicsealedclassViewbox : FrameworkElement
{
public Viewbox();
publicStretch Stretch { get; set; }
publicStretchDirection StretchDirection { get; set; }
publicUIElement Child { get; set; }
publicstaticreadonlyDependencyProperty StretchDirectionProperty;
publicstaticreadonlyDependencyProperty StretchProperty;
}
publicenumStretchDirection
{
UpOnly,
DownOnly,
Both
}
In System.Windows.Documents a new RichTextBox control and many supporting classes have been added. We won’t review this control and it’s associated classes in-depth. For more information on this control see MSDN’s RichTextBox Overview.
In System.Windows.Data namespace there’s really one thing we care about: The addition of 5 new properties to the {Binding} syntax. There’s also a few other “junk” changes that aren’t applicable for WP7. which we won’t review here.
publicclassBinding : BindingBase
{
publicBoolean ValidatesOnDataErrors { get; set; }
publicBoolean ValidatesOnNotifyDataErrors { get; set; }
}
publicabstractclassBindingBase
{
publicObject FallbackValue { get; set; }
publicObject TargetNullValue { get; set; }
publicString StringFormat { get; set; }
}
A big part of the changes done in System.Windows.Media namespace is around the introduction of VideoSink and AudioSink. In WP7 these provide access to the Microphone and Camera which are available through more phone specific APIs so it’s best to avoid these if possible.
There are few interesting changes in the System.Windows.Media namespace: support for Playready DRM DomainAcquirer, support for RichTextBox support for all fonts, The VideoBrush and a VisualTreeHelper.GetOpenPopups() method.
publicclassDomainAcquirer
{
public DomainAcquirer();
publicString ChallengeCustomData { get; set; }
[SecuritySafeCriticalAttribute]
publicvoid CancelAsync();
publicvoid JoinDomainAsync(Guid serviceId, Guid accountId, Uri domainServerUrl,
String friendlyName);
publicvoid LeaveDomainAsync(Guid serviceId, Guid accountId, Uri domainServerUrl);
publiceventEventHandler JoinDomainCompleted;
publiceventEventHandler LeaveDomainCompleted;
protectedvirtualvoid OnCancel();
protectedvirtualvoid OnJoinDomain(Stream joinChallenge, Uri domainServerUri);
protectedvirtualvoid OnLeaveDomain(Stream leaveChallenge, Uri domainServerUri);
protectedvoid SetJoinDomainResponse(Stream domainResponse);
protectedvoid SetLeaveDomainResponse(Stream domainResponse);
}
publicclassDomainOperationCompletedEventArgs : AsyncCompletedEventArgs
{
publicGuid AccountId { get; }
publicGuid ServiceId { get; }
publicString ResponseCustomData { get; }
}
publicstaticclassFonts
{
publicstaticICollection SystemTypefaces { get; }
}
publicclassTypeface
{
publicBoolean TryGetGlyphTypeface(outGlyphTypeface glyphTypeface);
}
publicsealedclassGlyphTypeface
{
publicDouble Version { get; }
publicString FontFileName { get; }
}
publicsealedclassVideoBrush : TileBrush
{
public VideoBrush();
publicString SourceName { get; set; }
publicvoid SetSource(CaptureSource source);
publicvoid SetSource(MediaElement source);
publicstaticreadonlyDependencyProperty SourceNameProperty;
}
publicstaticclassVisualTreeHelper
{
publicstaticIEnumerable GetOpenPopups();
}
The System.Windows.Input namespace has a few interesting additions as-well: 2 new input scopes have been added, fine-grained control of IME (use of Latin keyboards for Asian languages input) and a few other changes.
publicsealedclassGestureEventArgs : RoutedEventArgs
{
public GestureEventArgs();
publicBoolean Handled { get; set; }
publicPoint GetPosition(UIElement relativeTo);
}
publicenumImeConversionModeValues
{
Alphanumeric,
Native,
Katakana,
FullShape,
Roman,
CharCode,
NoConversion,
Eudc,
Symbol,
Fixed,
DoNotCare
}
publicsealedclassInputMethod : DependencyObject
{
publicstaticImeConversionModeValues GetPreferredImeConversionMode(
DependencyObject target);
publicstaticInputMethodState GetPreferredImeState(
DependencyObject target);
publicstaticvoid SetPreferredImeConversionMode(
DependencyObject target, ImeConversionModeValues value);
publicstaticvoid SetPreferredImeState(
DependencyObject target, InputMethodState value);
}
publicenumInputMethodState
{
Off,
On,
DoNotCare
}
publicenumInputScopeNameValue
{
NumericPassword,
Formula
}
Feedback? Leave a comment!
Feedback? Thoughts? Suggestions? Sound off in the comments!
Sincerely,
-- Justin Angel, Principal Engineer @ Nokia WP7