2 * Copyright(c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.ComponentModel;
21 namespace Tizen.NUI.EXaml
23 internal static class LoadEXaml
25 internal static GlobalDataList GatherDataList(string xaml)
27 var globalDataList = new GlobalDataList();
31 var createInstance = new CreateInstanceAction(globalDataList, null);
32 var getObjectByProperty = new GetObjectByPropertyAction(globalDataList, null);
33 var addExistInstance = new AddExistInstanceAction(globalDataList, null);
34 var registerXName = new RegisterXNameAction(globalDataList, null);
35 var setProperty = new SetPropertyAction(globalDataList, null);
36 var addToCollectionProperty = new AddToCollectionPropertyAction(globalDataList, null);
37 var addEvent = new AddEventAction(globalDataList, null);
38 var setBindalbeProperty = new SetBindalbePropertyAction(globalDataList, null);
39 var addObject = new CallAddMethodAction(globalDataList, null);
40 var setDynamicResourceAction = new SetDynamicResourceAction(globalDataList, null);
41 var addToResourceDictionaryAction = new AddToResourceDictionaryAction(globalDataList, null);
42 var setBindingAction = new SetBindingAction(globalDataList, null);
43 var otherActions = new OtherActions(globalDataList, null);
45 foreach (char c in xaml)
47 if (null == currentOp)
54 currentOp = new GatherAssembliesBlock(globalDataList, null);
60 currentOp = new GatherTypesBlock(globalDataList, null);
66 currentOp = new GatherPropertiesBlock(globalDataList, null);
72 currentOp = new GatherEventsBlock(globalDataList, null);
78 currentOp = new GatherMethodsBlock(globalDataList, null);
84 currentOp = new GatherBindablePropertiesBlock(globalDataList, null);
91 currentOp = createInstance;
96 currentOp = getObjectByProperty;
101 currentOp = addExistInstance;
106 currentOp = registerXName;
111 currentOp = setProperty;
116 currentOp = addToCollectionProperty;
121 currentOp = addEvent;
126 currentOp = setBindalbeProperty;
131 currentOp = setDynamicResourceAction;
136 currentOp = addObject;
141 currentOp = addToResourceDictionaryAction;
146 currentOp = setBindingAction;
151 currentOp = otherActions;
158 currentOp = currentOp.DealChar(c);
162 foreach (var op in globalDataList.PreLoadOperations)
167 return globalDataList;
170 internal static void Load(object view, string xaml)
172 var globalDataList = GatherDataList(xaml);
174 CreateInstanceAction.Root = view;
176 foreach (var op in globalDataList.Operations)
182 internal static void Load(object view, object preloadData)
184 var globalDataList = preloadData as GlobalDataList;
186 if (null == globalDataList)
191 CreateInstanceAction.Root = view;
193 foreach (var op in globalDataList.Operations)
199 private static Action currentOp = null;