×
Create a new article
Write your page title here:
We currently have 240 articles on Open Eggbert. Type your article name above or click on one of the titles below and start writing!



Open Eggbert
240Articles

Windows Phone namespaces: Difference between revisions

No edit summary
No edit summary
Line 48: Line 48:
----
----


=== '''Microsoft.Phone.Controls''' ===
== Microsoft.Phone.Controls ==
Provides controls specific to Windows Phone, such as:
Provides controls specific to Windows Phone, such as:


Line 57: Line 57:
----
----


=== '''Microsoft.Phone.Tasks''' ===
== Microsoft.Phone.Tasks ==
Used to perform integrated system tasks, such as:
Used to perform integrated system tasks, such as:


Line 67: Line 67:
----
----


=== '''Microsoft.Phone.Shell''' ===
== Microsoft.Phone.Shell ==
Provides access to user interface features, such as:
Provides access to user interface features, such as:


Line 75: Line 75:
----
----


=== '''Microsoft.Xna.Framework''' ===
== Microsoft.Xna.Framework ==
Used for games and graphic applications. Contains classes for working with:
Used for games and graphic applications. Contains classes for working with:


Line 85: Line 85:
----
----


=== '''Microsoft.Phone.Info''' ===
== Microsoft.Phone.Info ==
Provides device information, such as:
Provides device information, such as:


Line 93: Line 93:
----
----


=== '''Microsoft.Devices''' ===
== Microsoft.Devices ==
Works with device hardware, including:
Works with device hardware, including:


Line 101: Line 101:
----
----


=== '''Microsoft.Phone.Media''' ===
== Microsoft.Phone.Media ==
Used for working with multimedia:
Used for working with multimedia:


Line 109: Line 109:
----
----


=== '''Microsoft.Phone.Reactive''' ===
== Microsoft.Phone.Reactive ==
Provides a subset of reactive programming (Reactive Extensions) for asynchronous operations in applications.
Provides a subset of reactive programming (Reactive Extensions) for asynchronous operations in applications.
----
----


=== '''System.Device.Location''' ===
== System.Device.Location ==
Works with geolocation:
Works with geolocation:


Line 121: Line 121:
----
----


=== '''Microsoft.Phone.Maps.Controls''' ===
== Microsoft.Phone.Maps.Controls ==
Used to implement map features:
Used to implement map features:


Line 129: Line 129:
----
----


=== '''Microsoft.Advertising.Mobile.UI''' ===
== Microsoft.Advertising.Mobile.UI ==
Used for integrating ads into apps through the '''Microsoft Advertising SDK'''.
Used for integrating ads into apps through the '''Microsoft Advertising SDK'''.
----
----


=== '''System.Windows.Controls''' ===
== System'''.Windows.Controls''' ==
Contains basic controls for the user interface, such as:
Contains basic controls for the user interface, such as:


Line 142: Line 142:
----
----


=== '''System.Windows.Media''' ===
== System.Windows.Media ==
API for working with multimedia, such as graphics, animations, and sound.
API for working with multimedia, such as graphics, animations, and sound.
----
----


=== '''Microsoft.Phone.Notification''' ===
== Microsoft.Phone.Notification ==
Used for working with '''Push Notification Services (PNS)''' for real-time notifications.
Used for working with '''Push Notification Services (PNS)''' for real-time notifications.
----
----


=== '''System.IO.IsolatedStorage''' ===
== System.IO.IsolatedStorage ==
Used to store application data locally on the device. It contains classes for working with '''Isolated Storage''', which is a sandboxed area for the app.
Used to store application data locally on the device. It contains classes for working with '''Isolated Storage''', which is a sandboxed area for the app.
----If you are working with Windows Phone, it is recommended to consult the documentation for the specific SDK version, as some namespaces and APIs were only available in certain versions.
----If you are working with Windows Phone, it is recommended to consult the documentation for the specific SDK version, as some namespaces and APIs were only available in certain versions.

Revision as of 18:48, 19 January 2025

Microsoft.Devices.Sensors

Microsoft.Devices.Sensors is a namespace in the Windows Phone platform that provides an API for accessing device sensors. This namespace was primarily designed for developing applications for the Windows Phone 7.x and 8.x operating systems.

Functions of Microsoft.Devices.Sensors

The API allows developers to access various sensors on a mobile device, such as:

  1. Accelerometer:
    • Measures the acceleration of the device along all three axes (X, Y, Z).
    • Can be used for detecting device orientation, motion gestures, or game development.
  2. Gyroscope:
    • Measures angular velocity (device rotation around the X, Y, and Z axes).
    • Used for more precise rotation detection, such as in navigation or gaming.
  3. Compass (Magnetometer):
    • Detects the Earth's magnetic field and can determine the device's direction relative to the north.
    • Used in map creation or augmented reality (AR) applications.
  4. Acceleration and Motion Data:
    • A combination of sensors providing complex data on device movement and orientation.

Code Example: Accelerometer

using Microsoft.Devices.Sensors;
using System;

namespace SensorExample
{
    public class AccelerometerExample
    {
        private Accelerometer accelerometer;

        public AccelerometerExample()
        {
            accelerometer = new Accelerometer();
            accelerometer.CurrentValueChanged += Accelerometer_CurrentValueChanged;
            accelerometer.Start();
        }

        private void Accelerometer_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
        {
            var acceleration = e.SensorReading.Acceleration;
            Console.WriteLine($"X: {acceleration.X}, Y: {acceleration.Y}, Z: {acceleration.Z}");
        }
    }
}

Status as of 2025

This namespace and its API are deprecated and were used only for Windows Phone applications. With the end of support for Windows Phone (in 2017), the use of this namespace is limited. Modern mobile application development now focuses on other platforms, such as Xamarin, .NET MAUI, or native app development for iOS and Android, where similar APIs are available.

For newer development, it is recommended to use current frameworks and libraries that provide support for working with sensors on modern devices.


Microsoft.Phone.Controls

Provides controls specific to Windows Phone, such as:

  • Pivot: A control for horizontal navigation between different panels.
  • Panorama: A control that enables smooth transitions between larger sections.
  • WebBrowser: Hosting web pages within the app.

Microsoft.Phone.Tasks

Used to perform integrated system tasks, such as:

  • EmailComposeTask: Opens the interface for sending an email.
  • SmsComposeTask: Opens the interface for sending an SMS.
  • PhoneCallTask: Initiates a call to a specific phone number.
  • PhotoChooserTask: Allows the user to select a photo from the gallery.

Microsoft.Phone.Shell

Provides access to user interface features, such as:

  • Tile: Dynamic tiles on the start screen.
  • ToastNotification: Sending brief notifications to the user.

Microsoft.Xna.Framework

Used for games and graphic applications. Contains classes for working with:

  • Graphics: Graphic rendering.
  • Audio: Playing sounds and music.
  • Input: Handling user inputs.

See: XNA namespaces


Microsoft.Phone.Info

Provides device information, such as:

  • DeviceStatus: Information about memory, device model, battery status, etc.
  • UserExtendedProperties: Getting information about the user.

Microsoft.Devices

Works with device hardware, including:

  • Camera: Using the device's camera.
  • VibrateController: Controlling the device's vibration.

Microsoft.Phone.Media

Used for working with multimedia:

  • AudioPlayer: Playing background music.
  • VideoPlayer: Playing videos.

Microsoft.Phone.Reactive

Provides a subset of reactive programming (Reactive Extensions) for asynchronous operations in applications.


System.Device.Location

Works with geolocation:

  • GeoCoordinateWatcher: Gets the current location of the device.
  • GeoCoordinate: Storing coordinates (latitude and longitude).

Microsoft.Phone.Maps.Controls

Used to implement map features:

  • Map: Displaying an interactive map.
  • MapLayer: Working with layers on the map.

Microsoft.Advertising.Mobile.UI

Used for integrating ads into apps through the Microsoft Advertising SDK.


System.Windows.Controls

Contains basic controls for the user interface, such as:

  • Button: A button.
  • TextBox: A text box.
  • ListBox: A list of items.

System.Windows.Media

API for working with multimedia, such as graphics, animations, and sound.


Microsoft.Phone.Notification

Used for working with Push Notification Services (PNS) for real-time notifications.


System.IO.IsolatedStorage

Used to store application data locally on the device. It contains classes for working with Isolated Storage, which is a sandboxed area for the app.


If you are working with Windows Phone, it is recommended to consult the documentation for the specific SDK version, as some namespaces and APIs were only available in certain versions.