Beispiel #1
0
        private void btnLogIn_Click(object sender, RoutedEventArgs e)
        {
            // check if given password and email match the ones saved in the lists
            for (var i = 0; i < cooksList.Count; i++)
            {
                if (cooksList[i].email == txtBoxEmail.Text && cooksList[i].password == passwordBox.Password.ToString())
                {
                    MainSystemScreen mainScrn = new MainSystemScreen();

                    // pass on the lists
                    mainScrn.cooksList  = cooksList;
                    mainScrn.eatersList = eatersList;

                    // pass loged in cook
                    mainScrn.passedCook = cooksList[i];
                    // mainScrn.passedCook.pvg = newPVG;

                    // initialise main screen elements
                    mainScrn.lblUsrName.Content             = cooksList[i].firstName + " " + cooksList[i].lastName;
                    mainScrn.btnFriendsAndFamily.Visibility = Visibility.Hidden;

                    // open next window
                    mainScrn.Show();
                    this.Close();
                    break;
                }
            }
            for (var i = 0; i < eatersList.Count; i++)
            {
                if (eatersList[i].email == txtBoxEmail.Text && eatersList[i].password == passwordBox.Password.ToString())
                {
                    MainSystemScreen mainScrn = new MainSystemScreen();

                    // pass on the lists
                    mainScrn.cooksList  = cooksList;
                    mainScrn.eatersList = eatersList;

                    // pass logged in eater
                    mainScrn.passedEater = eatersList[i];

                    // initialise main screen elements
                    mainScrn.lblUsrName.Content         = eatersList[i].firstName + " " + eatersList[i].lastName;
                    mainScrn.btnSecurityChks.Visibility = Visibility.Hidden;
                    mainScrn.btnViewEaters.Visibility   = Visibility.Hidden;
                    mainScrn.lblChckStatus.Visibility   = Visibility.Hidden;
                    mainScrn.lblCertStat.Visibility     = Visibility.Hidden;
                    mainScrn.lblPVGStat.Visibility      = Visibility.Hidden;

                    // open next window
                    mainScrn.Show();
                    this.Close();
                    break;
                }
            }
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            newFnF.name  = txtbxName.Text;
            newFnF.email = txtbxEmail.Text;
            newFnF.phone = txtbxPhone.Text;

            // add the new friends and family details to the Eater
            passedEater.friendsAndFamily = newFnF;

            // add the eater to the list and pass it on
            if (!eatersList.Contains(passedEater))
            {
                eatersList.Add(passedEater);
            }

            MainSystemScreen mainScrn = new MainSystemScreen();

            mainScrn.cooksList  = cooksList;
            mainScrn.eatersList = eatersList;

            // initialise main screen elements
            mainScrn.lblUsrName.Content         = passedEater.firstName + " " + passedEater.lastName;
            mainScrn.btnSecurityChks.Visibility = Visibility.Hidden;
            mainScrn.btnViewEaters.Visibility   = Visibility.Hidden;

            // if this window was opened by the main system screen
            // and not from the new user sign up then just close this
            // otherwise close this, the window that created it and
            // open a new main screen window
            if (App.Current.Windows[0].Title == "Meal Sharers")
            {
                this.Close();
            }
            else
            {
                mainScrn.passedEater = passedEater;
                mainScrn.Show();
                this.Close();
                App.Current.Windows[0].Close();
            }
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            // if this window was opened by the main system screen
            // and not from the new user sign up then just close this
            // otherwise close this, the window that created it and
            // open a new main screen window
            if (App.Current.Windows[0].Title == "Meal Sharers")
            {
                if (lblFileFoodCert.Content.ToString() == "")
                {
                    foodCertStatusStr = "Pending";
                }
                else
                {
                    foodCertStatusStr = "OK!";
                }

                if (string.IsNullOrEmpty(lblFilePVG.Content.ToString()))
                {
                    pvgStatusStr = "Pending";
                }
                else
                {
                    pvgStatusStr = "OK!";
                }

                this.Close();
            }
            else
            {
                MainSystemScreen mainScrn = new MainSystemScreen();

                mainScrn.lblUsrName.Content             = passedCook.firstName + " " + passedCook.lastName;
                mainScrn.btnFriendsAndFamily.Visibility = Visibility.Hidden;

                // pass the current cook
                mainScrn.passedCook = passedCook;

                // pass the current cooks and eaters lists
                mainScrn.cooksList  = cooksList;
                mainScrn.eatersList = eatersList;

                if (lblFileFoodCert.Content.ToString() == "")
                {
                    mainScrn.lblCertStat.Content = "Pending";
                }
                else
                {
                    mainScrn.lblCertStat.Content = "OK!";
                }

                if (string.IsNullOrEmpty(lblFilePVG.Content.ToString()))
                {
                    mainScrn.lblPVGStat.Content = "Pending";
                }
                else
                {
                    mainScrn.lblCertStat.Content = "OK!";
                }

                // add the current cook to the list if it's not already in it
                if (!cooksList.Contains(passedCook))
                {
                    cooksList.Add(passedCook);
                }

                mainScrn.Show();
                this.Close();
                App.Current.Windows[0].Close();
            }
        }
Beispiel #4
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mainScreen = ((Coursework2.MainSystemScreen)(target));
                return;

            case 2:
                this.btnSecurityChks = ((System.Windows.Controls.Button)(target));

            #line 10 "..\..\MainSystemScreen.xaml"
                this.btnSecurityChks.Click += new System.Windows.RoutedEventHandler(this.btnSecurityChks_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.btnFriendsAndFamily = ((System.Windows.Controls.Button)(target));

            #line 13 "..\..\MainSystemScreen.xaml"
                this.btnFriendsAndFamily.Click += new System.Windows.RoutedEventHandler(this.btnFriendsAndFamily_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.btnViewEaters = ((System.Windows.Controls.Button)(target));

            #line 14 "..\..\MainSystemScreen.xaml"
                this.btnViewEaters.Click += new System.Windows.RoutedEventHandler(this.btnViewEaters_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.btnViewMealShares = ((System.Windows.Controls.Button)(target));

            #line 15 "..\..\MainSystemScreen.xaml"
                this.btnViewMealShares.Click += new System.Windows.RoutedEventHandler(this.btnViewMealShares_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.btnLogOut = ((System.Windows.Controls.Button)(target));

            #line 16 "..\..\MainSystemScreen.xaml"
                this.btnLogOut.Click += new System.Windows.RoutedEventHandler(this.btnLogOut_Click);

            #line default
            #line hidden
                return;

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

            case 8:
                this.lblLoggedInAs = ((System.Windows.Controls.Label)(target));
                return;

            case 9:
                this.lblUsrName = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.lblChckStatus = ((System.Windows.Controls.Label)(target));
                return;

            case 11:
                this.lblPVGStat = ((System.Windows.Controls.Label)(target));
                return;

            case 12:
                this.lblCertStat = ((System.Windows.Controls.Label)(target));
                return;

            case 13:
                this.lstviewEaters = ((System.Windows.Controls.ListView)(target));

            #line 24 "..\..\MainSystemScreen.xaml"
                this.lstviewEaters.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.lstviewEaters_SelectionChanged);

            #line default
            #line hidden
                return;

            case 14:
                this.btnSlctEater = ((System.Windows.Controls.Button)(target));

            #line 26 "..\..\MainSystemScreen.xaml"
                this.btnSlctEater.Click += new System.Windows.RoutedEventHandler(this.btnSlctEater_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }