示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Package p = new Package();
            p.unique_identifier = "boo";
            p.version = "1";
            Manifest manifest = new Manifest();
            manifest.AddItem(new Item("id1",".\\test.html","application/xhtml+xml", null));
            manifest.AddItem(new Item("id2", ".\\test.html", "application/xhtml+xml", null));
            manifest.AddItem(new Item("toc", txtNcxFile.Text, "application/x-dtbncx+xml", null));
            p.myManifest = manifest;

            Metadata metadata = new Metadata();
            p.myMetadata = metadata;
            metadata.title = "My title";

            Spine s = new Spine("ncx");
            s.AddItemRef(new ItemRef("id11","yes"));
            s.AddItemRef(new ItemRef("id12","yes"));
            p.mySpine = s;

            Guide g = new Guide();
            g.AddReference(new Reference("toc", "title",txtNcxFile.Text));
            g.AddReference(new Reference("toc1", "title2", ".//ref.html"));

            p.myGuide = g;

            TextWriter tw = serialise(p);
            txtPackage.Text = tw.ToString();

            tw.Close();

            NavigationCentereXtended ncx = new NavigationCentereXtended();
            ncx.myDocAuthor = new DocAuthor("John h author");
            ncx.myDocTitle = new DocTitle("My Book..");

            ncx.myNavList.AddNavTarget(new NavTarget(new NavLabel("Nav Label 1"), new Content("content.html")));
            ncx.myNavList.AddNavTarget(new NavTarget(new NavLabel("Nav Label 2"), new Content("content2.html")));
            ncx.myNavMap.AddNavPoint(new NavPoint(1, "id1", "point class", new NavLabel("Nav Label 1"), new Content("srctext")));
            ncx.myNavMap.AddNavPoint(new NavPoint(1, "id1", "point class2 ", new NavLabel("Nav Label 2"), new Content("srctext")));

            ncx.myNcxHead = new NcxHead();
            ncx.myNcxHead.myMeta = new Meta("content", "name");

            ncx.myPageList.AddPageTarget(new PageTarget("id1", "type", "value", new NavLabel("txtLabel"), new Content("src1")));
            ncx.myPageList.AddPageTarget(new PageTarget("id2", "type", "value", new NavLabel("txtLabel2"), new Content("src2")));

            TextWriter tw2 = serialise(ncx);
            txtNcx.Text = tw2.ToString();
            tw2.Close();
        }
        /// <summary>
        /// Merge selected report items into manifest.
        /// </summary>
        public override void Execute()
        {
            if (CurrentDocument != null)
            {
                Project project = App.Instance.SalesForceApp.CurrentProject;

                // create the source manifest
                SourceFile[] files    = CurrentDocument.SelectedReportItems;
                Manifest     manifest = new Manifest(String.Format("{0} files selected from report", files.Length));
                foreach (SourceFile file in files)
                {
                    manifest.AddItem(file);
                }

                MergeManifestWindow dlg = new MergeManifestWindow();
                dlg.ManifestSources = new Manifest[] { manifest };
                dlg.ManifestSource  = manifest;
                dlg.ManifestTargets = project.GetManifests();

                if (App.ShowDialog(dlg))
                {
                    IDocument[]            targetDocuments = App.Instance.Content.GetDocumentsByEntity(dlg.ManifestTarget);
                    ManifestEditorDocument targetDocument  = targetDocuments.FirstOrDefault(d => d is ManifestEditorDocument) as ManifestEditorDocument;
                    if (targetDocument == null)
                    {
                        targetDocument = new ManifestEditorDocument(project, dlg.ManifestTarget);
                    }

                    targetDocument.Merge(dlg.ManifestSource);
                    App.Instance.Content.OpenDocument(targetDocument);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Save the manifest to file.
        /// </summary>
        public void Save()
        {
            Manifest.Clear();
            foreach (SourceFile file in Files)
            {
                Manifest.AddItem(file);
            }

            Manifest.Comment = View.Comment;

            Manifest.Save();
            IsDirty = false;
        }
示例#4
0
        /// <summary>
        /// Opens a new data edit view.
        /// </summary>
        public override void Execute()
        {
            if (CurrentDocument != null)
            {
                Project project = App.Instance.SalesForceApp.CurrentProject;

                EnterValueWindow dlg = new EnterValueWindow();
                dlg.Title       = "Create Manifest";
                dlg.ActionLabel = "Enter Manifest Name:";
                dlg.ActionLabel = "Create";
                if (App.ShowDialog(dlg))
                {
                    Manifest manifest = new Manifest(System.IO.Path.Combine(
                                                         project.ManifestFolder,
                                                         String.Format("{0}.xml", dlg.EnteredValue)));

                    if (App.Instance.SalesForceApp.CurrentProject.GetManifests().Contains(manifest))
                    {
                        throw new Exception("There is already a manifest named: " + manifest.Name);
                    }

                    foreach (SourceFile file in CurrentDocument.SelectedReportItems)
                    {
                        manifest.AddItem(file);
                    }
                    manifest.Save();

                    ManifestFolderNode manifestFolderNode = App.Instance.Navigation.GetNode <ManifestFolderNode>();
                    if (manifestFolderNode != null)
                    {
                        manifestFolderNode.AddManifest(manifest);
                    }

                    App.Instance.Content.OpenDocument(new ManifestEditorDocument(project, manifest));
                }
            }
        }