void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.friendsAndFamilyScrn = ((Coursework2.FriendsAndFamily)(target));
                return;

            case 2:
                this.lblText1 = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.lblName = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.txtbxName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.lblEmail = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.txtbxEmail = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:
                this.lblPhone = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.txtbxPhone = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.btnCancel = ((System.Windows.Controls.Button)(target));

            #line 21 "..\..\FriendsAndFamily.xaml"
                this.btnCancel.Click += new System.Windows.RoutedEventHandler(this.btnCancel_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.btnNext = ((System.Windows.Controls.Button)(target));

            #line 22 "..\..\FriendsAndFamily.xaml"
                this.btnNext.Click += new System.Windows.RoutedEventHandler(this.btnNext_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 2
0
        private void btnFriendsAndFamily_Click(object sender, RoutedEventArgs e)
        {
            FriendsAndFamily fnfWindow = new FriendsAndFamily();

            // pass eater
            fnfWindow.passedEater = passedEater;

            // display stored details if any
            fnfWindow.txtbxName.Text  = passedEater.friendsAndFamily.name;
            fnfWindow.txtbxEmail.Text = passedEater.friendsAndFamily.email;
            fnfWindow.txtbxPhone.Text = passedEater.friendsAndFamily.phone;

            fnfWindow.ShowDialog();
        }
Exemplo n.º 3
0
        private void btnEaterNext_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) ||
                foodSelection == "Please Fill")
            {
                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())
                {
                    // pass the Eater details to Eater Object and open next Eater window
                    // when the eater's's next button is pressed this takes the completed
                    // form details and adds them to an eater object. The object is then added
                    // to the list of cooks.
                    newEater.firstName = txtbxFirstName.Text;
                    newEater.lastName  = txtbxLastName.Text;
                    newEater.email     = txtbxEmail.Text;

                    newAddress.firstLine  = txtbxAddressLn1.Text;
                    newAddress.secondLine = txtbxAddressLn2.Text;
                    newAddress.postCode   = txtbxPostCode.Text;
                    newAddress.city       = txtbxCity.Text;

                    newEater.address = newAddress;
                    if (foodSelection == "Please Fill")
                    {
                        foodSelection = txtbxOther.Text;
                    }
                    newEater.foodPreferences = foodSelection;

                    newEater.password = pswrdbx1.Password.ToString();

                    // initialise friends and family details to avoid bugs
                    newFnf.name  = "";
                    newFnf.email = "";
                    newFnf.phone = "";
                    newEater.friendsAndFamily = newFnf;

                    FriendsAndFamily fnfWindow = new FriendsAndFamily();

                    // pass newEater to the new window
                    fnfWindow.passedEater = newEater;

                    // pass the current cook and eater list
                    fnfWindow.cooksList  = cooksList;
                    fnfWindow.eatersList = eatersList;

                    // open the next window and close this one
                    fnfWindow.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");
                }
            }
        }