/// <summary> /// Direct the user to the next page (Thank you page). /// @Author Ameet and Karanbir /// Grabs user from mainwindow, adds Drive information and adds service. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void nextPage_Click(object sender, RoutedEventArgs e) { MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); //Add Drive info to user user.addDrive(myVehicleType, myCapacity, myStartTime, myEndTime, myFilePath); //Add driving service to user Service service = new Service(user.getName(), user.getEmail()); service.setServiceType(ServiceTypes.Drive); service.setDonationRequest(DonationTypes.Goods); service.setDescription("Driving goods."); user.addService(service); UserDatabase.updateDatabase(); ServiceDatabase serviceDatabase = mainWindow.GetServiceDatabase(); serviceDatabase.createService(ServiceTypes.Drive, DonationTypes.Goods, user, service); IInputElement target = NavigationHelper.FindFrame("ListPage1", this); NavigationCommands.GoToPage.Execute("/ThankYou.xaml", target); }
private void nextPage_Click(object sender, RoutedEventArgs e) { checkWhichButtonChecked(); MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); Service service = new Service(user.getName(), user.getEmail()); service.setServiceType(mainWindow.getServiceType()); service.setDonationRequest(myDonationType); if (myDonationType != DonationTypes.Other) { service.setDescription(myDonationType.ToString()); } else { service.setDescription(myDescription); } user.addService(service); ServiceDatabase serviceDatabase = mainWindow.GetServiceDatabase(); serviceDatabase.createService(mainWindow.getServiceType(), myDonationType, user, service); IInputElement target = NavigationHelper.FindFrame("ListPage1", this); NavigationCommands.GoToPage.Execute("/ThankYou.xaml", target); }
/// <summary> /// Constructs a sign in form for an existing user to sign in with. /// @Author Karanbir /// </summary> /// <param name="theMain"></param> public Form1(MainWindow theMain) { main = theMain; InitializeComponent(); this.CenterToScreen(); USER_DATABASE = new UserDatabase(); SERVICE_DATABASE = new ServiceDatabase(); emailBox.Text = "*****@*****.**"; passwordBox.Text = "password"; }
/// <summary> /// Constructs a MainWindow and hides it. /// @Author Karanbir and Ameet /// </summary> public MainWindow() { SERVICE_DATABASE = new ServiceDatabase(); USER_DATABASE = new UserDatabase(); this.Hide(); InitializeComponent(); Form1 login = new Form1(this); login.Show(); ReviewService review = new ReviewService(4, "the best"); Console.WriteLine(review.ToString()); }
/// <summary> /// Author: Ameet Toor /// Creates the service and adds the service to the user that is currently logged in. /// And directs the page to the Thank you page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContinueButton_Click(object sender, RoutedEventArgs e) { //Set service to have this subject MainWindow mainWindow = Application.Current.MainWindow as MainWindow; User user = mainWindow.getUser(); Service service = new Service(user.getName(), user.getEmail()); service.setServiceType(ServiceTypes.Educate); service.setDonationRequest(myDonationType); service.setDescription(myDescription); user.addService(service); ServiceDatabase serviceDatabase = mainWindow.GetServiceDatabase(); serviceDatabase.createService(ServiceTypes.Educate, myDonationType, user, service); //Direct to thank you page IInputElement target = NavigationHelper.FindFrame("ListPage1", this); NavigationCommands.GoToPage.Execute("/ThankYou.xaml", target); }