Exemplo n.º 1
0
        public List <Table> Preview()
        {
            using (var dialog = new OpenFileDialog())
            {
                dialog.Filter = "Power Designer|*.pdm";
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }

                pdmFileName = dialog.FileName;
            }

            var pdm = PdmParser.Parse(pdmFileName);

            using (var frm = new frmTableSelector(pdm))
            {
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    return(frm.Selected);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        private List <Table> InternalGetSchemas(List <Table> tables, TableSchemaProcessHandler processHandler)
        {
            var result     = new List <Table>();
            var parser     = new PdmParser(pdmFileName);
            var tableCount = tables.Count;
            var index      = 0;

            var calc = new Func <int, int>(i =>
            {
                return((int)((i / (tableCount * 1.0)) * 100));
            });

            var host = new Host();

            foreach (PdmTable t in tables)
            {
                if (Processor.IsCancellationRequested())
                {
                    return(null);
                }

                if (processHandler != null)
                {
                    processHandler(t.Name, calc(++index));
                }

                var table = parser.ParseTable(t);
                if (table == null)
                {
                    continue;
                }

                result.Add(table);
                host.Attach(table);
            }

            parser.ParseReferences(tables, result);

            return(result);
        }