public void ChangeProfilePicture()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter           = "Image Files (JPG, JPEG, PNG)|*.jpg;*.jpeg;*.png";
            fileDialog.InitialDirectory = FileResources.WindowsPicturePath;
            fileDialog.ShowDialog();
            if (fileDialog.FileName.Length == 0)
            {
                return;
            }
            BackgroundWorker loaderWorker = new BackgroundWorker();

            loaderWorker.DoWork += (s, e) =>
            {
                Image  gotImg       = Image.FromFile(fileDialog.FileName);
                string profileImgId = ServerFileRequest.ChangeProfileImage(gotImg);
                if (profileImgId != null)
                {
                    Universal.ParentForm.Invoke(new Action(() =>
                    {
                        Consumer.LoggedIn.ProfileImage = LocalDataFileAccess.GetProfileImgFromLocalData(profileImgId);
                        userProfilePictureLabel.Image  = this.ResizedProfileImage;
                    }));
                }
                gotImg.Dispose();
            };
            loaderWorker.RunWorkerCompleted += (s, e) => { VisualizingTools.HideWaitingAnimation(); loaderWorker.Dispose(); };
            loaderWorker.RunWorkerAsync();
        }
 public bool SetProfileImage(string profileImageId)
 {
     if (LocalDataFileAccess.ProfileImgExistsInLocalData(profileImageId))
     {
         this.profileImageId = profileImageId;
         this.profileImage   = LocalDataFileAccess.GetProfileImgFromLocalData(this.profileImageId);
         return(true);
     }
     return(false);
 }