public CultivationEditorForm() { InitializeComponent(); //https://github.com/alexander-makarov/ExpandCollapsePanel this.toolboxPanel = new ToolboxPanel(); this.toolboxPanel.Show(this.dockPanel1, DockState.DockLeft); this.projectWindow = new ProjectWindow(); this.projectWindow.Show(this.dockPanel1, DockState.Document); this.propertiesPanel = new PropertiesPanel(); this.propertiesPanel.Show(this.dockPanel1, DockState.DockRight); this.buildPanel = new BuildPanel(); this.buildPanel.Show(this.dockPanel1, DockState.DockBottomAutoHide); this.dockPanel1.DockLeftPortion = 225; this.dockPanel1.DockRightPortion = 300; this.projectService = new ProjectService(); sceneryEditorProject = new SceneryEditorProject(); }
public async Task SaveProject(SceneryEditorProject project, string filePath) { await Task.Run(() => { XmlSerializer xs = new XmlSerializer(typeof(SceneryEditorProject)); using (TextWriter tw = new StreamWriter(filePath)) { xs.Serialize(tw, project); } xs = null; }); }
public async Task <SceneryEditorProject> LoadProject(string filePath) { return(await Task.Run(() => { SceneryEditorProject project = new SceneryEditorProject(); XmlSerializer serializer = new XmlSerializer(typeof(SceneryEditorProject)); using (StreamReader reader = new StreamReader(filePath)) { project = (SceneryEditorProject)serializer.Deserialize(reader); reader.Close(); } serializer = null; return project; })); }