Ejemplo n.º 1
0
        private void openMetadataToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            var cfg = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Metadata];

            using (var ofd = new OpenFileDialog())
            {
                ofd.InitialDirectory = cfg.FullPath;
                ofd.FileName         = cfg.File;
                ofd.Filter           = "CSV|*.csv|Excel 97-2003|*.xls";
                if (!string.IsNullOrEmpty(cfg.File))
                {
                    ofd.FilterIndex = cfg.File.EndsWith("csv") ? 1 : 2;
                }

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    var mr = MetadataFactory.GetReader(ofd.FileName);
                    var openMetadataDetailsForm = new MetadataOpen();
                    if (mr.SupportSheets)
                    {
                        openMetadataDetailsForm.MetadataReader = mr;
                        openMetadataDetailsForm.ShowDialog();
                    }

                    StartClick(null);

                    metadataTreeview.Nodes.Clear();

                    mr.ProgressStatusChanged += new ProgressStatusHandler(ProgressStatus);
                    Metadata = mr.Read();
                    mr.ProgressStatusChanged -= new ProgressStatusHandler(ProgressStatus);

                    metadataTreeview.Content = Metadata;

                    if (mr.SupportSheets && openMetadataDetailsForm.Track != "None")
                    {
                        var perspTrack = mr.Read(openMetadataDetailsForm.Track);
                        metadataTreeview.Selection = perspTrack;
                    }

                    cfg.FullFileName = ofd.FileName;

                    EndClick(null);
                }
            }
        }
Ejemplo n.º 2
0
        private void openMetadataToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            var cfg = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Metadata];
            using (var ofd = new OpenFileDialog())
            {
                ofd.InitialDirectory = cfg.FullPath;
                ofd.FileName = cfg.File;
                ofd.Filter = "CSV|*.csv|Excel 97-2003|*.xls";
                if (!string.IsNullOrEmpty(cfg.File))
                    ofd.FilterIndex = cfg.File.EndsWith("csv") ? 1 : 2;

                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    var mr = MetadataFactory.GetReader(ofd.FileName);
                    var openMetadataDetailsForm = new MetadataOpen();
                    if (mr.SupportSheets)
                    {
                        openMetadataDetailsForm.MetadataReader = mr;
                        openMetadataDetailsForm.ShowDialog();
                    }

                    StartClick(null);

                    metadataTreeview.Nodes.Clear();

                    mr.ProgressStatusChanged += new ProgressStatusHandler(ProgressStatus);
                    Metadata = mr.Read();
                    mr.ProgressStatusChanged -= new ProgressStatusHandler(ProgressStatus);

                    metadataTreeview.Content=Metadata;

                    if (mr.SupportSheets && openMetadataDetailsForm.Track != "None")
                    {
                        var perspTrack = mr.Read(openMetadataDetailsForm.Track);
                        metadataTreeview.Selection=perspTrack;
                    }

                    cfg.FullFileName = ofd.FileName;

                    EndClick(null);
                }
            }
        }