/// <summary> /// Gets called when a worksheet tab was closed. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event arguments.</param> void OnTabClose(object sender, CloseEventArgs e) { TabButton button = sender as TabButton; if (button != null) { Dialog d = new Dialog(); d.Title = "Remove worksheet"; d.Content = new Label(string.Format("Remove worksheet \"{0}\"?", button.Label)); d.Buttons.Add(new DialogButton("Remove", Command.Ok)); d.Buttons.Add(new DialogButton(Command.Cancel)); Command r = d.Run(); if (r != null && r.Id == Command.Ok.Id) { pipelines.Remove(button.Label); Log.Add(LogLevel.Info, this.GetType().Name, "Removed worksheet \"" + button.Label + "\""); PipelineView nextPipeline; pipelines.TryGetValue(tabHost.SelectedItem.Label, out nextPipeline); if (nextPipeline != null) { CurrentPipeline = nextPipeline; } e.Close = true; } else { e.Close = false; } d.Dispose(); } }
/// <summary> /// Raises when one tab should be closed. /// </summary> /// <param name="sender">Tab.</param> /// <param name="e">Event arguments.</param> void OnTabClose(object sender, CloseEventArgs e) { TabButton button = sender as TabButton; if (button != null && (CanCloseAll || Children.Count() > 1)) { if (SelectedIndex == Children.Count() - 1) { SelectedIndex -= 1; } if (tabClosedEvent != null) { tabClosedEvent(sender, e); } if (e.Close) { Remove(button); button.Dispose(); } } }
void OnTabClosed(object sender, CloseEventArgs e) { if (closeEvent != null) { closeEvent(sender, e); } }