コード例 #1
0
        public static void UT_DropView(object obj)
        {
            for (int i = 1; i <= 15; i++)
            {
                Log.Info(ReactConstants.Tag, "## UT_DropView ## thread is Waiting>>>>>>>>>>>>>>>[" + i + " sec]");
                Thread.Sleep(1000 * 1);
            }

            ReactInstanceManager RCTIntance = (ReactInstanceManager)obj;
            var currentReactContext         = RCTIntance._currentReactContext;

            Log.Info(ReactConstants.Tag, " ## UT_DropView-2 ## ThreadID=" + Thread.CurrentThread.ManagedThreadId.ToString()
                     + ", RCTIntance=" + RCTIntance);

            if (currentReactContext != null)
            {
                UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>();

                Log.Info(ReactConstants.Tag, "### [BGN-2] Destroy a button view ### ");
                int[] szTagDel     = { 0 };
                int[] szIndicesDel = { 0, };
                uiMgrModule.manageChildren(1, null, null, null, null, szTagDel);
                uiMgrModule.OnBatchComplete();
                Log.Info(ReactConstants.Tag, "### [END-2] Destroy a button view ### ");
            }
        }
コード例 #2
0
        public static void UT_CreateView(object obj)
        {
            ReactInstanceManager RCTIntance = (ReactInstanceManager)obj;
            var currentReactContext         = RCTIntance._currentReactContext;

            Log.Info(ReactConstants.Tag, " ## UT_CreateView-1 ## ThreadID=" + Thread.CurrentThread.ManagedThreadId.ToString()
                     + ", RCTIntance=" + RCTIntance);

            if (currentReactContext != null)
            {
                UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>();
                Log.Info(ReactConstants.Tag, "### [BGN-1] Create a button view ### ");
                var prop1 = default(JObject);
                uiMgrModule.createView(3, "RCTButton", 1, prop1);
                uiMgrModule.OnBatchComplete();

                int[] szTag1     = { 3, };
                int[] szIndices1 = { 0, };
                uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null);
                uiMgrModule.OnBatchComplete();
                Log.Info(ReactConstants.Tag, "### [END-1] Create a button view ### ");
            }
        }
コード例 #3
0
        /// <summary>
        /// ## UIManagerModule TEST-STUB ##
        /// </summary>
        //public static void UT_UIManagerModuleTest(object obj)
        public void UT_UIManagerModuleTest(object obj)
        {
            Log.Info(ReactConstants.Tag, "<<<<<<<<<<<<<<<<<<<< UT_UIManagerModuleTest in thread ");

            //ReactInstanceManager RCTIntance = (ReactInstanceManager)obj;
            //var currentReactContext = RCTIntance._currentReactContext;

            var currentReactContext = _currentReactContext;

            Log.Info(ReactConstants.Tag, "### UT_UIManagerModuleTest ### " + (currentReactContext != null));

            if (currentReactContext != null)
            {
                Log.Info(ReactConstants.Tag, "### [BGN] UT_UIManagerModuleTest ### ");

                UIManagerModule uiMgrModule = currentReactContext.ReactInstance.GetNativeModule <UIManagerModule>();
                //

                /*
                 * //Log.Info(ReactConstants.Tag, ">>>>>>>>>>>>>>> [UT]  Network BGN <<<<<<<<<<<<<<<<< ");
                 * NetworkingModule module = currentReactContext.ReactInstance.GetNativeModule<NetworkingModule>();
                 *
                 * var method = "GET";
                 *
                 * var passed = false;
                 * var waitHandle = new AutoResetEvent(false);
                 *
                 * module.sendRequest(method, new Uri("www.baidu.com"), 1, null, null, "", false, 1000);
                 * waitHandle.WaitOne();
                 */
                //Assert.IsTrue(passed);
                //Log.Info(ReactConstants.Tag, ">>>>>>>>>>>>>>> [UT]  Network BGN <<<<<<<<<<<<<<<<< ");
                //

                //2. TEXT
                //Log.Info(ReactConstants.Tag, "### [UT] Create a Text view ### ");
                //var prop = default(JObject);
                //uiMgrModule.createView(6, "RCTText", 1, prop);
                //uiMgrModule.OnBatchComplete();

                //int[] szTag = { 6, };
                //int[] szIndices = { 0, };
                //uiMgrModule.manageChildren(1, null, null, szTag, szIndices, null);
                //int[] szChildren = { 6, };
                //uiMgrModule.setChildren(1, szChildren);
                //uiMgrModule.OnBatchComplete();

                // grid
                //Log.Info(ReactConstants.Tag, "### [UT] Create a grid view ### ");
                //uiMgrModule.createView(2, "RCTGridView", 1, prop);

                /*
                 * //2. button
                 * Log.Info(ReactConstants.Tag, "### [BGN] Create a button view ### ");
                 * var prop1 = default(JObject);
                 * uiMgrModule.createView(3, "RCTButton", 1, prop1);
                 * uiMgrModule.OnBatchComplete();
                 *
                 * int[] szTag1 = { 3, };
                 * int[] szIndices1 = { 0, };
                 * uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null);
                 * uiMgrModule.OnBatchComplete();
                 * Log.Info(ReactConstants.Tag, "### [END] Create a button view ### ");
                 *
                 * for (int i = 1; i <= 10; i++)
                 * {
                 *  Log.Info(ReactConstants.Tag, "Count >>>> "+i+" sec");
                 *  Thread.Sleep(1000*1);
                 * }
                 *
                 * Log.Info(ReactConstants.Tag, "### [BGN] Destroy a button view ### ");
                 * int[] szTagDel = { 0 };
                 * int[] szIndicesDel = { 0, };
                 * uiMgrModule.manageChildren(1, null, null, null, null, szTagDel);
                 * uiMgrModule.OnBatchComplete();
                 * Log.Info(ReactConstants.Tag, "### [END] Destroy a button view ### ");
                 */

                // scroll
                Log.Info(ReactConstants.Tag, "### [UT] Create a RCTScrollView ### ");
                var   propScroll          = default(JObject);
                int[] szScrollViewTag     = { 10, };
                int[] szScrollViewIndices = { 0, };
                uiMgrModule.createView(10, "RCTScrollView", 1, propScroll);
                uiMgrModule.manageChildren(1, null, null, szScrollViewTag, szScrollViewIndices, null);

                // View
                var propView = default(JObject);
                uiMgrModule.createView(11, "RCTView", 1, propView);
                int[] szViewTag     = { 11, };
                int[] szViewIndices = { 0, };
                uiMgrModule.manageChildren(10, null, null, szViewTag, szViewIndices, null);

                // image
                Log.Info(ReactConstants.Tag, "### [UT] Create a RCTImageView ### ");
                var propImage = default(JObject);
                uiMgrModule.createView(8, "RCTImageView", 1, propImage);
                int[] szImageTag     = { 8, };
                int[] szImageIndices = { 0, };
                uiMgrModule.manageChildren(11, null, null, szImageTag, szImageIndices, null);

                uiMgrModule.OnBatchComplete();

                //int[] childrenTag = { 8, };
                //uiMgrModule.setChildren(1, childrenTag);
                //uiMgrModule.OnBatchComplete();

                //int[] szTag1 = { 8,};
                //int[] szIndices1 = { 0,};

                //uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null);
                //Log.Info(ReactConstants.Tag, "### [END] Manage RCTImageView ### ");
                //uiMgrModule.OnBatchComplete();

                /*
                 * //2. Scroll
                 * Log.Info(ReactConstants.Tag, "### [UT] Create a Scroll view ### ");
                 * //var prop = default(JObject);
                 * uiMgrModule.createView(6, "RCTScrollView", 1, prop);
                 *
                 * //int[] szTag = { 21, };
                 * //int[] szIndices = { 0, };
                 * //uiMgrModule.manageChildren(1, null, null, szTag, szIndices, null);
                 *
                 * // Layout
                 * Log.Info(ReactConstants.Tag, "### [UT] Create a Layout view ### ");
                 * uiMgrModule.createView(10, "RCTView", 1, prop);
                 *
                 * int[] szTag1 = { 6, };
                 * int[] szIndices1 = { 0, };
                 * uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null);
                 *
                 * //Log.Info(ReactConstants.Tag, "### [UT] Create Image view ### ");
                 * uiMgrModule.createView(11, "RCTImageView", 1, prop);
                 * uiMgrModule.createView(12, "RCTImageView", 1, prop);
                 * int[] szTag = { 11, 12};
                 * int[] szIndices = { 0, 1 };
                 * uiMgrModule.manageChildren(6, null, null, szTag, szIndices, null);
                 */

                //Log.Info(ReactConstants.Tag, "### [UT] Create MyText view ### ");
                //uiMgrModule.createView(12, "RCTMyText", 1, prop);
                //uiMgrModule.createView(12, "RCTImageView", 1, prop);
                //int[] szTag1 = { 12, };
                //int[] szIndices1 = { 0, };
                //uiMgrModule.manageChildren(1, null, null, szTag1, szIndices1, null);

                // grid
                //Log.Info(ReactConstants.Tag, "### [UT] Create a grid view ### ");
                //uiMgrModule.createView(13, "RCTGridView", 1, prop);

                //int[] szTag5 = { 13, };
                //int[] szIndices5 = { 0, };
                //uiMgrModule.manageChildren(1, null, null, szTag5, szIndices5, null);

                //3. Image
                ////Log.Info(ReactConstants.Tag, "### [UT] Create two Image view ### ");
                //uiMgrModule.createView(23, "RCTImageView", 1, prop);
                //uiMgrModule.createView(24, "RCTImageView", 1, prop);

                // button
                //Log.Info(ReactConstants.Tag, "### [UT] Create a button view ### ");
                //uiMgrModule.createView(3, "RCTButton", 1, prop);


                //int[] szTag2 = { 23, 24 };
                //int[] szIndices2 = { 0, 1};
                //uiMgrModule.manageChildren(22, null, null, szTag2, szIndices2, null);

                // wait for 5 sec
                // Thread.Sleep(5000);

                // test for dispatchCommand of view
                //Log.Info(ReactConstants.Tag, "### [UT] Generate a command to the given view ### ");
                //var args = new JArray("Focus");
                //uiMgrModule.dispatchViewManagerCommand(3, 1, args);
                //uiMgrModule.dispatchViewManagerCommand(3, 2, args);


                Log.Info(ReactConstants.Tag, "### [END] UT_UIManagerModuleTest ### ");
            }
            // End UT
        }