Ejemplo n.º 1
0
        public void ImportExport()
        {
            if (Result == true)
            {
                ImportExportWorker importExportWorker = new ImportExportWorker();
                if (SelectedIndex == 0)
                {
                    importExportWorker.Export(ExportCollections.Where(c => c.IsSelected).Select(c => c.Name).ToArray(), Path, ExportFormatSelected);
                }
                if (SelectedIndex == 1)
                {
                    ImportStatus status = null;
                    switch (ImportType)
                    {
                    case ImportOption.NewCollection:
                        status = importExportWorker.ImportToNewCollection(ImportFilePath, NewCollectionName);
                        break;

                    case ImportOption.AddToCollection:
                        status = importExportWorker.ImportToExistingCollection(ImportFilePath, SelectedCollection);
                        break;
                    }

                    DoPostImport(status, ImportFilePath);
                }
            }
        }
Ejemplo n.º 2
0
        protected override bool OkCommandCanExecute(object o)
        {
            if (SelectedIndex == 0)
            {
                return(ExportCollections.Any(c => c.IsSelected) && Directory.Exists(Path));
            }
            if (SelectedIndex == 1)
            {
                switch (ImportType)
                {
                case ImportOption.NewCollection:
                    return(File.Exists(ImportFilePath) && !string.IsNullOrWhiteSpace(NewCollectionName) && !ImportCollections.Contains(NewCollectionName));

                case ImportOption.AddToCollection:
                    return(File.Exists(ImportFilePath) && SelectedCollection != null);
                }
            }

            return(false);
        }