Beispiel #1
0
        private async void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            DisableInput();

            HomeState homeState = Register_HomeStateComboBox.SelectedIndex == -1 ? HomeState.NA : (HomeState)Register_HomeStateComboBox.SelectedIndex;
            CollegeName collegeName = Register_CollegeNameComboBox.SelectedIndex == -1 ? CollegeName.NA : (CollegeName)Register_CollegeNameComboBox.SelectedIndex;
            ClassStanding classStanding = Register_ClassStandingComboBox.SelectedIndex == -1 ? ClassStanding.NA : (ClassStanding)Register_ClassStandingComboBox.SelectedIndex;
            Major major = Register_MajorComboBox.SelectedIndex == -1 ? Major.NA : (Major)Register_MajorComboBox.SelectedIndex;

            UserManager um = new UserManager();
            bool update = await um.Update(homeState, classStanding, collegeName, major);

            if (update)
            {
                if (um.CurrentUser.IsMentor)
                {
                    Frame.Navigate(typeof(MentorDashboard));
                }
                else
                {
                    Frame.Navigate(typeof(MenteeDashboard));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Could not update information. Check network connection and try again.");
                await md.ShowAsync();
            }

            EnableInput();
        }
        private async void ChangePasswordButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckChangePasswordUI())
                return;

            DisableInput();

            UserManager um = new UserManager();
            bool changePassword = await um.ChangePassword(ChangePassword_NewPasswordTextBox.Password);

            if (changePassword)
            {
                if(um.CurrentUser.IsMentor)
                {
                    Frame.Navigate(typeof(MentorDashboard));
                }
                else
                {
                    Frame.Navigate(typeof(MenteeDashboard));
                }
            }
            else
            {
                MessageDialog md = new MessageDialog("Failed to register account. Check you network connection and try again.");
                await md.ShowAsync();
            }

            EnableInput();
        }
Beispiel #3
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckLoginUI())
                return;

            DisableInput();

            UserManager um = new UserManager();
            bool login = await um.Login(Login_EmailTextBox.Text, Login_PasswordTextBox.Password);
            if (login)
            {
                if (um.CurrentUser.IsMentor)
                    Frame.Navigate(typeof(MentorDashboard));
                else
                    Frame.Navigate(typeof(MenteeDashboard));
            }
            else
            {
                MessageDialog md = new MessageDialog("Failed to register account. Check you network connection and try again.");
                await md.ShowAsync();
                Login_PasswordTextBox.Password = "";
                Login_PasswordTextBox.Focus(FocusState.Programmatic);
            }

            EnableInput();
        }
Beispiel #4
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     UserManager um = new UserManager();
     Register_CollegeNameComboBox.ItemsSource = Enum.GetNames(typeof(CollegeName));
     Register_CollegeNameComboBox.SelectedIndex = (int)um.CurrentUser.College;
     Register_HomeStateComboBox.ItemsSource = Enum.GetNames(typeof(HomeState));
     Register_HomeStateComboBox.SelectedIndex = (int)um.CurrentUser.HomeState;
     Register_MajorComboBox.ItemsSource = Enum.GetNames(typeof(Major));
     Register_MajorComboBox.SelectedIndex = (int)um.CurrentUser.Major;
     Register_ClassStandingComboBox.ItemsSource = Enum.GetNames(typeof(ClassStanding));
     Register_ClassStandingComboBox.SelectedIndex = (int)um.CurrentUser.ClassStanding;
 }
Beispiel #5
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     ConnectionManager cm = new ConnectionManager();
     UserManager um = new UserManager();
     _connections = cm.GetAssociatedConnections(um.CurrentUser);
     _users = new List<User>();
     foreach (Connection connection in _connections)
     {
         _users.Add(um.GetUser(um.CurrentUser.IsMentor ? connection.MenteeId : connection.MentorId));
     }
     ContactsComboBox.ItemsSource = _users.Select(x => x.FullName);
     MessagesComboBox.ItemsSource = _users.Select(x => x.FullName);
 }
Beispiel #6
0
        public UserDetail()
        {
            this.InitializeComponent();

            UserManager um=new UserManager ();

            NameTextBlock.Text = um.CurrentUser.FirstName + " " + um.CurrentUser.LastName;
            HomeTextBlock.Text = Enum.GetName(typeof(HomeState), um.CurrentUser.HomeState);
            StatusTextBlock.Text = um.CurrentUser.IsMentor ? "Mentor" : "Mentee";
            CollegeTextBlock.Text = Enum.GetName(typeof(CollegeName), um.CurrentUser.College);
            MajorTextBlock.Text = Enum.GetName(typeof(Major), um.CurrentUser.Major);
            YearTextBlock.Text = Enum.GetName(typeof(ClassStanding), um.CurrentUser.ClassStanding);

        }
Beispiel #7
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            Task task1 = new UserManager().InitialLoad();
            Task task2 = new ConnectionManager().InitialLoad();
            Task task3 = new MessageManager().InitialLoad();

            await task1;
            await task2;
            await task3;

            Frame rootFrame = Window.Current.Content as Frame;

            
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(Login), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #8
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Dictionary<string, int> parameters = (Dictionary<string, int>)e.Parameter;
            int collegeIndex = (int)parameters["CollegeName"];
            Search_CollegeNameComboBox.SelectedIndex = collegeIndex;
            CollegeName college = collegeIndex > -1 ? (CollegeName)collegeIndex : CollegeName.NA;
            int homeIndex = (int)parameters["HomeState"];
            Search_HomeStateComboBox.SelectedIndex = homeIndex;
            HomeState home = homeIndex > -1 ? (HomeState)homeIndex : HomeState.NA;
            int majorIndex = (int)parameters["Major"];
            Search_MajorComboBox.SelectedIndex = majorIndex;
            Major major = majorIndex > -1 ? (Major)majorIndex : Major.NA;
            int classStandingsIndex = (int)parameters["ClassStandings"];
            Search_ClassStandingComboBox.SelectedIndex = classStandingsIndex;
            ClassStanding classStanding = classStandingsIndex > -1 ? (ClassStanding)classStandingsIndex : ClassStanding.NA;

            UserManager um = new UserManager();
            _users = um.Search(home, classStanding, college, major);
            ResultsListBox.ItemsSource = _users;
        }
Beispiel #9
0
 private void SearchButton_Click(object sender, RoutedEventArgs e)
 {
     UserManager um = new UserManager();
     //_users = um.Search(home, classStanding, college, major);
     ResultsListBox.ItemsSource = _users;
 }
Beispiel #10
0
        private async void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckRegisterUI())
                return;

            DisableInput();

            UserManager um = new UserManager();
            bool register = await um.Register(Register_FirstNameTextBox.Text, Register_LastNameTextBox.Text, Register_EmailTextBox.Text, Register_PasswordTextBox.Password, Register_MentorRadioButton.IsChecked.Value);
            if (register)
            {
                Frame.Navigate(typeof(Register));
            }
            else
            {
                MessageDialog md = new MessageDialog("Failed to register account. Check you network connection and try again.");
                await md.ShowAsync();
            }

            EnableInput();
        }