private async void RefreshList()
        {
            sp.Children.Clear();
            if (listdata == null)
            {
                return;
            }
            for (int i = 0, total = listdata.getCount(); i < total; i++)
            {
                var           dataitem          = listdata.getData(i) as doJsonValue;
                int           _index            = doTextHelper.StrToInt(dataitem.GetNode().GetOneText("cellTemplate", "0"), 0);
                string        templateUI        = cellTemplates[_index];
                string        templateUIContent = cellTemplatecontents[_index];
                doUIContainer _doUIContainer    = new doUIContainer(model.CurrentPage);
                _doUIContainer.loadFromContent(templateUIContent, null, null);
                _doUIContainer.loadDefalutScriptFile(templateUI);
                doIUIModuleView _doIUIModuleView = null;
                _doIUIModuleView = _doUIContainer.RootView.CurrentComponentUIView;

                if (_doIUIModuleView != null)
                {
                    await _doIUIModuleView.GetModel().SetModelData(null, dataitem);

                    AddChildControl((FrameworkElement)_doIUIModuleView, i);
                }
            }
        }
Exemple #2
0
        private void showView(doJsonNode _dictParas, doIScriptEngine _scriptEngine, doInvokeResult _invokeResult)
        {
            canvas.Children.Clear();
            string id = _dictParas.GetOneText("id", "");

            if (!viewmap.ContainsKey(id))
            {
                return;
            }
            doSourceFile _uiFile = _scriptEngine.CurrentApp.SourceFS.GetSourceByFileName(viewmap[id]);

            if (_uiFile == null)
            {
                throw new Exception("试图打开一个无效的页面文件:" + viewmap[id]);
            }
            string        content        = _uiFile.TxtContent();
            doUIContainer _doUIContainer = new doUIContainer(model.CurrentPage);

            _doUIContainer.loadFromContent(content, null, null);
            _doUIContainer.loadDefalutScriptFile(viewmap[id]);
            FrameworkElement fe = _doUIContainer.RootView.CurrentComponentUIView as FrameworkElement;

            fe.Margin = new Thickness(doMyTools.setrealitymarginleft(_doUIContainer.RootView.X), doMyTools.setrealitymargintop(_doUIContainer.RootView.Y), 0, 0);
            fe.Width  = doMyTools.setrealitywidth(_doUIContainer.RootView.Width);
            fe.Height = doMyTools.setrealityheight(_doUIContainer.RootView.Height);

            canvas.Children.Add(fe);
            fireevent(id);
        }