private void logDateComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e) { if (logDateComboBox.SelectedIndex != -1) { foreach (LogDay ld in currentOUS.logLibrary) { if ((DateTime)logDateComboBox.SelectedValue == ld.dateTime) { logDayDisplay = ld; } } } logSessionComboBox.ItemsSource = logDayDisplay.sessionList; }
// Change User private void userNameComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (userNameComboBox.SelectedIndex != -1) { SaveSettings(); // Save settings of current user currentOUS = (OneUserSettings)allSets.userHashtable[userNameComboBox.SelectedItem]; // Refer currentOUS to the new OneUserSettings object // Update data binding after the reference of currentOUS changed userGrid.DataContext = currentOUS; viewGrid.DataContext = currentOUS; autoFeedGrid.DataContext = currentOUS.behaviorParas; posLibDataGrid.DataContext = currentOUS.posLibrary; logDateComboBox.ItemsSource = currentOUS.logLibrary; // Initialize today's log bool todayExist = false; foreach (LogDay ld in currentOUS.logLibrary) { if (ld.dateTime == DateTime.Today) { logDay = ld; todayExist = true; break; } } if (!todayExist) { logDay = new LogDay(DateTime.Today); } // Display settings on UI DisplaySettings(); } else { userInfoLabel.Content = "Who Are You?"; autoPosStackPanel.IsEnabled = false; preSetStackPanel.IsEnabled = false; autoFeedGrid.IsEnabled = false; //statGrid.IsEnabled = false; logGrid.IsEnabled = false; add2LibButton.IsEnabled = false; } }