Пример #1
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try { 
                string username = txtUserName.Text;
                user = new UserViewModel();
                if (user.verify(username) != null)
                {
                    user.removeUser(username);
                    messageBox("User has been removed");
                    this.Frame.Navigate(typeof(MainPage));
                }
                else {
                    messageBox("Error!!! ");
                }
            }
            catch
            {

                messageBox("Error!!! cannot find user");
            }
            txtUserName.Text = "";
        }
        private void Commandhandler(IUICommand cmd)
        {
            HistoryViewModel myHistory = null;
            var lable = cmd.Label;
            myHistory = new HistoryViewModel();
            switch (lable)
            {
                case "Yes":

                     try 
                     { 
                        string username = txtUserName.Text;
                        user = new UserViewModel();
                        if (user.verify(username) != null)
                        {
                            user.removeUser(username);

                            this.Frame.Navigate(typeof(MainPage1));
                        }
                       else if(user.verify(username) == null)
                        { 
                            lblDeleted.Text = "Username not found";
                        }
        
                }
                catch
                {

                    //messageBox("Error!!! cannot find user");
                }
                txtUserName.Text = "";
                    break;
                case "No":
                    break;

            }
        }