Exemplo n.º 1
0
        private void CreateSuite(ImageTableTemplateCollection template)
        {
            var db = serverDatabaseTableSelector1.GetDiscoveredDatabase();

            if (!CreateDatabaseIfNotExists(db))
            {
                return;
            }


            DirectoryInfo dir = null;

            using (FolderBrowserDialog dialog = new FolderBrowserDialog
            {
                Description = "Select Project Directory (For Sql scripts/Executables etc)"
            })
            {
                //if we are creating a load we need to know where to store load scripts etc
                if (cbCreateLoad.Checked)
                {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        dir = new DirectoryInfo(dialog.SelectedPath);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            var cmd = new ExecuteCommandCreateNewImagingDatasetSuite(_activator.RepositoryLocator, db, dir)
            {
                DicomSourceType = rbJsonSources.Checked
                    ? typeof(DicomDatasetCollectionSource)
                    : typeof(DicomFileCollectionSource),
                CreateCoalescer = cbMergeNullability.Checked,
                CreateLoad      = cbCreateLoad.Checked,
                TablePrefix     = tbPrefix.Text,
                Template        = template
            };

            cmd.Execute();

            var firstCata = cmd.NewCataloguesCreated.First();

            if (firstCata != null)
            {
                _activator.Publish(firstCata);
            }

            MessageBox.Show("Create Suite Completed");
        }