using System;
using System.Collections.Generic;
-
+using System.ComponentModel;
using Tizen.Internals.Errors;
namespace Tizen.Applications.CoreBackend
/// </summary>
public enum AppEventType
{
+ /// <summary>
+ /// The low memory event.
+ /// </summary>
LowMemory = 0,
+
+ /// <summary>
+ /// The low battery event.
+ /// </summary>
LowBattery,
+
+ /// <summary>
+ /// The system language changed event.
+ /// </summary>
LanguageChanged,
+
+ /// <summary>
+ /// The device orientation changed event.
+ /// </summary>
DeviceOrientationChanged,
+
+ /// <summary>
+ /// The region format changed event.
+ /// </summary>
RegionFormatChanged,
+
+ /// <summary>
+ /// The suspended state changed event of the application.
+ /// </summary>
SuspendedStateChanged
}
+ /// <summary>
+ /// Tag string for this class.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected static readonly string LogTag = typeof(DefaultCoreBackend).Namespace;
+ /// <summary>
+ /// Data structure for event handlers.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected IDictionary<EventType, object> Handlers = new Dictionary<EventType, object>();
+ /// <summary>
+ /// Constructor of DefaultCoreBackend class.
+ /// </summary>
public DefaultCoreBackend()
{
}
+ /// <summary>
+ /// Finalizer of DefaultCoreBackend class.
+ /// </summary>
~DefaultCoreBackend()
{
Dispose(false);
}
- public void AddEventHandler(EventType evType, Action handler)
+ /// <summary>
+ /// Adds an event handler.
+ /// </summary>
+ /// <param name="evType">The type of event.</param>
+ /// <param name="handler">The handler method without arguments.</param>
+ public virtual void AddEventHandler(EventType evType, Action handler)
{
Handlers.Add(evType, handler);
}
- public void AddEventHandler<TEventArgs>(EventType evType, Action<TEventArgs> handler) where TEventArgs : EventArgs
+ /// <summary>
+ /// Adds an event handler.
+ /// </summary>
+ /// <typeparam name="TEventArgs">The EventArgs type used in arguments of the handler method.</typeparam>
+ /// <param name="evType">The type of event.</param>
+ /// <param name="handler">The handler method with a TEventArgs type argument.</param>
+ public virtual void AddEventHandler<TEventArgs>(EventType evType, Action<TEventArgs> handler) where TEventArgs : EventArgs
{
Handlers.Add(evType, handler);
}
+ /// <summary>
+ /// Runs the mainloop of the backend.
+ /// </summary>
+ /// <param name="args"></param>
public virtual void Run(string[] args)
{
TizenSynchronizationContext.Initialize();
}
+ /// <summary>
+ /// Exits the mainloop of the backend.
+ /// </summary>
public abstract void Exit();
+ /// <summary>
+ /// Releases all resources.
+ /// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
+ /// <summary>
+ /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+ /// </summary>
+ /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
protected abstract void Dispose(bool disposing);
+ /// <summary>
+ /// Default implementation for the low memory event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnLowMemoryNative(IntPtr infoHandle, IntPtr data)
{
LowMemoryStatus status = LowMemoryStatus.None;
}
}
+ /// <summary>
+ /// Default implementation for the low battery event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnLowBatteryNative(IntPtr infoHandle, IntPtr data)
{
LowBatteryStatus status = LowBatteryStatus.None;
}
}
+ /// <summary>
+ /// Default implementation for the system language changed event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data)
{
string lang;
}
}
+ /// <summary>
+ /// Default implementation for the region format changed event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnRegionChangedNative(IntPtr infoHandle, IntPtr data)
{
string region;
}
}
+ /// <summary>
+ /// Default implementation for the suspended state changed event.
+ /// </summary>
+ /// <param name="infoHandle"></param>
+ /// <param name="data"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void OnDeviceOrientationChangedNative(IntPtr infoHandle, IntPtr data)
{
DeviceOrientation orientation;
/// <exception cref="InvalidOperationException">Thrown when failed because of an invalid parameter.</exception>
/// <example>
/// <code>
- /// IEnumerable<string> applicationIds = AppControl.GetMatchedApplicationIds(control);
+ /// IEnumerable<string> applicationIds = AppControl.GetMatchedApplicationIds(control);
/// if (applicationIds != null)
/// {
/// foreach (string id in applicationIds)
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
- /// string myValue = appControl.ExtraData.Get<string>("myKey");
+ /// string myValue = appControl.ExtraData.Get<string>("myKey");
/// </code>
/// </example>
public T Get<T>(string key)
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
- /// IEnumerable<string> keys = appControl.GetKeys();
+ /// IEnumerable<string> keys = appControl.GetKeys();
/// if (keys != null)
/// {
/// foreach (string key in keys)
/// <example>
/// <code>
/// AppControl appControl = new AppControl();
- /// IEnumerable<string> myValue = null;
+ /// IEnumerable<string> myValue = null;
/// bool result = appControl.ExtraData.TryGet("myKey", out myValue);
/// if (result)
/// {
/// bundle.AddItem("string", "a_string");
/// if (bundle.Contains("string"))
/// {
- /// string aValue = bundle.GetItem<string>("string");
+ /// string aValue = bundle.GetItem<string>("string");
/// Console.WriteLine(aValue);
/// }
/// </code>
/// if (bundle.Contains("string"))
/// {
/// object aValue = bundle.GetItem("string");
- /// if (bundle.Is<string>("string");)
+ /// if (bundle.Is<string>("string");)
/// {
/// string aString = (string)aValue;
/// Console.WriteLine(aString);
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// bundle.AddItem("string_array", stringArray);
- /// if (bundle.Is<string>("string_array"))
+ /// if (bundle.Is<string>("string_array"))
/// {
/// Console.WriteLine("It is a string");
- /// Console.WriteLine(bundle.GetItem<string>("string_array"));
+ /// Console.WriteLine(bundle.GetItem<string>("string_array"));
/// }
- /// else if (bundle.Is<string[]>("string_array"))
+ /// else if (bundle.Is<string[]>("string_array"))
/// {
/// Console.WriteLine("It is a string[]");
- /// string[] anArray = bundle.GetItem<string[]>("string_array");
+ /// string[] anArray = bundle.GetItem<string[]>("string_array");
/// foreach (string value in anArray)
/// {
/// Console.WriteLine(value);
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// bundle.AddItem("string_array", stringArray);
- /// System.Collections.Generic.IEnumerable<string> aStringEnumerable;
+ /// System.Collections.Generic.IEnumerable<string> aStringEnumerable;
/// if (bundle.TryGetItem("string", out aStringEnumerable))
/// {
/// foreach (string value in aStringEnumerable)
/// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle();
/// string[] stringArray = { "a", "b", "c" };
/// bundle.AddItem("string_array", stringArray);
- /// if (bundle.Is<string[]>("string_array"))
+ /// if (bundle.Is<string[]>("string_array"))
/// {
/// Console.WriteLine("It is a string[]");
- /// string[] anArray = bundle.GetItem<string[]>("string_array");
+ /// string[] anArray = bundle.GetItem<string[]>("string_array");
/// foreach (string value in anArray)
/// {
/// Console.WriteLine(value);
/// <param name="key">The name of the key to check.</param>
/// <returns>True if the key exists in the preference, otherwise false.</returns>
/// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
- /// <exception cref="IOException">Thrown when the method failed due to an internal I/O error.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// <example>
/// <code>
/// Preference.Set("active_user", "Joe");
/// bool exists = Preference.Contains("active_user");
/// if (exists)
/// {
- /// string value = Preference.Get<string>("active_user");
+ /// string value = Preference.Get<istring>("active_user");
/// Console.WriteLine("user {0}", value);
/// }
/// </code>
/// If the key already exists in the preference, the old value will be overwritten with a new value.
/// Data types for supported values are: integer, double, string, and bool.
/// </remarks>
- /// <param name="key">The name of the key to create/modify./param>
+ /// <param name="key">The name of the key to create/modify.</param>
/// <param name="value">The value corresponding to the key.</param>
/// <exception cref="ArgumentException">Thrown if the key is an invalid parameter.</exception>
/// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal I/O error.</exception>
/// bool exists = Preference.Contains("active_user");
/// if (exists)
/// {
- /// string value = Preference.Get<string>("active_user");
+ /// string value = Preference.Get<string>("active_user");
/// Console.WriteLine("user {0}", value);
/// }
/// </code>