Esempio n. 1
0
        private void LoginBTN_Click(object sender, RoutedEventArgs e)
        {
            GalleryApi api = new GalleryApi();

            try
            {
                bool success = api.tryLoggin(Username.Text, Password.Password.ToString());

                if (success)
                {
                    string userId = api.getUserId(Username.Text);

                    galleryPage gallery = new galleryPage(Username.Text, userId);
                    gallery.Show();
                    this.Close();
                }
                else
                {
                    Username.BorderBrush = System.Windows.Media.Brushes.Red;
                    Password.BorderBrush = System.Windows.Media.Brushes.Red;

                    MessageBox.Show("Username and Password dont match.");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Esempio n. 2
0
        public GetUserNamePopup(bool NewPic, Album album, Img photo, bool tag, bool newAlbum, int ownerID)
        {
            InitializeComponent();

            this.api       = new GalleryApi();
            this._NewPic   = NewPic;
            this._album    = album;
            this._photo    = photo;
            this._tag      = tag;
            this._newAlbum = newAlbum;
            this._ownerID  = ownerID;

            // Id its Un/Tag user
            if (!newAlbum)
            {
                if (!this._NewPic)
                {
                    Un_Tag_User.Visibility = System.Windows.Visibility.Visible;
                }
                else // If its new picture.
                {
                    AddPhoto.Visibility = System.Windows.Visibility.Visible;
                }
            }
            else
            {
                NewAlbum.Visibility = System.Windows.Visibility.Visible;
            }
        }
Esempio n. 3
0
        public settingsPage(string username, string userid)
        {
            InitializeComponent();
            this.api       = new GalleryApi();
            this._username = username;
            this._userId   = userid;

            displaySettings();
        }
Esempio n. 4
0
        public ShowPhoto(Img photo, string userId)
        {
            InitializeComponent();

            this._userId = userId;
            api          = new GalleryApi();
            this._img    = photo;

            displayImage(photo);
        }
Esempio n. 5
0
        public profilePage(string userName, string userID)
        {
            InitializeComponent();
            api = new GalleryApi();

            this._userName = userName;
            this._userID   = userID;

            RefreshLists();
        }
Esempio n. 6
0
        public ShowAlbum(Album album, string userId)
        {
            InitializeComponent();

            this._userId    = userId;
            api             = new GalleryApi();
            this.opendAlbum = album;

            loadAlbumDetails();
        }
Esempio n. 7
0
        private void change_btn_Click(object sender, RoutedEventArgs e)
        {
            GalleryApi api = new GalleryApi();

            // Password & pass check dont match.
            if (CheckPassword.Password.ToString() != Password.Text)
            {
                Password.BorderBrush      = System.Windows.Media.Brushes.Red;
                CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                MessageBox.Show("Passwords don't match.");
            }

            // Check if pass is too short.
            else if (Password.Text.Length < 6)
            {
                // Check that password box arent empty.
                if (Password.Text.Length == 0)
                {
                    Password.BorderBrush = System.Windows.Media.Brushes.Red;
                }

                else if (CheckPassword.Password.Length == 0)
                {
                    CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                }

                else
                {
                    Password.BorderBrush      = System.Windows.Media.Brushes.Red;
                    CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                    MessageBox.Show("Passwords too short.");
                }
            }

            // If all is correct
            else
            {
                Password.BorderBrush      = System.Windows.Media.Brushes.Transparent;
                CheckPassword.BorderBrush = System.Windows.Media.Brushes.Transparent;

                try
                {
                    api.changePass(this._userId, Password.Text);
                    MessageBox.Show("Password was changed.");
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
        }
Esempio n. 8
0
        public homePage(string username, string userid)
        {
            InitializeComponent();
            this._userName   = username;
            this._userId     = userid;
            this._albumsList = albumsList;
            this._usersList  = usersList;
            this.api         = new GalleryApi();

            _listViewArr    = new ListView[4];
            _listViewArr[0] = photo1;
            _listViewArr[1] = photo2;
            _listViewArr[2] = photo3;
            _listViewArr[3] = photo4;

            RefreshLists();
        }
Esempio n. 9
0
        public SearchPage()
        {
            InitializeComponent();

            api = new GalleryApi();
        }
Esempio n. 10
0
        private void CompleteRegisterBTN_Click(object sender, RoutedEventArgs e)
        {
            GalleryApi api = new GalleryApi();

            // Check that username box arent empty.
            if (Username.Text.Length == 0)
            {
                Username.BorderBrush = System.Windows.Media.Brushes.Red;
                return;
            }

            try
            {
                // If user already exist
                if (api.userExist(Username.Text))
                {
                    Username.BorderBrush = System.Windows.Media.Brushes.Red;
                    MessageBox.Show("Username is taken.");
                    return;
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                return;
            }

            // Password & pass check dont match.
            if (CheckPassword.Password.ToString() != Password.Password.ToString())
            {
                Password.BorderBrush      = System.Windows.Media.Brushes.Red;
                CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                MessageBox.Show("Passwords don't match.");
            }

            // Check if pass is too short.
            else if (Password.Password.Length < 6)
            {
                // Check that password box arent empty.
                if (Password.Password.Length == 0)
                {
                    Password.BorderBrush = System.Windows.Media.Brushes.Red;
                }

                else if (CheckPassword.Password.Length == 0)
                {
                    CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                }

                else
                {
                    Password.BorderBrush      = System.Windows.Media.Brushes.Red;
                    CheckPassword.BorderBrush = System.Windows.Media.Brushes.Red;
                    MessageBox.Show("Passwords too short.");
                }
            }

            // If all is correct
            else
            {
                Password.BorderBrush      = System.Windows.Media.Brushes.Transparent;
                CheckPassword.BorderBrush = System.Windows.Media.Brushes.Transparent;
                Username.BorderBrush      = System.Windows.Media.Brushes.Transparent;

                try
                {
                    api.createUser(Username.Text, Password.Password.ToString());
                    MessageBox.Show("New account created.");

                    string      userId  = api.getUserId(Username.Text);
                    galleryPage gallery = new galleryPage(Username.Text, userId);
                    gallery.Show();
                    this.Close();
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                    MainWindow loginPage = new MainWindow();
                    loginPage.Show();

                    this.Close();
                }
            }
        }