private void tilesetEditor_FormClosed(object sender, FormClosedEventArgs e) { this.tilesetEditorSettings = new XElement(ElementNameTilesetEditor); this.tilesetEditor.SaveUserData(this.tilesetEditorSettings); this.tilesetEditor.FormClosed -= this.tilesetEditor_FormClosed; this.tilesetEditor.Dispose(); this.tilesetEditor = null; }
private void menuItemTilesetEditor_Click(object sender, EventArgs e) { TilesetEditor editor = this.RequestTilesetEditor(); if (editor.Pane != null) { editor.Pane.Activate(); editor.Focus(); } }
public TilesetEditor RequestTilesetEditor() { // Create a new tileset editor, if no is available right now if (this.tilesetEditor == null || this.tilesetEditor.IsDisposed) { this.tilesetEditor = new TilesetEditor(); this.tilesetEditor.FormClosed += this.tilesetEditor_FormClosed; // If there are cached settings available, apply them to the new editor if (this.tilePaletteSettings != null) { this.tilesetEditor.LoadUserData(this.tilePaletteSettings); } } // If we're not creating it as part of the loading procedure, add it to the main docking layout directly if (!this.isLoading) { this.tilesetEditor.Show(DualityEditorApp.MainForm.MainDockPanel); } return(this.tilesetEditor); }