예제 #1
0
        private void Mount(DataView dataView, DataSet <T> dataSet, Predicate <DataRow> where, IComparer <DataRow> orderBy, MountMode mode)
        {
            var inherit          = mode != MountMode.Show;
            var oldLayoutManager = _layoutManager;
            var template         = inherit ? Template : new Template();

            Debug.Assert(template != null);

            if (inherit)
            {
                DetachView();
                AttachView(dataView);
            }

            DataSet = dataSet.EnsureInitialized();
            using (var builder = new TemplateBuilder(template, DataSet.Model, inherit))
            {
                BuildTemplate(builder);
                builder.Seal();
            }
            _layoutManager = LayoutManager.Create(inherit ? oldLayoutManager : null, this, template, dataSet, GetMatchColumns(dataSet._), where, orderBy);
            ServiceManager.Reset(this, mode == MountMode.Reload);
            OnMounted(mode);
            dataView.OnDataLoaded();
        }
예제 #2
0
        private void Mount(DataSet <DummyModel> dataSet)
        {
            var template = new Template();

            template.AddGridColumns("*");
            template.AddGridRows("*");
            template.RowRange = new GridRange(template.GridColumns[0], template.GridRows[0]);
            using (var builder = new TemplateBuilder(template))
            {
                BuildTemplate(builder);
                builder.Seal();
            }

            dataSet.EnsureInitialized();
            _layoutManager = LayoutManager.Create(null, this, template, dataSet, null, null, null);
            OnMounted(MountMode.Show);

            if (View.IsLoaded)
            {
                Template.InitFocus();
            }
            else
            {
                View.Loaded += OnViewLoaded;
            }
        }