예제 #1
0
        public NewItem(LogInObject logInUserObject, ObjectOfWishLists listOfWishListsObject, string selectedList)
        {
            logInObjectUsable           = logInUserObject;
            listOfWishListsObjectUsable = listOfWishListsObject;

            InitializeComponent();
            FillComboBox(selectedList);
        }
예제 #2
0
        public NewWishList(LogInObject logInUserObject, ObjectOfWishLists listOfWishListsObject)
        {
            InitializeComponent();
            logInObjectUsable = logInUserObject;
            objectOfWishLits  = listOfWishListsObject;

            Dispatcher.Invoke(() =>
            {
                LabelUserName.Content = logInObjectUsable.user.username;
            });
        }
        public DeletePromptWishList(LogInObject logInObjectInput, WishList wishListInput)
        {
            logInObject = logInObjectInput;
            wishList    = wishListInput;

            InitializeComponent();
            Dispatcher.Invoke(() =>
            {
                LabelAreYouSure.Content = $"Are you sure you want to delete {wishList.wishListName}?";
            });
        }
예제 #4
0
        public DeletePrompt(LogInObject logIn, WishListItem wishItem)
        {
            logInObjectUsable = logIn;
            wishListItem      = wishItem;

            InitializeComponent();

            Dispatcher.Invoke(() =>
            {
                LabelAreYouSure.Content = $"Are you sure you want to delete {wishItem.wishItemName}?";
            });
        }
예제 #5
0
        public LoggedInWindow(LogInObject logInUserObject)
        {
            LogInObj = logInUserObject;
            InitializeComponent();
            Dispatcher.Invoke(() =>
            {
                UserName.Content = logInUserObject.user.username;
            });

            objectOfWishLists = GetListofLists(logInUserObject.user);
            FillListOfLists(objectOfWishLists);
        }
예제 #6
0
        public void HttpRequest(string userName, string password)
        {
            Task.Run(() =>
            {
                string postData    = "un=" + userName + "&pw=" + password;
                string method      = "POST";
                string phpFileName = "login.php";

                string jsonStr = "";
                string error   = "";
                try
                {
                    jsonStr = WebReq.WebRq(postData, method, phpFileName, "");
                }
                catch (System.Exception e)
                {
                    error = e.ToString();
                    Task.Run(() =>
                    {
                        InfoBarAsync("", error);
                        errorMessage   = error;
                        loadingLabelOn = false;
                    });
                }

                LogInObject logInUserObject = JsonConvert.DeserializeObject <LogInObject>(jsonStr);


                if (logInUserObject.success == 1)
                {
                    Dispatcher.Invoke(() =>
                    {
                        LoggedInWindow mainLogInWindow = new LoggedInWindow(logInUserObject);
                        mainLogInWindow.Show();
                        this.Close();
                    });
                }
                else if (logInUserObject.success != 1)
                {
                    Task.Run(() =>
                    {
                        InfoBarAsync("", logInUserObject.msg);
                        loadingLabelOn = false;
                    });
                }
            });
        }
예제 #7
0
        public ShareWindow(LogInObject logInObjectIn, ObjectOfWishLists objectOfWishListsIn, string selectedList)
        {
            logInObject       = logInObjectIn;
            objectOfWishLists = objectOfWishListsIn;

            InitializeComponent();
            Dispatcher.Invoke(() =>
            {
                //for testing

                FillComboBox(objectOfWishListsIn, selectedList);
                FillFriendList();
                Task.Run(() =>
                {
                });
            });
        }
예제 #8
0
        private void ButtonRegister_Click(object sender, RoutedEventArgs e)
        {
            userName       = TextBoxUserName.Text;
            password       = PasswordBox.Password;
            reTypePassword = PasswordBoxRetype.Password;
            eMail          = TextBoxEmail.Text;
            reTypeEMail    = TextBoxEmailRetype.Text;

            if (showRegistrationFields == false)
            {
                showRegistrationFields = true;
                ShowRegistration();
            }
            else
            {
                if (UserInputValidation.InputValidator(userName, false).ValidInput)
                {
                    Task.Run(() =>
                    {
                        string postData    = "un=" + userName + "&pw=" + password + "&email=" + eMail;
                        string method      = "POST";
                        string phpFileName = "regUser.php";
                        //WebReq.WebRq(postData, method, phpFileName);
                        string jsonStr = "";
                        string error   = "";

                        if (eMail == reTypeEMail && password == reTypePassword)
                        {
                            try
                            {
                                jsonStr = WebReq.WebRq(postData, method, phpFileName, "");
                            }
                            catch (System.Exception err)
                            {
                                error = err.ToString();
                                Task.Run(() =>
                                {
                                    InfoBarAsync("", error);
                                    errorMessage   = error;
                                    loadingLabelOn = false;
                                });
                            }

                            LogInObject logInUserObject = JsonConvert.DeserializeObject <LogInObject>(jsonStr);


                            if (logInUserObject.success == 1)
                            {
                                Dispatcher.Invoke(() =>
                                {
                                    LoggedInWindow mainLogInWindow = new LoggedInWindow(logInUserObject);
                                    mainLogInWindow.Show();
                                    this.Close();
                                });
                            }
                            else if (logInUserObject.success != 1)
                            {
                                Task.Run(() =>
                                {
                                    InfoBarAsync("", logInUserObject.msg);
                                    loadingLabelOn = false;
                                });
                            }
                        }
                        else
                        {
                            if (eMail != reTypeEMail)
                            {
                                InfoBarAsync("", "E-mails do not match.");
                                errorMessage = "E-mails do not match.";
                            }
                            else
                            {
                                InfoBarAsync("", "Passwords do not match.");
                                errorMessage = "Passwords do not match.";
                            }
                        }
                    });
                }
            }
        }