Ejemplo n.º 1
0
        public CreateLibraryViewModel()
        {
            AddLibraryCommand   = new RelayCommand(AddLibrary, CanAddLibrary);
            SelectFolderCommand = new RelayCommand(SelectFolder);

            Scanner = LibraryScannerFactory.GetDefault();
        }
Ejemplo n.º 2
0
        public void FromXML(XElement xmlElement)
        {
            LibraryPath = XMLHelper.GetSingleValue(xmlElement, "Path");
            Name        = XMLHelper.GetSingleValue(xmlElement, "Name");

            string scannerIdentifier = XMLHelper.GetSingleValue(xmlElement, "LibraryScanner");

            if (string.IsNullOrEmpty(scannerIdentifier))
            {
                Scanner = LibraryScannerFactory.GetDefault();
            }
            else
            {
                Scanner = LibraryScannerFactory.GetScanner(scannerIdentifier);
            }
        }
Ejemplo n.º 3
0
        private void AppWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");

            Task.Factory.StartNew(() =>
            {
                LibraryScannerFactory.LoadPlugins();

                Progress <UpdateReport> progress = new Progress <UpdateReport>();
                progress.ProgressChanged        += (a, b) =>
                {
                    ViewModelLocator.Instance.BrowseViewModel.UpdateBrowseList();
                    ViewModelLocator.Instance.SelectLibraryViewModel.UpdateBrowseList();
                };

                LibraryManager.Instance.LoadLibraries(progress);
            });
        }
Ejemplo n.º 4
0
        public XElement ToXML()
        {
            var libraryXML = new XElement("Library");

            if (!string.IsNullOrEmpty(Name))
            {
                libraryXML.Add(new XElement("Name", Name));
            }

            if (!string.IsNullOrEmpty(LibraryPath))
            {
                libraryXML.Add(new XElement("Path", LibraryPath));
            }

            if (!LibraryScannerFactory.GetDefault().GetIdentifier().Equals(Scanner.GetIdentifier()))
            {
                libraryXML.Add(new XElement("LibraryScanner", Scanner.GetIdentifier()));
            }

            return(libraryXML);
        }