Example #1
0
        private void btnAddClasses_Click(object sender, RoutedEventArgs e)
        {
            if (_eom == null)
            {
                //注意:从 CommonModel 中获取的实体类,是没有继承关系的。
                CommonModel.Entities.EnsureAllLoaded();
                var converter = new MetaToEOM(CommonModel.Entities.Where(m => m.EntityCategory != EntityCategory.QueryObject));
                _eom = converter.Read();
            }

            var content = new ChooseClassesControl(_eom);

            var res = App.Windows.ShowDialog(content, w =>
            {
                w.Title = "添加实体类".Translate();
                w.Width = 400;
            });

            if (res == WindowButton.Yes)
            {
                var typeList = content.SelectedEntities;
                if (typeList.Count > 0)
                {
                    var document = modelViewer.GetDocument();
                    ODMLDocumentHelper.AddToDocument(new AddToDocumentArgs
                    {
                        Docment = document,
                        TypeList = typeList,
                        AllTypes = _eom.EntityTypes
                    });
                    modelViewer.BindDocument(document);
                }
            }
        }
Example #2
0
        private void btnAddClasses_Click(object sender, RoutedEventArgs e)
        {
            if (_eom == null)
            {
                //注意:从 CommonModel 中获取的实体类,是没有继承关系的。
                CommonModel.Entities.EnsureAllLoaded();
                var converter = new MetaToEOM(CommonModel.Entities.Where(m => m.EntityCategory != EntityCategory.QueryObject));
                _eom = converter.Read();
            }

            var content = new ChooseClassesControl(_eom);

            var res = App.Windows.ShowDialog(content, w =>
            {
                w.Title = "添加实体类".Translate();
                w.Width = 400;
            });

            if (res == WindowButton.Yes)
            {
                var typeList = content.SelectedEntities;
                if (typeList.Count > 0)
                {
                    var document = modelViewer.GetDocument();
                    ODMLDocumentHelper.AddToDocument(new AddToDocumentArgs
                    {
                        Docment  = document,
                        TypeList = typeList,
                        AllTypes = _eom.EntityTypes
                    });
                    modelViewer.BindDocument(document);
                }
            }
        }