[ComponentBased] Fix RegisterComponent Method (#1389)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Tue, 11 Feb 2020 00:37:43 +0000 (09:37 +0900)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2020 00:37:43 +0000 (09:37 +0900)
- Check if a component ID exists or not

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.ComponentBased/Tizen.Applications.ComponentBased.Common/ComponentBasedApplication.cs

index fbeb0c9..641817c 100755 (executable)
@@ -66,6 +66,14 @@ namespace Tizen.Applications.ComponentBased.Common
                 throw new ArgumentException("Already exist type");
             }
 
+            foreach (var stateManager in _componentFactories)
+            {
+                if (stateManager.Value.ComponentId == compId)
+                {
+                    throw new ArgumentException("Already exist component ID(" + compId + ")");
+                }
+            }
+
             if (typeof(FrameComponent).IsAssignableFrom(compType))
             {
                 Log.Info(LogTag, "Add frame component");