/// <summary> /// Close the current Package /// </summary> /// <returns>true, if the Package was closed</returns> public bool Close() { if (pkg != null) { bool res = true; if (pkg.HasUserChanges) { DialogResult dr = SimPe.Message.Show( SimPe.Localization.Manager.GetString("savechanges").Replace("{filename}", FileName), SimPe.Localization.Manager.GetString("savechanges?"), MessageBoxButtons.YesNoCancel); if (dr == DialogResult.Yes) { res = Save(); } else if (dr == DialogResult.Cancel) { return(false); } } if (res) { FileNameEventArg e = new FileNameEventArg(this.FileName); if (BeforeFileClose != null) { BeforeFileClose(this, e); } if (e.Cancel) { res = false; } } if (res) { pkg.Close(); this.SetupEvents(false); pkg = null; } else { return(false); } } return(true); }