Esempio n. 1
0
        async private Task AddDataset(IDataset dataset)
        {
            if (dataset == null || await dataset.Elements() == null)
            {
                return;
            }

            if (dataset.State != DatasetState.opened)
            {
                if (!await dataset.Open())
                {
                    MessageBox.Show("Can't open dataset '" + dataset.DatasetName + "'.\n" + dataset.LastErrorMessage);
                    return;
                }
            }

            foreach (IDatasetElement element in await dataset.Elements())
            {
                if (element == null)
                {
                    continue;
                }
                ILayer layer = LayerFactory.Create(element.Class);

                dgLayers.Rows.Add(new object[] { true, element.Title, true });
                _elements.Add(new DatasetItemElement(dataset, layer));
            }
        }