1 // Copyright 2016 by Samsung Electronics, Inc.,
3 // This software is the confidential and proprietary information
4 // of Samsung Electronics, Inc. ("Confidential Information"). You
5 // shall not disclose such Confidential Information and shall use
6 // it only in accordance with the terms of the license agreement
7 // you entered into with Samsung.
10 using System.Collections.Generic;
11 using Tizen.Applications.CoreBackend;
13 namespace Tizen.Applications
16 /// Represents a widget application.
18 public class WidgetApplication : CoreApplication
21 /// Initializes WidgetApplication class.
23 /// <param name="typeInfo">map structure for derived class type and widget id</param>
24 public WidgetApplication(IDictionary<Type, string> typeInfo) : base(new WidgetCoreBackend())
26 WidgetCoreBackend core = Backend as WidgetCoreBackend;
28 core?.CreateWidgetTypes(typeInfo);
32 /// Initializes WidgetApplication class.
34 /// <remarks> Widget id will be replaced as application id</remarks>
35 /// <param name="type">derived class type</param>
36 public WidgetApplication(Type type) : base(new WidgetCoreBackend())
38 WidgetCoreBackend core = Backend as WidgetCoreBackend;
40 core?.CreateWidgetTypes(new Dictionary<Type, string>() { {type, ApplicationInfo.ApplicationId } });
44 /// Gets all instances of the widget associated with the type
46 /// <param name="type">Class type for the widget</param>
47 public IEnumerable<WidgetBase> GetInstances(Type type)
49 WidgetCoreBackend core = Backend as WidgetCoreBackend;
54 foreach (WidgetType w in core.WidgetTypes)
56 if (w.ClassType == type)
58 return w.WidgetInstances;
66 /// Runs the widget application's main loop.
68 /// <param name="args">Arguments from commandline.</param>
69 public override void Run(string[] args)