private void BT_DeleteListing_Click(object sender, RoutedEventArgs e)
 {
     ListingManager listMan = new ListingManager();
     listMan.DeleteListing(selectedListingID);
 }
 private void UploadImages()
 {
     List<int> delImage = new List<int>();
     ListingManager listManager = new ListingManager();
     for(int i = 0; i<imageSource.Count; i++)
     {
         if (imageSource[i] == " " || imageSource[i] == "")
         {
             delImage.Add(i);
             listManager.EditListingImage(imageID[i],imageCaptions[i]);
         }
     }
     for (int i = delImage.Count - 1; i >= 0; i--)
     {
         if (delImage.IndexOf(i) != -1)
         {
             imageSource.RemoveAt(i);
             imageCaptions.RemoveAt(i);
         }
     }
         for (int i = 0; i < imageSource.Count; i++)
         {
             Console.WriteLine(i + " New " + imageID[i] + " - " + imageSource[i] + " with " + imageCaptions[i] + " of " + imageSource.Count);
         }
     Overlays.Listings.LoadingOverlay uploadImages = new Overlays.Listings.LoadingOverlay(propertyID, imageSource, imageCaptions);
     uploadImages.Owner = Framework.UI.Controls.Window.GetWindow(this);
     uploadImages.Show();
     (this.Tag as AgentWindow).HideEditListingView();
     (this.Tag as AgentWindow).ShowListingsView();
     ClearView();
 }
        private void UploadImages()
        {
            new System.Threading.Thread(() =>
                {
                    Hashing hashing = new Hashing();
                    List<string> urls = new List<string>();
                    List<string> links = new List<string>();

                    foreach( string localFile in localFilePaths)
                    {
                        string fileHash = hashing.HashFile(localFile);
                        string extension = System.IO.Path.GetExtension(localFile);

                        urls.Add(webDir + fileHash + extension );
                        links.Add(linkDir + fileHash + extension);
                    }

                    FtpManager ftpManger = new FtpManager();
                    ListingManager listingManager = new ListingManager();
                    ftpManger.OnProgressChange += ftpManger_OnProgressChange;

                    for( int i = 0; i < numberOfImages ; i++)
                    {
                        LoadImage(localFilePaths[i]);
                        UpdateProgress(numberOfImages, i+1);
                        ftpManger.UploadFile(localFilePaths[i], urls[i]);
                        listingManager.AddListingImage(propertyID, links[i], imageCaptions[i]);
                    }

                    CloseForm();
                }).Start();
        }