/// <summary>
        /// Adds a new location to the set of repositories
        /// </summary>
        /// <param name="location">The absolute path to the root of the repository location</param>
        public void AddLocation(string location)
        {
            var repo = new MediaRepository {DateAdded = DateTime.Now, Location = location, Id = Guid.NewGuid()};
            Repository.MediaRepositories.InsertOnSubmit(repo);
            Repository.SubmitChanges();

            UpdateLocations();
        }
        public LibraryLocation(LibraryWindow window, MediaRepository repository)
        {
            InitializeComponent();
            Controller = new LibraryLocationController(this);
            MediaRepository = repository;
            Window = window;

            LocationLabel.Content = repository.Location;

            var size = repository.MediaFiles.Sum(x => x.Size);
            SizeLabel.Content = size.FormatBytes();

            CountLabel.Content = repository.MediaFiles.Count.ToString("N");

            RemoveLocationButton.Click += RemoveLocationButtonClick;
        }
 partial void DeleteMediaRepository(MediaRepository instance);
 partial void UpdateMediaRepository(MediaRepository instance);
 partial void InsertMediaRepository(MediaRepository instance);
 public void RemoveRepository(MediaRepository mediaRepository)
 {
     Repository.MediaRepositories.DeleteOnSubmit(mediaRepository);
     Repository.SubmitChanges();
 }