Robertvokac (talk | contribs) m Robertvokac moved page Microsoft.Devices.Sensors to Windows Phone namespaces without leaving a redirect |
Robertvokac (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 46: | Line 46: | ||
For newer development, it is recommended to use current frameworks and libraries that provide support for working with sensors on modern devices. | 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. |
Latest revision as of 18:49, 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:
- 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.
- 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.
- 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.
- 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.