Пример #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.Filter = "CMT XML (*.xml)|*.xml";

            if (dlg.ShowDialog() != true)
            {
                return;
            }
            List <MetaInfo> metainfos = MetaInfo.loadMetaInfos(dlg.FileName);

            if (metainfos.Count() < 1)
            {
                MessageBox.Show("The file contains no valid review form.");
                return;
            }
            if (metainfos.Count() == 1)
            {
                openXML(dlg.FileName, null);
                return;
            }
            closeXML();
            folderView.ItemsSource = metainfos;
            MessageBox.Show("The file contains multiple review forms. Please choose your form from the folder view on the left.");
        }
Пример #2
0
        private void openFolder(string folder)
        {
            this.folder = folder;
            string[]        files     = Directory.GetFiles(folder, "*.xml");
            List <MetaInfo> metainfos = new List <MetaInfo>();

            foreach (string file in files)
            {
                List <MetaInfo> fmetainfos = MetaInfo.loadMetaInfos(file);
                foreach (MetaInfo meta in fmetainfos)
                {
                    metainfos.Add(meta);
                }
            }
            folderView.ItemsSource = metainfos;
            if (metainfos.Count < 1)
            {
                folderView.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                folderView.Visibility = System.Windows.Visibility.Visible;
            }
        }