Example #1
0
        public static void LoadWorkspace()
        {
            WorkspacePathEventArgs args = new WorkspacePathEventArgs(null, false);

            AskSavePathWorkspace?.Invoke(null, args);
            if (!string.IsNullOrEmpty(args.Path))
            {
                LoadWorkspace(args.Path);
            }
        }
Example #2
0
        public void SaveWorkspace()
        {
            if (string.IsNullOrEmpty(this.currentFilePath))
            {
                WorkspacePathEventArgs args = new WorkspacePathEventArgs(this, true);
                AskSavePathWorkspace?.Invoke(this, args);
                if (string.IsNullOrEmpty(args.Path))
                {
                    throw new ArgumentException("Path");
                }
                this.currentFilePath = args.Path;
            }

            using (Stream stream = new FileStream(this.currentFilePath, FileMode.Create))
            {
                //stream.
                XmlSerializer serializer = new XmlSerializer(typeof(StorageContainer));
                serializer.Serialize(stream, this.storageContainer);
                SetHasChanges(false);
            }
        }