Пример #1
0
        private void batchDownloaderMenuItem_Click(object sender, EventArgs e)
        {
            using (var dialog = new DownloadDialog(_webImporters))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (var tab in dialog.DownloadedTabs)
                    {
                        var libraryItem = _libraryManager.Add(tab);

                        //todo use objectliveview filtering instead of manual
                        if (TablatureLibraryItemVisible(SelectedLibrary(), libraryItem))
                        {
                            listViewLibrary.AddObject(libraryItem);
                        }
                    }
                }
            }
        }
Пример #2
0
        public override void Execute(object parameter)
        {
            var repository       = RepositoryManager.GetRepository(RepositoryManager.Folders);
            var folderRepository = repository.Entries.FirstOrDefault();

            if (folderRepository == null)
            {
                return;
            }

            var databaseUri = DatabaseUri.Empty;
            var searchText  = string.Empty;
            var name        = "Folder";

            do
            {
                var dialog = new SearchDialog(searchText, databaseUri, name);
                if (AppHost.Shell.ShowDialog(dialog) != true)
                {
                    return;
                }

                name        = dialog.SearchName;
                databaseUri = dialog.DatabaseUri ?? DatabaseUri.Empty;
                searchText  = dialog.SearchText;

                if (LibraryManager.Libraries.Any(w => string.Compare(w.Name, name, StringComparison.InvariantCultureIgnoreCase) == 0))
                {
                    AppHost.MessageBox(string.Format("A folder with the name '{0}' already exists.\n\nPlease choose another name.", name), "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    break;
                }
            }while (true);

            var fileName = IO.File.GetSafeFileName(name + ".xml");

            fileName = Path.Combine(folderRepository.Path, fileName);

            var folder = new SearchLibrary(fileName, name)
            {
                DatabaseUri = databaseUri,
                SearchText  = searchText
            };

            folder.Save();
            folder.Initialize();

            LibraryManager.Add(folder);

            folder.IsExpanded = true;
            folder.Refresh();
        }
Пример #3
0
        partial void ImportFile(MonoMac.Foundation.NSObject sender)
        {
            NSOpenPanel filePanel = NSOpenPanel.OpenPanel;

            string[] allowedFileTypes = { "pdf", "epub", "mobi" };
            filePanel.AllowedFileTypes = allowedFileTypes;

            int result = filePanel.RunModal();

            if (result == 1)
            {
                /*String bookPath = filePanel.Url.ToString ().Replace ("%20", " ");
                 * Book book = new Book();
                 * book.Title = Path.GetFileNameWithoutExtension (bookPath);
                 * book.FilePath = bookPath;
                 * Console.WriteLine (book.Title + " " + book.FilePath);*/
                libraryManager.Add(filePanel.Url.ToString().Replace("%20", " "));
                //libraryManager.AddBook (book);
                listViewController.tableView.ReloadData();
            }
        }
Пример #4
0
    protected void uploadFilesToEktron(FileUpload fiU)
    {
        // folder ID where I want the files to go

        long folderId = 103;

        // create the content item title in the form "YYYY T - CCCC" where Y is year, T is term and C is program code.

        string content_title = "aasdf" + DateTime.Now.ToString();

        // initialize framework.

        Ektron.Cms.API.Library libraryAPI = new Ektron.Cms.API.Library();

        LibraryManager lmgr = new LibraryManager();

        // determine if the item already exists.

        Ektron.Cms.Content.LibraryCriteria criteria = new Ektron.Cms.Content.LibraryCriteria();

        // upload the file to Ektron

        Ektron.Cms.LibraryConfigData lib_setting_data = libraryAPI.GetLibrarySettings(folderId);

        string filename = Server.MapPath(lib_setting_data.FileDirectory) + Path.GetFileName(fiU.FileName);

        Ektron.Cms.LibraryData item = new Ektron.Cms.LibraryData()

        {

            Title = content_title,

            ParentId = folderId,

            FileName = filename,

            File = File1.FileBytes

        };

        if (fiU.PostedFile.ContentType == "application/pdf")
        {

            lmgr.Add(item);

            ltlMessage.Text = "Library item added with ID = " + item.Id.ToString();

        }

        else

            ltlMessage.Text = "Not added. File must be a PDF.";
    }