private bool OpenLineChart(DocumentWindow window, DocumentWindow other1, DocumentWindow other2, FrameworkElement icon, string title, List <string> choices, bool includePets, out DocumentWindow newWindow) { bool updated = false; newWindow = window; if (newWindow?.IsOpen == true) { newWindow.Close(); newWindow = null; } else { updated = true; var chart = new LineChart(choices, includePets); newWindow = new DocumentWindow(dockSite, title, title, null, chart); IconToWindow[icon.Name] = newWindow; Helpers.OpenWindow(newWindow); newWindow.CanFloat = true; newWindow.CanClose = true; if (other1?.IsOpen == true || other2?.IsOpen == true) { newWindow.MoveToNextContainer(); } else { newWindow.MoveToNewHorizontalContainer(); } } return(updated); }