private void AvatarImage_Initialized(object sender, EventArgs e)
        {
            Image AvatarImage = sender as Image;

            User user = AvatarImage.DataContext as User;

            if (user.Id != -1)
            {
                try
                {
                    AvatarImage.Source = UIElementsMethods.InitializingBitmapImage(user.Avatar.ImageSource, imageFolder);
                }
                catch
                {
                    try
                    {
                        AvatarImage.Source = UIElementsMethods.InitializingBitmapImage(defaultImageSource, imageFolder);
                    }
                    catch { }
                }
            }
            else
            {
                try
                {
                    AvatarImage.Source = UIElementsMethods.InitializingBitmapImage(noneImageSource, imageFolder);
                }
                catch { }
            }
        }
 private void InitializingTheImageSource(string regularSource, string defaultSource, string folder, Image PictureImage)
 {
     try
     {
         PictureImage.Source = UIElementsMethods.InitializingBitmapImage(regularSource, folder);
     }
     catch
     {
         try
         {
             PictureImage.Source = UIElementsMethods.InitializingBitmapImage(defaultSource, folder);
         }
         catch { }
     }
 }
        private Picture UploadingImage(Image Image)
        {
            try
            {
                WorkWithImages imageUploadingProcess = new WorkWithImages();

                imageUploadingProcess.UploadImageAndSave(imageFolder);

                Picture picture = imageUploadingProcess.Picture;

                Image.Source = UIElementsMethods.InitializingBitmapImage(picture.ImageSource, imageFolder);

                return(picture);
            }
            catch { return(null); }
        }