private void OpenButton_Click(object sender, EventArgs e) { if (scheduleListBox.SelectedItems.Count == 0) { new AlertDialog("Select a schedule to open.").ShowDialog(); } else { // open the selected schedule string idString = FullSchedules[scheduleListBox.SelectedIndex][0]; Console.WriteLine(idString); DatabaseManager.OpenSchedule(idString); // refresh the calendar views and close RefreshCalendars.Refresh(); this.Close(); } }