/// it only in accordance with the terms of the license agreement
/// you entered into with Samsung.
+
using System;
using System.Runtime.InteropServices;
[DllImport(Libraries.Application, EntryPoint = "app_control_get_mime", CallingConvention = CallingConvention.Cdecl)]
internal static extern int GetMime(SafeAppControlHandle handle, out string mime);
-
+
internal sealed class SafeAppControlHandle : SafeHandle
{
public SafeAppControlHandle() : base(IntPtr.Zero, true)
/// it only in accordance with the terms of the license agreement
/// you entered into with Samsung.
+
using System;
using System.Runtime.InteropServices;
[DllImport(Libraries.Application, EntryPoint = "ui_app_main", CallingConvention = CallingConvention.Cdecl)]
internal static extern int UIAppMain(int argc, string[] argv, ref UIAppLifecycleCallbacks callback, IntPtr userData);
+ [DllImport(Libraries.Application, EntryPoint = "ui_app_exit", CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void UIAppExit();
}
}
/// it only in accordance with the terms of the license agreement
/// you entered into with Samsung.
+
using System.Text;
using System.Runtime.InteropServices;
/// it only in accordance with the terms of the license agreement
/// you entered into with Samsung.
+
using System;
using System.Text;
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
-internal static partial class Interop {
- internal static partial class Window {
+internal static partial class Interop
+{
+ internal static partial class Window
+ {
[DllImport(Libraries.Elementary, CallingConvention = CallingConvention.Cdecl)]
internal static extern IntPtr elm_win_add(IntPtr parent, string name, int type);
<ProjectGuid>{663C5A3D-E631-4987-AEE7-F498C56A40FC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace></RootNamespace>
+ <RootNamespace>
+ </RootNamespace>
<AssemblyName>Tizen.Applications</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Compile Include="Tizen.Applications\AppControl.cs" />
<Compile Include="Tizen.Applications\AppControlFilter.cs" />
<Compile Include="Tizen.Applications\Application.cs" />
- <Compile Include="Tizen.Applications\CodeExample.cs" />
<Compile Include="Tizen.Applications\Context.cs" />
- <Compile Include="Tizen.Applications\ContextGroup.cs" />
+ <Compile Include="Tizen.Applications\ActorGroup.cs" />
<Compile Include="Tizen.Applications\Service.cs" />
<Compile Include="Tizen.Applications\Window.cs" />
<Compile Include="Tizen.Applications\TizenSynchronizationContext.cs" />
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project>
\ No newline at end of file
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
+using Tizen.UI;
+
namespace Tizen.Applications
{
+ /// <summary>
+ ///
+ /// </summary>
public abstract class Actor : Context
{
+ private ActorGroup _group;
+
+ /// <summary>
+ ///
+ /// </summary>
+ internal protected Page MainPage { get; set; }
+
+ /// <summary>
+ ///
+ /// </summary>
protected virtual void OnPaused() { }
+
+ /// <summary>
+ ///
+ /// </summary>
protected virtual void OnResumed() { }
+ internal void Create(ActorGroup group)
+ {
+ _group = group;
+ base.Create();
+ }
+
internal void Pause()
{
OnPaused();
internal void Resume()
{
OnResumed();
+ MainPage.Show();
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="actor"></param>
+ /// <param name="control"></param>
protected void StartActor(Actor actor, AppControl control)
{
- Actor target = (Actor)CurrentGroup.MoveToTop(actor);
- if (target != null)
- {
- Pause();
- target.Start(control);
- target.Resume();
- }
+ _group.StartActor(actor, control);
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="actorType"></param>
+ /// <param name="control"></param>
protected override void StartActor(Type actorType, AppControl control)
{
- Application.StartActor(CurrentGroup, actorType, control);
+ Application.StartActor(_group, actorType, control);
}
+ /// <summary>
+ ///
+ /// </summary>
protected override void Finish()
{
- Application.StopActor(CurrentGroup, this);
+ Application.StopActor(_group, this);
}
-
}
}
--- /dev/null
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Tizen.Applications
+{
+ internal class ActorGroup
+ {
+ private readonly List<Actor> _actorList;
+
+ public bool IsEmpty
+ {
+ get
+ {
+ return _actorList.Count == 0;
+ }
+ }
+
+ public Actor TopActor
+ {
+ get
+ {
+ return _actorList.LastOrDefault(null);
+ }
+ }
+
+ public ActorGroup()
+ {
+ _actorList = new List<Actor>();
+ }
+
+ public void StartActor(Type actorType, AppControl control)
+ {
+ Actor actor = (Actor)Activator.CreateInstance(actorType);
+ actor.Create(this);
+ if (actor.MainPage == null)
+ {
+ throw new ArgumentNullException("Actor's MainPage is not set.");
+ }
+
+ Actor prevTop = TopActor;
+ _actorList.Add(actor);
+ if (prevTop != null)
+ {
+ prevTop.Pause();
+ }
+ actor.Start(control);
+ actor.Resume();
+ }
+
+ public void StartActor(Actor actor, AppControl control)
+ {
+ if (actor.MainPage == null)
+ {
+ throw new ArgumentNullException("Actor's MainPage is not set.");
+ }
+
+ Actor prevTop = TopActor;
+ _actorList.Remove(actor);
+ _actorList.Add(actor);
+ if (prevTop != actor)
+ {
+ prevTop.Pause();
+ }
+ actor.Start(control);
+ actor.Resume();
+ }
+
+ public void StopActor(Actor actor)
+ {
+ Actor prevTop = TopActor;
+ _actorList.Remove(actor);
+ actor.Pause();
+ actor.Terminate();
+ if (prevTop == actor)
+ {
+ if (TopActor != null)
+ {
+ TopActor.Resume();
+ }
+ }
+ }
+
+ public Actor FindActor(Type type)
+ {
+ return _actorList.Find(s => s.GetType() == type);
+ }
+
+ public Actor FindActor(Actor actor)
+ {
+ return _actorList.Find(s => s == actor);
+ }
+ }
+}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
namespace Tizen.Applications
{
+ /// <summary>
+ ///
+ /// </summary>
public class AppControl
{
- private string _operation;
- private string _mime;
- private string _uri;
+ private readonly string _operation;
+ private readonly string _mime;
+ private readonly string _uri;
+ /// <summary>
+ ///
+ /// </summary>
public static class Operations
{
public const string Main = "http://tizen.org/appcontrol/operation/main";
public const string SettingWifi = "http://tizen.org/appcontrol/operation/setting/wifi";
}
+ /// <summary>
+ ///
+ /// </summary>
public string Operation { get { return _operation; } }
+
+ /// <summary>
+ ///
+ /// </summary>
public string Mime { get { return _mime; } }
+
+ /// <summary>
+ ///
+ /// </summary>
public string Uri { get { return _uri; } }
internal AppControl(IntPtr appControlHandle)
Interop.AppControl.GetUri(handle, out _uri);
}
- internal bool IsService
- {
- get { return false; }
- }
-
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="operation"></param>
+ /// <param name="mime"></param>
+ /// <param name="uri"></param>
public AppControl(string operation, string mime, string uri)
{
_operation = operation;
_uri = uri;
}
- public bool IsLaunchOperation()
+ internal bool IsLaunchOperation()
{
if (_operation == null) return false;
return (_operation == Operations.Main) || (_operation == Operations.Default);
}
+ internal bool IsService
+ {
+ get { return false; }
+ }
}
}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
using System.Text.RegularExpressions;
namespace Tizen.Applications
{
+ /// <summary>
+ ///
+ /// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class AppControlFilter : Attribute
{
private readonly string _mime;
private readonly string _uri;
+ /// <summary>
+ ///
+ /// </summary>
public string Operation { get { return _operation; } }
+
+ /// <summary>
+ ///
+ /// </summary>
public string Mime { get { return _mime; } }
+
+ /// <summary>
+ ///
+ /// </summary>
public string Uri { get { return _uri; } }
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="operation"></param>
+ /// <param name="mime"></param>
+ /// <param name="uri"></param>
public AppControlFilter(string operation, string mime = null, string uri = null)
{
_operation = operation;
_uri = uri;
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns></returns>
public override bool Equals(object obj)
{
AppControlFilter f = obj as AppControlFilter;
return (_operation == f._operation) & (_mime == f._mime) & (_uri == f._uri);
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <returns></returns>
public override int GetHashCode()
{
int hash = 0;
return _uri == uri;
}
- public bool IsMatch(AppControl e)
+ internal bool IsMatch(AppControl e)
{
string mime = e.Mime;
if (String.IsNullOrEmpty(mime) && !String.IsNullOrEmpty(e.Uri))
return _operation == e.Operation && IsMimeMatched(mime) && IsUriMatched(e.Uri);
}
}
-
}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Runtime.InteropServices;
+
+using Tizen.UI;
namespace Tizen.Applications
{
+ /// <summary>
+ /// Provides static methods and properties to manage an application, such as methods to register Actors and Services,
+ /// to start an application.
+ /// </summary>
public static class Application
{
- private static Dictionary<AppControlFilter, Type> s_filterMap = new Dictionary<AppControlFilter, Type>();
- private static ContextGroup s_serviceGroup = new ContextGroup();
- private static List<ContextGroup> s_actorGroupList = new List<ContextGroup>();
+ private static readonly Dictionary<AppControlFilter, Type> s_filterMap = new Dictionary<AppControlFilter, Type>();
+ private static readonly List<Service> s_serviceList = new List<Service>();
+ private static readonly List<ActorGroup> s_actorGroupList = new List<ActorGroup>();
- private static Window s_window = null;
+ private static readonly Window s_window = null;
- private static ContextGroup CurrentActorGroup
+ private static ActorGroup CurrentActorGroup
{
get
{
}
}
+ /// <summary>
+ /// Occurs when the application starts.
+ /// </summary>
public static event EventHandler Created = delegate { };
+
+ /// <summary>
+ /// Occurs when the application's main loop exits.
+ /// </summary>
public static event EventHandler Exited = delegate { };
- public static int Run(string[] args)
+ /// <summary>
+ /// Runs the application's main loop.
+ /// </summary>
+ /// <param name="args">The command-line arguments</param>
+ public static void Run(string[] args)
{
Interop.Application.UIAppLifecycleCallbacks ops;
ops.OnCreate = (userData) =>
};
ops.OnPause = (userData) =>
{
- if (CurrentActorGroup != null && CurrentActorGroup.TopContext != null)
+ if (CurrentActorGroup != null && CurrentActorGroup.TopActor != null)
{
- Actor actor = CurrentActorGroup.TopContext as Actor;
+ Actor actor = CurrentActorGroup.TopActor as Actor;
if (actor != null)
{
actor.Pause();
};
ops.OnResume = (userData) =>
{
- if (CurrentActorGroup != null && CurrentActorGroup.TopContext != null)
+ if (CurrentActorGroup != null && CurrentActorGroup.TopActor != null)
{
- Actor actor = CurrentActorGroup.TopContext as Actor;
+ Actor actor = CurrentActorGroup.TopActor as Actor;
if (actor != null)
{
actor.Resume();
{
if (item.Key.IsMatch(appControl) && item.Value.IsSubclassOf(typeof(Actor)))
{
- // Window was created when the first UI Actor was created
- if (s_window == null)
- {
- s_window = new Window();
- }
-
if (CurrentActorGroup == null || !appControl.IsLaunchOperation())
{
StartActor(null, item.Value, appControl);
TizenSynchronizationContext.Initialize();
- int ret = Interop.Application.UIAppMain(args.Length, args, ref ops, IntPtr.Zero);
-
- return ret;
+ // TODO: check ret of UIAppMain and throw exceptions when errors are returned.
+ Interop.Application.UIAppMain(args.Length, args, ref ops, IntPtr.Zero);
}
+ /// <summary>
+ /// Hides the application.
+ /// </summary>
public static void Hide()
{
if (s_window != null)
s_window.InActive();
}
+ /// <summary>
+ /// Exits the main loop of application.
+ /// </summary>
public static void Exit()
{
- Exited(null, null);
- throw new NotImplementedException();
+ Exited(null, null);
+ // TODO: clear context and group
+ Interop.Application.UIAppExit();
}
- public static void RegisterActor(Type clazz)
+ /// <summary>
+ /// Registers an Actor class type.
+ /// </summary>
+ /// <param name="actorType">The type of Actor class.</param>
+ public static void RegisterActor(Type actorType)
{
- RegisterActor(clazz, new AppControlFilter[0] { });
+ RegisterActor(actorType, new AppControlFilter[0] { });
}
- public static void RegisterActor(Type clazz, AppControlFilter filter)
+ /// <summary>
+ /// Registers an Actor class type.
+ /// </summary>
+ /// <param name="actorType">The type of Actor class.</param>
+ /// <param name="filter">The filter to match Actor and AppControl.</param>
+ public static void RegisterActor(Type actorType, AppControlFilter filter)
{
- RegisterActor(clazz, new AppControlFilter[] { filter });
+ RegisterActor(actorType, new AppControlFilter[] { filter });
}
- public static void RegisterActor(Type clazz, AppControlFilter[] filters)
+ /// <summary>
+ /// Registers an Actor class type.
+ /// </summary>
+ /// <param name="actorType">The type of Actor class.</param>
+ /// <param name="filters">The array of filters to match Actor and AppControl.</param>
+ public static void RegisterActor(Type actorType, AppControlFilter[] filters)
{
- if (!clazz.IsSubclassOf(typeof(Actor)))
- throw new ArgumentException(clazz.FullName + " is not a subclass of Actor.");
+ if (!actorType.IsSubclassOf(typeof(Actor)))
+ throw new ArgumentException(actorType.FullName + " is not a subclass of Actor.");
- RegisterContext(clazz, filters);
+ RegisterContext(actorType, filters);
}
- public static void RegisterService(Type clazz)
+ /// <summary>
+ /// Registers an Service class type.
+ /// </summary>
+ /// <param name="serviceType">The type of Service class.</param>
+ public static void RegisterService(Type serviceType)
{
- RegisterService(clazz, new AppControlFilter[0] { });
+ RegisterService(serviceType, new AppControlFilter[0] { });
}
- public static void RegisterService(Type clazz, AppControlFilter filter)
+ /// <summary>
+ /// Registers an Service class type.
+ /// </summary>
+ /// <param name="serviceType">The type of Service class.</param>
+ /// <param name="filter">The filter to match Service and AppControl.</param>
+ public static void RegisterService(Type serviceType, AppControlFilter filter)
{
- RegisterService(clazz, new AppControlFilter[] { filter });
+ RegisterService(serviceType, new AppControlFilter[] { filter });
}
- public static void RegisterService(Type clazz, AppControlFilter[] filters)
+ /// <summary>
+ /// Registers an Service class type.
+ /// </summary>
+ /// <param name="serviceType">The type of Service class.</param>
+ /// <param name="filters">The array of filters to match Service and AppControl.</param>
+ public static void RegisterService(Type serviceType, AppControlFilter[] filters)
{
- if (!clazz.IsSubclassOf(typeof(Service)))
- throw new ArgumentException(clazz.FullName + " is not a subclass of Service.");
+ if (!serviceType.IsSubclassOf(typeof(Service)))
+ throw new ArgumentException(serviceType.FullName + " is not a subclass of Service.");
- RegisterContext(clazz, filters);
+ RegisterContext(serviceType, filters);
}
- private static void RegisterContext(Type clazz, AppControlFilter[] filters)
+ private static void RegisterContext(Type contextType, AppControlFilter[] filters)
{
- foreach (var prop in clazz.GetProperties())
+ foreach (var prop in contextType.GetProperties())
{
foreach (var attr in prop.GetCustomAttributes(false))
{
var filter = attr as AppControlFilter;
if (filter != null)
{
- s_filterMap.Add(filter, clazz);
+ s_filterMap.Add(filter, contextType);
}
}
}
{
foreach (var filter in filters)
{
- s_filterMap.Add(filter, clazz);
+ s_filterMap.Add(filter, contextType);
}
}
}
- internal static void StartActor(ContextGroup group, Type actorType, AppControl control)
+ internal static void StartActor(ActorGroup group, Type actorType, AppControl control)
{
if (!actorType.IsSubclassOf(typeof(Actor)))
{
throw new ArgumentException(actorType.FullName + " is not a subclass of Actor.");
}
- Actor actor = (Actor)Activator.CreateInstance(actorType);
- ContextGroup ctxGroup = group;
- if (ctxGroup == null)
+ // Window was created when the first UI Actor was created
+ //if (s_window == null)
+ //{
+ // s_window = new Window();
+ //}
+
+ ActorGroup actorGroup = group;
+ if (actorGroup == null)
{
- ctxGroup = new ContextGroup();
- s_actorGroupList.Add(ctxGroup);
+ actorGroup = new ActorGroup();
+ s_actorGroupList.Add(actorGroup);
}
- ctxGroup.AddContext(actor);
- actor.Create(ctxGroup);
- actor.Start(control);
+ actorGroup.StartActor(actorType, control);
// TODO: consider resume operation
- if (!s_window.Visible)
- {
- s_window.Active();
- s_window.Show();
- actor.Resume();
- }
+ //if (!s_window.Visible)
+ //{
+ // s_window.Active();
+ // s_window.Show();
+ // actor.Resume();
+ //}
}
- internal static void StopActor(ContextGroup group, Actor actor)
+ internal static void StopActor(ActorGroup group, Actor actor)
{
- actor.Pause();
- actor.Terminate();
- group.RemoveContext(actor);
+ group.StopActor(actor);
if (group.IsEmpty)
{
s_actorGroupList.Remove(group);
- if (s_actorGroupList.Count == 0 && s_serviceGroup.IsEmpty)
+ if (s_actorGroupList.Count == 0 && s_serviceList.Count == 0)
{
Exit();
}
Hide();
}
}
- else
- {
- Actor nextActor = group.TopContext as Actor;
- if (nextActor != null)
- {
- nextActor.Resume();
- }
- }
}
internal static void StartService(Type serviceType, AppControl control)
throw new ArgumentException(serviceType.FullName + " is not a subclass of Service.");
}
- Context ctx = s_serviceGroup.FindContext(serviceType);
- if (ctx == null)
+ Service svc = s_serviceList.Find(s => s.GetType() == serviceType);
+ if (svc == null)
{
- // Register ContextRemoved Handler once
- ctx = (Service)Activator.CreateInstance(serviceType);
- s_serviceGroup.AddContext(ctx);
- ctx.Create(s_serviceGroup);
+ svc = (Service)Activator.CreateInstance(serviceType);
+ s_serviceList.Add(svc);
+ svc.Create();
}
- ctx.Start(control);
+ svc.Start(control);
}
internal static void StopService(Type serviceType)
throw new ArgumentException(serviceType.FullName + " is not a subclass of Service.");
}
- Context ctx = s_serviceGroup.FindContext(serviceType);
- if (ctx != null)
+ Service svc = s_serviceList.Find(s => s.GetType() == serviceType);
+ if (svc != null)
{
- ctx.Terminate();
- s_serviceGroup.RemoveContext(ctx);
- if (s_serviceGroup.IsEmpty)
+ svc.Terminate();
+ s_serviceList.Remove(svc);
+ if (s_actorGroupList.Count == 0 && s_serviceList.Count == 0)
{
- if (s_actorGroupList.Count == 0)
- {
- Exit();
- }
+ Exit();
}
}
}
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications
-{
- public class ViewActor : Actor
- {
- public string Type { get; set; }
- protected override void OnCreated()
- {
- Console.WriteLine();
- }
-
- protected override void OnStarted()
- {
- }
-
- private void DoSomething()
- {
- }
- }
-
- [AppControlFilter("http://tizen.org/appcontrol/operation/default")]
- public class DefaultActor : Actor
- {
- protected override void OnCreated()
- {
- }
-
- protected override void OnStarted()
- {
- }
- }
-
- public class Test
- {
- static void test(string[] args) // main
- {
- Application.Created += Application_Create;
- Application.Exited += Application_Terminate;
- Application.RegisterActor(typeof(DefaultActor));
- Application.RegisterActor(typeof(ViewActor), new AppControlFilter[] {
- new AppControlFilter("http://tizen.org/appcontrol/view", "image/*"),
- new AppControlFilter("http://tizen.org/appcontrol/view", "text/*")
- });
-
- Application.Run(args);
- }
-
- private static void Application_Create(object sender, EventArgs e)
- {
- Console.WriteLine("Hello Application!");
- }
-
- private static void Application_Terminate(object sender, EventArgs e)
- {
- Console.WriteLine("Goodbye Application!");
- }
- }
-
-
-}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace Tizen.Applications
{
+ /// <summary>
+ ///
+ /// </summary>
public abstract class Context
{
- private ContextGroup _group;
private AppControl _control;
- internal ContextGroup CurrentGroup
- {
- get
- {
- return _group;
- }
- }
-
+ /// <summary>
+ ///
+ /// </summary>
protected AppControl ReceivedAppControl
{
get
}
}
+ /// <summary>
+ ///
+ /// </summary>
protected virtual void OnCreated() { }
+
+ /// <summary>
+ ///
+ /// </summary>
protected virtual void OnStarted() { }
+
+ /// <summary>
+ ///
+ /// </summary>
protected virtual void OnTerminated() { }
- internal void Create(ContextGroup group)
+ internal void Create()
{
- _group = group;
OnCreated();
}
OnTerminated();
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="actorType"></param>
+ /// <param name="control"></param>
protected abstract void StartActor(Type actorType, AppControl control);
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="serviceType"></param>
+ /// <param name="control"></param>
protected void StartService(Type serviceType, AppControl control)
{
Application.StartService(serviceType, control);
}
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="serviceType"></param>
protected void StopService(Type serviceType)
{
Application.StopService(serviceType);
}
+ /// <summary>
+ ///
+ /// </summary>
protected abstract void Finish();
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="control"></param>
+ /// <param name="destination"></param>
protected void SendAppControl(AppControl control, string destination)
{
throw new NotImplementedException();
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tizen.Applications
-{
- internal class ContextGroup
- {
- private List<Context> _contextList;
-
- public bool IsEmpty
- {
- get
- {
- return _contextList.Count == 0;
- }
- }
-
- public Context TopContext
- {
- get
- {
- return _contextList.LastOrDefault(null);
- }
- }
-
- public ContextGroup()
- {
- _contextList = new List<Context>();
- }
-
- public void AddContext(Context ctx)
- {
- _contextList.Add(ctx);
- }
-
- public void RemoveContext(Context ctx)
- {
- _contextList.Remove(ctx);
- }
-
- public Context FindContext(Type type)
- {
- return _contextList.Find(s => s.GetType() == type);
- }
-
- public Context FindContext(Context ctx)
- {
- return _contextList.Find(s => s == ctx);
- }
-
- public Context MoveToTop(Context ctx)
- {
- var found = FindContext(ctx);
- if (found != null)
- {
- _contextList.Remove(found);
- _contextList.Add(found);
- }
- return found;
- }
- }
-}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
namespace Tizen.Applications
{
+ /// <summary>
+ ///
+ /// </summary>
public abstract class Service : Context
{
+ /// <summary>
+ ///
+ /// </summary>
+ /// <param name="actorType"></param>
+ /// <param name="control"></param>
protected override void StartActor(Type actorType, AppControl control)
{
Application.StartActor(null, actorType, control);
}
+ /// <summary>
+ ///
+ /// </summary>
protected override void Finish()
{
Application.StopService(GetType());
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
using System.Collections.Generic;
using System.Threading;
{
SetSynchronizationContext(new TizenSynchronizationContext());
}
- private Interop.Glib.GSourceFunc wrapperHandler;
- private Object transactionLock = new Object();
- private int transactionID = 0;
- private Dictionary<int, Action> handlerMap = new Dictionary<int, Action>();
+ private Interop.Glib.GSourceFunc _wrapperHandler;
+ private Object _transactionLock = new Object();
+ private int _transactionID = 0;
+ private Dictionary<int, Action> _handlerMap = new Dictionary<int, Action>();
- TizenSynchronizationContext()
+ private TizenSynchronizationContext()
{
- wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
+ _wrapperHandler = new Interop.Glib.GSourceFunc(Handler);
}
public override void Post(SendOrPostCallback d, object state)
public void Post(Action action)
{
int id = 0;
- lock (transactionLock)
+ lock (_transactionLock)
{
- id = transactionID++;
+ id = _transactionID++;
}
- handlerMap.Add(id, action);
- Interop.Glib.IdleAdd(wrapperHandler, (IntPtr)id);
+ _handlerMap.Add(id, action);
+ Interop.Glib.IdleAdd(_wrapperHandler, (IntPtr)id);
}
public bool Handler(IntPtr userData)
{
int key = (int)userData;
- if (handlerMap.ContainsKey(key))
+ if (_handlerMap.ContainsKey(key))
{
- handlerMap[key]();
- handlerMap.Remove(key);
+ _handlerMap[key]();
+ _handlerMap.Remove(key);
}
return false;
}
-
}
}
--- /dev/null
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tizen.UI
+{
+ public class Page
+ {
+ internal void Show()
+ {
+
+ }
+ }
+}
+/// Copyright 2016 by Samsung Electronics, Inc.,
+///
+/// This software is the confidential and proprietary information
+/// of Samsung Electronics, Inc. ("Confidential Information"). You
+/// shall not disclose such Confidential Information and shall use
+/// it only in accordance with the terms of the license agreement
+/// you entered into with Samsung.
+
+
using System;
-namespace Tizen.Applications
+namespace Tizen.UI
{
- class Window : IDisposable
+ internal class Window : IDisposable
{
private IntPtr _native_window = IntPtr.Zero;
{
_native_window = Interop.Window.elm_win_add(IntPtr.Zero, "Window", 0);
}
+
~Window()
{
Dispose();
}
+
public void Show()
{
Interop.Window.evas_object_show(_native_window);
}
+
public void Hide()
{
Interop.Window.evas_object_hide(_native_window);
}
+
public void Active()
{
Interop.Window.elm_win_activate(_native_window);
}
+
public void InActive()
{
Interop.Window.elm_win_lower(_native_window);
mcs -target:library -out:%{dllname} -keyfile:Tizen.Applications/Tizen.Applications.snk \
Tizen.Applications/Properties/AssemblyInfo.cs \
Tizen.Applications/Tizen.Applications/*.cs \
+ Tizen.Applications/Tizen.UI/*.cs \
Tizen.Applications/Interop/*.cs
# check p/invoke