Esempio n. 1
0
        /// <summary>
        /// Opens the document.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        public void OpenDocument(string fileName)
        {
            Repository = new VfRepository();
            Repository.DataDirectory = Path.GetDirectoryName(fileName);
            Repository.DataFilePath = fileName;
            Repository.Initialize();

            var listDoc = Repository.GetAllDocuments();

            IVfDocumentModel document = GetDocument(listDoc.FirstOrDefault().Id);

            ((MainForm)MainForm).DisplayView(new VfDocumentView(document.Id));
        }
Esempio n. 2
0
        /// <summary>
        /// News the document.
        /// </summary>
        public void NewDocument()
        {
            NewDocumentForm ndf = new NewDocumentForm("Book Title", VfRepository.DefaultDataDirectory);

            if (ndf.ShowDialog(MainForm) == DialogResult.OK)
            {
                Repository = new VfRepository();
                Repository.DataDirectory = ndf.Directory;
                Repository.DataFilePath = Path.Combine(new string[] { ndf.Directory, String.Format("{0}.xml", ndf.Title) });
                Repository.Initialize();

                IVfDocumentModel document = new VfDocumentModel()
                {
                    Title = ndf.Title
                };

                Guid docId = Repository.AddDocument(document);

                document = GetDocument(docId);
                ((MainForm)MainForm).DisplayView(new VfDocumentView(document.Id));
            }
        }