private void btnSecurityChks_Click(object sender, RoutedEventArgs e) { SecurityChecksPrompt checksWin = new SecurityChecksPrompt(); // pass cook checksWin.passedCook = passedCook; // display stored files if any checksWin.lblFilePVG.Content = checksWin.passedCook.pvg.scan; checksWin.lblFileFoodCert.Content = checksWin.passedCook.foodHygiene.scan; checksWin.ShowDialog(); // update the status text if it has changed in the next window lblPVGStat.Content = checksWin.pvgStatusStr; lblCertStat.Content = checksWin.foodCertStatusStr; }
private void btnCookNext_Click(object sender, RoutedEventArgs e) { // check if all required fields are filled if (string.IsNullOrEmpty(txtbxFirstName.Text) || string.IsNullOrEmpty(txtbxLastName.Text) || string.IsNullOrEmpty(txtbxEmail.Text) || string.IsNullOrEmpty(txtbxAddressLn1.Text) || string.IsNullOrEmpty(txtbxCity.Text) || string.IsNullOrEmpty(txtbxPostCode.Text) || string.IsNullOrEmpty(pswrdbx1.Password.ToString()) || string.IsNullOrEmpty(foodSelection) || string.IsNullOrEmpty(travelSelection)) { MessageBox.Show("Please fill in all the required fields that are marked with an asterisk (*)"); } else { // check if passwords match if (pswrdbx1.Password.ToString() == pswrdbx2.Password.ToString()) { // when the cook's next button is pressed this takes the completed // form details and adds them to a cook object. The object is then added // to the list of cooks. newCook.firstName = txtbxFirstName.Text; newCook.lastName = txtbxLastName.Text; newCook.email = txtbxEmail.Text; newAddress.firstLine = txtbxAddressLn1.Text; newAddress.secondLine = txtbxAddressLn2.Text; newAddress.postCode = txtbxPostCode.Text; newAddress.city = txtbxCity.Text; newCook.address = newAddress; if (foodSelection == "Please Fill") { foodSelection = txtbxOther.Text; } newCook.cookPreferences = foodSelection; newCook.travelMethod = travelSelection; newCook.password = pswrdbx1.Password.ToString(); // initialise food certificate and pvg to avoid bugs newPVG.scan = ""; newPVG.status = ""; newFoodCert.scan = ""; newCook.pvg = newPVG; newCook.foodHygiene = newFoodCert; SecurityChecksPrompt checksWin = new SecurityChecksPrompt(); // pass newCook to the new window checksWin.passedCook = newCook; // pass the current cook and eater list checksWin.cooksList = cooksList; checksWin.eatersList = eatersList; // open the next window checksWin.ShowDialog(); } else { // display pop-up if passwords don't match MessageBox.Show("Passwords don't match. Please make sure you enter the same password on both firelds"); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.promptsScrn = ((Coursework2.SecurityChecksPrompt)(target)); return; case 2: this.imgWarning = ((System.Windows.Controls.Image)(target)); return; case 3: this.lblText = ((System.Windows.Controls.Label)(target)); return; case 4: this.lblLink1 = ((System.Windows.Controls.Label)(target)); return; case 5: this.lblLInk2 = ((System.Windows.Controls.Label)(target)); return; case 6: this.lblUpload1 = ((System.Windows.Controls.Label)(target)); return; case 7: this.btnBrowsePVG = ((System.Windows.Controls.Button)(target)); #line 18 "..\..\SecurityChecksPrompt.xaml" this.btnBrowsePVG.Click += new System.Windows.RoutedEventHandler(this.btnBrowsePVG_Click); #line default #line hidden return; case 8: this.lblFilePVG = ((System.Windows.Controls.Label)(target)); return; case 9: this.lblUpload2 = ((System.Windows.Controls.Label)(target)); return; case 10: this.btnBrowseFoodCert = ((System.Windows.Controls.Button)(target)); #line 22 "..\..\SecurityChecksPrompt.xaml" this.btnBrowseFoodCert.Click += new System.Windows.RoutedEventHandler(this.btnBrowseFoodCert_Click); #line default #line hidden return; case 11: this.lblFileFoodCert = ((System.Windows.Controls.Label)(target)); return; case 12: this.btnBack = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\SecurityChecksPrompt.xaml" this.btnBack.Click += new System.Windows.RoutedEventHandler(this.btnBack_Click); #line default #line hidden return; case 13: this.btnNext = ((System.Windows.Controls.Button)(target)); #line 26 "..\..\SecurityChecksPrompt.xaml" this.btnNext.Click += new System.Windows.RoutedEventHandler(this.btnNext_Click); #line default #line hidden return; case 14: this.btnPVG = ((System.Windows.Controls.Button)(target)); #line 27 "..\..\SecurityChecksPrompt.xaml" this.btnPVG.Click += new System.Windows.RoutedEventHandler(this.btnPVG_Click); #line default #line hidden return; case 15: this.btnCert = ((System.Windows.Controls.Button)(target)); #line 28 "..\..\SecurityChecksPrompt.xaml" this.btnCert.Click += new System.Windows.RoutedEventHandler(this.btnCert_Click); #line default #line hidden return; } this._contentLoaded = true; }