Esempio n. 1
0
        /// <summary>
        /// Adds a new dataset to the chart.
        /// </summary>
        /// <param name="datasets">Data set(s).</param>
        public async Task AddDataSet(params TDataSet[] datasets)
        {
            dirty = true;

            Datasets.AddRange(datasets);

            if (initialized)
            {
                await JSModule.AddDataSet(ElementId, datasets);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds new datasets and then update the chart.
        /// </summary>
        /// <param name="datasets">List of datasets.</param>
        /// <returns>A task that represents the asynchronous operation.</returns>
        public async Task AddDatasetsAndUpdate(params TDataSet[] datasets)
        {
            dirty = true;

            Datasets.AddRange(datasets);

            if (initialized)
            {
                await JS.AddDatasetsAndUpdate(JSRuntime, ElementId, datasets);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds new set of labels and datasets and then update the chart.
        /// </summary>
        /// <param name="labels">List of labels.</param>
        /// <param name="datasets">List of datasets.</param>
        /// <returns>A task that represents the asynchronous operation.</returns>
        public async Task AddLabelsDatasetsAndUpdate(IReadOnlyCollection <object> labels, params TDataSet[] datasets)
        {
            dirty = true;

            Labels.AddRange(labels);
            Datasets.AddRange(datasets);

            if (initialized)
            {
                await JSModule.AddLabelsDatasetsAndUpdate(ElementId, labels, datasets);
            }
        }
Esempio n. 4
0
        public IPTConfigReader(string path)
        {
            var xmlSerializer = new XmlSerializer(typeof(cpu));
            var deserialize   = (cpu)xmlSerializer.Deserialize(File.OpenRead(path));

            foreach (cpuBusinterfacelist o in deserialize.Items.Where(i => i is cpuBusinterfacelist))
            {
                foreach (cpuBusinterfacelistBusinterface businterface in o.Businterface)
                {
                    Telegrams.AddRange(businterface.Telegram);
                }
            }
            foreach (cpuDatasetlist cpuDatasetlist in deserialize.Items.Where(i => i is cpuDatasetlist))
            {
                Datasets.AddRange(cpuDatasetlist.Dataset);
            }
        }
        private async Task SetupDefinitionAsync()
        {
            try
            {
                var lstDefinitions = await QueuedTask.Run <List <DatasetInfo> >(() =>
                {
                    List <DatasetInfo> definitions = new List <DatasetInfo>();
                    if (_datastore is Geodatabase)
                    {
                        var geodatabase = _datastore as Geodatabase;
                        switch (DatasetTypeCategory.DatasetType)
                        {
                        case DatasetType.Table:
                            definitions = geodatabase.GetDefinitions <TableDefinition>().Select(CreateDataSetInfo).ToList();
                            break;

                        case DatasetType.FeatureClass:
                            definitions = geodatabase.GetDefinitions <FeatureClassDefinition>().Select(CreateDataSetInfo).ToList();
                            break;

                        case DatasetType.FeatureDataset:
                            definitions = geodatabase.GetDefinitions <FeatureDatasetDefinition>().Select(CreateDataSetInfo).ToList();
                            break;

                        case DatasetType.RelationshipClass:
                            definitions = geodatabase.GetDefinitions <RelationshipClassDefinition>().Select(CreateDataSetInfo).ToList();
                            break;

                        case DatasetType.AttributedRelationshipClass:
                            definitions = geodatabase.GetDefinitions <AttributedRelationshipClassDefinition>().Select(CreateDataSetInfo).ToList();
                            break;
                        }
                    }
                    else if (_datastore is Database)
                    {
                        var database = _datastore as Database;
                        IReadOnlyList <string> tableNames = database.GetTableNames();
                        foreach (string tableName in tableNames)
                        {
                            QueryDescription queryDescription = database.GetQueryDescription(tableName);
                            TableDefinition tableDefinition   = database.GetDefinition(queryDescription);
                            if (DatasetTypeCategory.DatasetType == DatasetType.Table || DatasetTypeCategory.DatasetType == DatasetType.FeatureClass)
                            {
                                definitions.Add(new DatasetInfo
                                {
                                    Name = tableDefinition.GetName(),
                                    DatasetDefinition = tableDefinition
                                });
                            }
                        }
                    }
                    else if (_datastore is FileSystemDatastore)
                    {
                        var shapefile = _datastore as FileSystemDatastore;
                        FileSystemConnectionPath shapefileConnectionPath = (FileSystemConnectionPath)shapefile.GetConnector();
                        DirectoryInfo directoryInfo = new DirectoryInfo(shapefileConnectionPath.Path.LocalPath);

                        if (DatasetTypeCategory.DatasetType == DatasetType.FeatureClass)
                        {
                            FileInfo[] filesWithShpExtension = directoryInfo.GetFiles("*.shp");

                            foreach (FileInfo file in filesWithShpExtension)
                            {
                                definitions.Add(CreateDataSetInfo(shapefile.GetDefinition <FeatureClassDefinition>(file.Name)));
                            }
                        }
                        if (DatasetTypeCategory.DatasetType == DatasetType.Table)
                        {
                            FileInfo[] filesWithDbfExtension = directoryInfo.GetFiles("*.dbf");

                            foreach (FileInfo file in filesWithDbfExtension)
                            {
                                definitions.Add(CreateDataSetInfo(shapefile.GetDefinition <TableDefinition>(file.Name)));
                            }
                        }
                    }
                    return(definitions);
                });

                Datasets.Clear();
                Datasets.AddRange(lstDefinitions);
                DefinitionDetails.Clear();
            }
            catch (Exception exObj)
            {
                MessageBox.Show(exObj.Message, "Error");
            }
        }