public PixmapSlicerForm RequestPixmapSlicerForm() { // Create a new slicing form, if none are available right now if (this.slicingForm == null || this.slicingForm.IsDisposed) { this.slicingForm = new PixmapSlicerForm(); this.slicingForm.FormClosed += this.slicingForm_FormClosed; // If there are cached settings available, apply them to the new editor if (this.editorBaseSettings != null) { this.slicingForm.UserSettings = this.editorBaseSettings.PixmapSlicer; this.slicingForm.ApplyUserSettings(); } if (!this.isLoading) { this.slicingForm.DockPanel = DualityEditorApp.MainForm.MainDockPanel; } } // If we're not creating it as part of the loading procedure, // add it to the main docking layout directly if (!this.isLoading) { this.slicingForm.Show(DualityEditorApp.MainForm.MainDockPanel); } return(this.slicingForm); }
public override void Perform(IEnumerable <Pixmap> pixmaps) { PixmapSlicerForm slicingForm = DualityEditorApp.GetPlugin <EditorBasePlugin>().RequestPixmapSlicerForm(); slicingForm.TargetPixmap = pixmaps.First(); slicingForm.Show(); }
private void slicingForm_FormClosed(object sender, FormClosedEventArgs e) { this.pixmapSlicerSettings = new XElement(ElementNamePixmapSlicer); this.slicingForm.SaveUserData(this.pixmapSlicerSettings); this.slicingForm.FormClosed -= this.slicingForm_FormClosed; this.slicingForm.Dispose(); this.slicingForm = null; }
private void slicingForm_FormClosed(object sender, FormClosedEventArgs e) { // Store the slicer forms user settings for when we re-open the form later on, or serialize // while it remains closed. this.editorBaseSettings.PixmapSlicer = this.slicingForm.UserSettings; this.slicingForm.FormClosed -= this.slicingForm_FormClosed; this.slicingForm.Dispose(); this.slicingForm = null; }