2 * Copyright (c) 2016 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.
19 using System.Runtime.InteropServices;
22 namespace JsonLoaderTest
24 class Example : NUIApplication
26 private Builder _builder;
27 private string _jsonFileName;
29 public Example() : base()
33 public Example(string stylesheet) : base(stylesheet)
35 _jsonFileName = stylesheet;
38 public Example(string stylesheet, WindowMode windowMode) : base(stylesheet, windowMode)
42 protected override void OnCreate()
48 public void Initialize()
50 if( _jsonFileName.Length == 0)
52 Console.WriteLine("Please specify JSON file to load");
56 _builder = new Builder ();
58 PropertyMap constants = new PropertyMap();
60 // In dali-demo we have some JSON files that can be loaded, but they need 3 different macros defining.
61 // The JSON folder is typically installed into dali-env/opt/share/com.samsung.dali-demo/res:
63 //string demoDirectory = ".../dali-env/opt/share/com.samsung.dali-demo/res";
64 //constants.Insert( "DEMO_IMAGE_DIR" , new PropertyValue( demoDirectory+"/images") );
65 //constants.Insert( "DEMO_MODEL_DIR" , new PropertyValue( demoDirectory+"/models") );
66 //constants.Insert( "DEMO_SCRIPT_DIR", new PropertyValue( demoDirectory+"/scripts") );
67 constants.Insert( "CONFIG_SCRIPT_LOG_LEVEL", new PropertyValue( "Verbose") );
69 _builder.AddConstants( constants );
72 Stage stage = Stage.Instance;
73 stage.BackgroundColor = Color.White;
75 _builder.LoadFromFile( _jsonFileName );
77 _builder.AddActors( stage.GetDefaultLayer() );
82 /// The main entry point for the application.
85 static void _Main(string[] args)
94 Console.WriteLine("arguments = " + args.Length);
95 Example example = new Example(fileName);