private void roomsBtnChangeZone_Click(object sender, EventArgs e) { //If we have no room loaded, abort. if (Editor.CurrentRoom == null) { MessageBox.Show("You must have a Room loaded prior to trying to change the Zone it belongs to.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //Creates a new instance of the Zones editor frmZones zones = new frmZones(); //We want to make sure and remove this Room from its current Zone if (Editor.CurrentZone != null) { Editor.CurrentZone.RemoveRoom(Editor.CurrentRoom); } //Flag changing zone as true so users can double-click and close the editor zones.ChangingZone = true; //Show it as a dialog. This prevents other editors from starting at the same time. //Ensures that the static Editor Type will only be accessed by one editor at a time. zones.ShowDialog(); //While the editor is visible, just keep the App responsive. while (zones.Visible) { Application.DoEvents(); } //Null the reference we have zones = null; //if no Zone was selected, warn the user that the Room will be lost when the editor //is closed or a new room is loaded. if (Editor.CurrentZone == null && Editor.CurrentRoom != null) { MessageBox.Show("You have not selected a Zone to place this Room within. It will not be saved if a Zone is not choosen from the Zone editor!", this.Text); return; } //Add the Room to the selected Zone. Editor.CurrentZone.AddRoom(Editor.CurrentRoom); //Re-setup our UI controls, selecting the currently selected Realm/Zone that this //Room belongs to. SetupEnvironment(); }
private void roomsBtnChangeZone_Click(object sender, EventArgs e) { //If we have no room loaded, abort. if (Editor.CurrentRoom == null) { MessageBox.Show("You must have a Room loaded prior to trying to change the Zone it belongs to.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //Creates a new instance of the Zones editor frmZones zones = new frmZones(); //We want to make sure and remove this Room from its current Zone if (Editor.CurrentZone != null) Editor.CurrentZone.RemoveRoom(Editor.CurrentRoom); //Flag changing zone as true so users can double-click and close the editor zones.ChangingZone = true; //Show it as a dialog. This prevents other editors from starting at the same time. //Ensures that the static Editor Type will only be accessed by one editor at a time. zones.ShowDialog(); //While the editor is visible, just keep the App responsive. while (zones.Visible) { Application.DoEvents(); } //Null the reference we have zones = null; //if no Zone was selected, warn the user that the Room will be lost when the editor //is closed or a new room is loaded. if (Editor.CurrentZone == null && Editor.CurrentRoom != null) { MessageBox.Show("You have not selected a Zone to place this Room within. It will not be saved if a Zone is not choosen from the Zone editor!", this.Text); return; } //Add the Room to the selected Zone. Editor.CurrentZone.AddRoom(Editor.CurrentRoom); //Re-setup our UI controls, selecting the currently selected Realm/Zone that this //Room belongs to. SetupEnvironment(); }