Exemplo n.º 1
0
        public IGridDataRecords OpenData(byte[] dataSettings, IGridDataOpenContext openContext)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(dataSettings);

            if (thesettings == null || thesettings.FileName == null) // and maybe check that file exists and can be opened, etc?
            {
                return(null);
            }

            thesettings.TryFindFile(openContext);
            return(new CSVGridDataRecords(thesettings));
        }
Exemplo n.º 2
0
        public string GetDataSummary(byte[] dataSettings)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(dataSettings);

            if (thesettings == null || thesettings.FileName == null) // and maybe check that file exists and can be opened, etc?
            {
                return(null);
            }

            if (String.IsNullOrWhiteSpace(thesettings.ImportCulture) == false)
            {
                return(String.Format("Bound to CSV: {0}, Use headers = {1}, Separator = '{2}', Culture='{3}'", thesettings.FileName, thesettings.UseHeaders, thesettings.Separator, thesettings.ImportCulture));
            }

            return(String.Format("Bound to CSV: {0}, Use headers = {1}, Separator = '{2}'", thesettings.FileName, thesettings.UseHeaders, thesettings.Separator));
        }
Exemplo n.º 3
0
        public byte[] GetDataSettings(byte[] existingSettings)
        {
            CSVGridDataSettings thesettings = CSVGridDataSettings.FromBytes(existingSettings);

            if (thesettings == null)
            {
                thesettings = new CSVGridDataSettings();
            }

            SettingsDialog dlg = new SettingsDialog();

            dlg.SetSettings(thesettings);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                return(thesettings.ToBytes());
            }

            return(existingSettings);
        }