Exemple #1
0
        public override Exception SaveProject(System.IO.Stream myStream)
        {
            Exception savingException = null;

            try
            {
                var info = new Altaxo.Serialization.Xml.XmlStreamSerializationInfo();
                using (var zippedStream = new ZipArchive(myStream, ZipArchiveMode.Create))
                {
                    CurrentOpenProject.SaveToZippedFile(zippedStream, info);

                    if (!Current.Dispatcher.InvokeRequired)
                    {
                        SaveWindowStateToZippedFile(zippedStream, info);
                    }
                }
            }
            catch (Exception exc)
            {
                savingException = exc;
            }
            finally
            {
                myStream.Close();
            }
            return(savingException);
        }
Exemple #2
0
        private Altaxo.Gui.Worksheet.Viewing.IWorksheetController CreateNewWorksheet_Unsynchronized(Altaxo.Data.DataTable table)
        {
            if (table.ParentObject == null)
            {
                CurrentOpenProject.DataTableCollection.Add(table);
            }

            return(CreateNewWorksheet(table, CurrentOpenProject.CreateNewTableLayout(table)));
        }
Exemple #3
0
        /// <summary>
        /// Creates a project item, and add it to the appropriate collection in the current project.
        /// Note that there might exist more specialized function to create a certain project item.
        /// </summary>
        /// <typeparam name="T">The type of project item to create.</typeparam>
        /// <param name="inFolder">The folder into which the project item is created.</param>
        /// <returns>The created project item.</returns>
        public T CreateDocument <T>(string inFolder) where T : IProjectItem
        {
            var collection = CurrentOpenProject.GetCollectionForProjectItemType(typeof(T));
            var itemName   = collection.FindNewItemNameInFolder(inFolder);

            if (collection.Contains(itemName))
            {
                return((T)collection[itemName]);
            }
            else
            {
                var projectItem = (T)System.Activator.CreateInstance(typeof(T));
                projectItem.Name = itemName;
                collection.Add(projectItem);
                return(projectItem);
            }
        }
Exemple #4
0
        private object OpenOrCreateViewContentForDocument_Unsynchronized(IProjectItem document)
        {
            // make sure the document is contained in our current project
            if (!CurrentOpenProject.ContainsItem(document))
            {
                CurrentOpenProject.AddItemWithThisOrModifiedName(document);
            }

            // if a content exist that show that graph, activate that content
            var foundContent = GetViewContentsForDocument(document).FirstOrDefault();

            if (foundContent != null)
            {
                foundContent.IsActive   = true;
                foundContent.IsSelected = true;
                return(foundContent);
            }
            else // not found
            {
                return(CreateNewViewContent_Unsynchronized(document));
            }
        }
Exemple #5
0
 /// <summary>
 /// Creates a table and the view content for that table.
 /// </summary>
 /// <param name="worksheetName">The name of the table to create.</param>
 /// <param name="bCreateDefaultColumns">If true, a default x and a y column is created.</param>
 /// <returns>The view content for the provided table.</returns>
 public Altaxo.Gui.Worksheet.Viewing.IWorksheetController CreateNewWorksheet(string worksheetName, bool bCreateDefaultColumns)
 {
     Altaxo.Data.DataTable dt1 = CurrentOpenProject.CreateNewTable(worksheetName, bCreateDefaultColumns);
     return(CreateNewWorksheet(dt1));
 }