Ejemplo n.º 1
0
 // Delete Current User
 private void userInfoDelButton_Click(object sender, RoutedEventArgs e)
 {
     currentOUS = new OneUserSettings();
     string temp = (string)userNameComboBox.SelectedItem;
     if (!String.IsNullOrEmpty(temp))
     {
         allSets.userHashtable.Remove(temp);
         userNameComboBox.Items.Remove(temp);
         userNameComboBox.SelectedIndex = -1;
     }
 }
Ejemplo n.º 2
0
        // 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;
            }
        }