private void formBuilder_FormClosing(object sender, FormClosingEventArgs e) { // we only want to respond to a user action if (e.CloseReason != CloseReason.UserClosing) { return; } formBuilder form = sender as formBuilder; if (form == null) { return; } int index = this.fBuilders.IndexOf(form); if (index < 0) { return; } Build build = this.Builds[index]; if (build == null) { return; } e.Cancel = !this.PromptToClose(build.Name); return; }
/// <summary> /// Show the build window associated with the specified index /// </summary> /// <param name="index">Index of the build window to show</param> public void ShowBuild(int index) { if (index < 0 || index >= this.fBuilders.Count) { return; } formBuilder form = this.fBuilders[index]; Drawing.ToggleWindow(form, true); return; }
private void formBuilder_FormClosed(object sender, FormClosedEventArgs e) { formBuilder form = sender as formBuilder; if (form == null || e.CloseReason != CloseReason.UserClosing) { return; } this.fBuilders.Remove(form); this.Builds.Remove(form.Model.Build); return; }
private void CreateBuilderWindow(Build build, bool show) { formBuilder form = new formBuilder(build) { MdiParent = this.parentWindow, Name = build.Name }; form.FormClosed += this.formBuilder_FormClosed; form.FormClosing += this.formBuilder_FormClosing; this.fBuilders.Add(form); if (show) { Drawing.ToggleWindow(form, true); } return; }