Example #1
1
 public RexLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
     GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
     string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
     GridRegion home, IPEndPoint clientIP, string mapTileURL, string searchURL)
     : base(account, aCircuit, pinfo, destination, invSkel, friendsList, libService, where, startlocation,
     position, lookAt, gestures, message, home, clientIP, mapTileURL, searchURL)
 {
 }
Example #2
0
        /// <summary>
        /// Converts the inventory library skeleton into the form required by the rpc request.
        /// </summary>
        /// <returns></returns>
        protected virtual ArrayList GetInventoryLibrary(ILibraryService library, IInventoryService invService)
        {
            //Dictionary<UUID, InventoryFolderImpl> rootFolders = library.GetAllFolders();
            //m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count);
            //Dictionary<UUID, InventoryFolderImpl> rootFolders = new Dictionary<UUID,InventoryFolderImpl>();
            ArrayList folderHashes = new ArrayList();

            /*List<InventoryFolderBase> rootFolders = invService.GetRootFolders(library.LibraryOwner);
             * Hashtable TempHash = new Hashtable();
             * TempHash["name"] = library.LibraryName;
             * TempHash["parent_id"] = UUID.Zero.ToString();
             * TempHash["version"] = (Int32)1;
             * TempHash["type_default"] = (Int32)9;
             * TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
             * folderHashes.Add(TempHash);
             *
             * List<UUID> rootFolderUUIDs = new List<UUID>();
             * foreach (InventoryFolderBase rootFolder in rootFolders)
             * {
             *  if (rootFolder.Name != "My Inventory")
             *  {
             *      rootFolderUUIDs.Add(rootFolder.ID);
             *  }
             * }
             *
             * if (rootFolderUUIDs.Count == 0)
             *  return folderHashes; //No default inventory
             *
             * foreach (UUID rootID in rootFolderUUIDs)
             * {
             *  TraverseFolder(library.LibraryOwner, rootID, invService, true, ref folderHashes);
             * }*/
            return(folderHashes);
        }
 public LibrariesController(
     IMapper mapper,
     ILibraryService libraryService)
 {
     this.mapper         = mapper;
     this.libraryService = libraryService;
 }
Example #4
0
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;

            IConfig assetConfig = source.Configs["DefaultXMLAssetLoader"];

            if (assetConfig == null)
            {
                return;
            }
            string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
                                                      String.Empty);
            bool assetLoaderEnabled = !assetConfig.GetBoolean("PreviouslyLoaded", false);

            if (!assetLoaderEnabled)
            {
                return;
            }

            registry.RegisterModuleInterface <DefaultAssetXMLLoader>(this);

            m_log.InfoFormat("[DefaultXMLAssetLoader]: Loading default asset set from {0}", loaderArgs);
            IAssetService assetService = registry.RequestModuleInterface <IAssetService>();

            ForEachDefaultXmlAsset(loaderArgs,
                                   delegate(AssetBase a)
            {
                if (!assetLoaderEnabled && assetService.GetExists(a.ID))
                {
                    return;
                }
                assetService.Store(a);
            });
        }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;
            m_registry = registry;
            m_Database = Framework.Utilities.DataManager.RequestPlugin<IInventoryData>();

            IConfig libConfig = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";
            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("WipeLibrariesOnNextLoad", false))
                {
                    service.ClearDefaultInventory(); //Nuke it
                    libConfig.Set("WipeLibrariesOnNextLoad", false);
                    source.Save();
                }
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                    return; //If it is loaded, don't reload
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
Example #6
0
        public AllocateCase(ICaseService caseService,
                            ITaskService taskService,
                            ILibraryService libraryService,
                            IService <Site> siteService)
        {
            if (caseService == null)
            {
                throw new ArgumentNullException(nameof(caseService));
            }
            if (taskService == null)
            {
                throw new ArgumentNullException(nameof(taskService));
            }
            if (libraryService == null)
            {
                throw new ArgumentNullException(nameof(libraryService));
            }
            if (siteService == null)
            {
                throw new ArgumentNullException(nameof(siteService));
            }

            _caseService    = caseService;
            _taskService    = taskService;
            _libraryService = libraryService;
            _siteService    = siteService;
        }
Example #7
0
        private static void Launching(string args)
        {
            string filePath = args;

            if (!File.Exists(filePath))
            {
                Console.WriteLine("File does not exist.");
                Exit();
            }

            var fileType = filePath.Substring(filePath.LastIndexOf(".") + 1);

            if (fileType != "json" && fileType != "xml")
            {
                Console.WriteLine("Sorry, Virtual Libary does not support given file type.");
                Exit();
            }

            IConfiguration configuration = new ConsoleConfiguration()
            {
                FilePath = filePath,
            };

            if (fileType == "json")
            {
                _bookRepository = new JsonBookRepository(configuration);
            }
            else
            {
                _bookRepository = new XmlBookRepository(configuration);
            }

            _libraryService   = new LibraryService(_bookRepository);
            _libraryPresenter = new ConsoleLibraryPresenter();
        }
Example #8
0
        public SongsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            ISettingsUtility settingsUtility,
            IPlayerService playerService)
        {
            _libraryCollectionService = libraryCollectionService;
            _settingsUtility          = settingsUtility;
            _playerService            = playerService;
            LibraryService            = libraryService;

            SortItems =
                Enum.GetValues(typeof(TrackSort))
                .Cast <TrackSort>()
                .Select(sort => new ListBoxItem {
                Content = sort.GetEnumText(), Tag = sort
            })
                .ToList();
            SortChangedCommand = new DelegateCommand <ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand  = new DelegateCommand(ShuffleAllExecute);

            var defaultSort = _settingsUtility.Read(ApplicationSettingsConstants.SongSort,
                                                    TrackSort.DateAdded,
                                                    SettingsStrategy.Roam);

            DefaultSort = SortItems.IndexOf(SortItems.FirstOrDefault(p => (TrackSort)p.Tag == defaultSort));
            ChangeSort(defaultSort);
        }
 public AccountController(UserManager <User> userManager, SignInManager <User> signInManager, ILibraryService libraryService)
 {
     _userManager    = userManager;
     _signInManager  = signInManager;
     _libraryService = libraryService;
     _userManager.UserValidators.Clear();
 }
Example #10
0
        public LibraryViewModel(ILibraryService service = null, RoutingState router = null)
        {
            Router   = router ?? Locator.Current.GetService <RoutingState>(RoutedViewHosts.Library);
            _service = service ?? Locator.Current.GetService <ILibraryService>();

            _result = this
                      .WhenAnyValue(x => x.Criteria)
                      .Throttle(TimeSpan.FromMilliseconds(150))
                      .Select(x => x?.Trim())
                      .DistinctUntilChanged()
                      .SelectMany(SearchBookAsync)
                      .ObserveOn(RxApp.MainThreadScheduler)
                      .ToProperty(this, x => x.Result);

            _hasNoResult = this
                           .WhenAnyValue(x => x.Result)
                           .Select(x => !(x?.Any() ?? false))
                           .ToProperty(this, x => x.HasNoResult);

            this.WhenAnyValue(x => x.SelectedBook)
            .Where(x => x != null)
            .Subscribe(ViewModels =>
            {
                Debug.WriteLine($"Changed book selection. {SelectedBook.Author} -- {SelectedBook.Title}");
                Router.Navigate.Execute(SelectedBook);
            });
        }
Example #11
0
 public virtual void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database           = Aurora.DataManager.DataManager.RequestPlugin <IInventoryData> ();
     m_UserAccountService = registry.RequestModuleInterface <IUserAccountService>();
     m_LibraryService     = registry.RequestModuleInterface <ILibraryService>();
     m_AssetService       = registry.RequestModuleInterface <IAssetService>();
 }
Example #12
0
        public ArtistPageViewModel(
            INavigationService navigationService,
            ILibraryService libraryService,
            IEnumerable <IMetadataProvider> metadataProviders,
            IConverter <WebAlbum, Album> webAlbumConverter,
            IConverter <WebArtist, Artist> webArtistConverter,
            IConverter <WebSong, Track> webSongConverter,
            ISettingsUtility settingsUtility)
        {
            _navigationService = navigationService;
            _libraryService    = libraryService;
            _webAlbumConverter = webAlbumConverter;
            _metadataProviders = metadataProviders.FilterAndSort <IExtendedMetadataProvider>();

            _webArtistConverter = webArtistConverter;
            _webSongConverter   = webSongConverter;
            _settingsUtility    = settingsUtility;

            AlbumClickCommand    = new DelegateCommand <ItemClickEventArgs>(AlbumClickExecute);
            WebAlbumClickCommand = new DelegateCommand <ItemClickEventArgs>(WebAlbumClickExecute);

            if (IsInDesignMode)
            {
                OnNavigatedTo("Childish Gambino", NavigationMode.New, new Dictionary <string, object>());
            }
        }
Example #13
0
        public ArtistPageViewModel(
            INavigationService navigationService,
            ILibraryService libraryService,
            IEnumerable<IMetadataProvider> metadataProviders,
            IConverter<WebAlbum, Album> webAlbumConverter,
            IConverter<WebArtist, Artist> webArtistConverter,
            IConverter<WebSong, Track> webSongConverter,
            ISettingsUtility settingsUtility)
        {
            _navigationService = navigationService;
            _libraryService = libraryService;
            _webAlbumConverter = webAlbumConverter;
            _metadataProviders = metadataProviders.FilterAndSort<IExtendedMetadataProvider>();

            _webArtistConverter = webArtistConverter;
            _webSongConverter = webSongConverter;
            _settingsUtility = settingsUtility;

            AlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(AlbumClickExecute);
            WebAlbumClickCommand = new DelegateCommand<ItemClickEventArgs>(WebAlbumClickExecute);

            if (IsInDesignMode)
            {
                OnNavigatedTo("Childish Gambino", NavigationMode.New, new Dictionary<string, object>());
            }
        }
Example #14
0
 public RexLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
     : base(config, simService, libraryService)
 {
     //TODO: Read configuration about m_UseOSInventory
     //TODO: Read configuration about rexavatar
     //TODO: Load rexavatar plugin
 }
        public void RegionLoaded(Scene s)
        {
            if (!Enabled)
            {
                return;
            }

            if (m_inventoryService == null)
            {
                m_inventoryService = s.InventoryService;
            }
            if (m_LibraryService == null)
            {
                m_LibraryService = s.LibraryService;
            }

            if (m_badRequests == null)
            {
                m_badRequests = new ExpiringKey <UUID>(30000);
            }

            if (m_inventoryService != null)
            {
                s.EventManager.OnRegisterCaps += RegisterCaps;
                ++m_nScenes;
            }
        }
Example #16
0
 public LibrariesController(ILibraryService libraryService , IUsersService usersService , IBookService bookssService , ICategoryService categoriesService)
 {
     this.libraryService = libraryService;
     this.usersService = usersService;
     this.booksService = bookssService;
     this.categoriesService = categoriesService;
 }
Example #17
0
 public LendingController(ILendingService lendingService, IClientService clientService, ILibraryService libraryService, IBookService bookService)
 {
     this.lendingService = lendingService;
     this.clientService  = clientService;
     this.libraryService = libraryService;
     this.bookService    = bookService;
 }
        /// <summary>
        ///     Converts the inventory library skeleton into the form required by the RPC request.
        /// </summary>
        /// <returns></returns>
        protected virtual ArrayList GetInventoryLibrary(ILibraryService library, IInventoryService inventoryService)
        {
            ArrayList AgentInventoryArray          = new ArrayList();
            List <InventoryFolderBase> rootFolders = inventoryService.GetRootFolders(library.LibraryOwnerUUID);
            Hashtable RootHash = new Hashtable();

            RootHash["name"]         = library.LibraryName;
            RootHash["parent_id"]    = UUID.Zero.ToString();
            RootHash["version"]      = 1;
            RootHash["type_default"] = 8;
            RootHash["folder_id"]    = library.LibraryRootFolderID.ToString();
            AgentInventoryArray.Add(RootHash);

            List <UUID> rootFolderUUIDs =
                (from rootFolder in rootFolders
                 where rootFolder.Name != InventoryFolderBase.ROOT_FOLDER_NAME
                 select rootFolder.ID).ToList();

            if (rootFolderUUIDs.Count != 0)
            {
                foreach (UUID rootfolderID in rootFolderUUIDs)
                {
                    TraverseFolder(library.LibraryOwnerUUID, rootfolderID, inventoryService, library, true,
                                   ref AgentInventoryArray);
                }
            }
            return(AgentInventoryArray);
        }
Example #19
0
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service  = service;
            m_registry = registry;
            m_Database = Aurora.DataManager.DataManager.RequestPlugin <IInventoryData>();

            IConfig      libConfig          = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";

            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("WipeLibrariesOnNextLoad", false))
                {
                    service.ClearDefaultInventory();//Nuke it
                    libConfig.Set("WipeLibrariesOnNextLoad", false);
                    source.Save();
                }
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                {
                    return; //If it is loaded, don't reload
                }
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
Example #20
0
 public virtual void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database = Aurora.DataManager.DataManager.RequestPlugin<IInventoryData> ();
     m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>();
     m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
     m_AssetService = registry.RequestModuleInterface<IAssetService>();
 }
 public RecipesController(CocktailsContext context, IRecipeService recipeService,
                          ILibraryService libraryService)
 {
     _context        = context;
     _recipeService  = recipeService;
     _libraryService = libraryService;
 }
Example #22
0
        public void RegionLoaded(Scene s)
        {
            if (!m_Enabled)
            {
                return;
            }

            m_InventoryService = m_scene.InventoryService;
            m_LibraryService   = m_scene.LibraryService;

            // We'll reuse the same handler for all requests.
            m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);

            m_scene.EventManager.OnRegisterCaps += RegisterCaps;

            if (m_workerThreads == null)
            {
                m_workerThreads = new Thread[2];

                for (uint i = 0; i < 2; i++)
                {
                    m_workerThreads[i] = Watchdog.StartThread(DoInventoryRequests,
                                                              String.Format("InventoryWorkerThread{0}", i),
                                                              ThreadPriority.Normal,
                                                              false,
                                                              true,
                                                              null,
                                                              int.MaxValue);
                }
            }
        }
Example #23
0
 public CreateLendingModel(ILendingService lendingService, IBookService bookService, IClientService clientService, ILibraryService libraryService)
 {
     this.lendingService = lendingService;
     this.bookService    = bookService;
     this.clientService  = clientService;
     this.libraryService = libraryService;
 }
        public BookFundValidatorBase(IBookService bookService, ILibraryService libraryService)
        {
            this.bookService    = bookService;
            this.libraryService = libraryService;

            CreateRules();
        }
 public LibrariesModel(ILibraryService libraryService, ILawyerService lawyerService,
                       IVeteranService veteranService)
 {
     _libraryService = libraryService;
     _lawyerService  = lawyerService;
     _veteranService = veteranService;
 }
Example #26
0
        public SongsPageViewModel(
            ILibraryCollectionService libraryCollectionService,
            ILibraryService libraryService,
            ISettingsUtility settingsUtility,
            IPlayerService playerService)
        {
            _libraryCollectionService = libraryCollectionService;
            _settingsUtility = settingsUtility;
            _playerService = playerService;
            LibraryService = libraryService;

            SortItems =
                Enum.GetValues(typeof (TrackSort))
                    .Cast<TrackSort>()
                    .Select(sort => new ListBoxItem { Content = sort.GetEnumText(), Tag = sort })
                    .ToList();
            SortChangedCommand = new DelegateCommand<ListBoxItem>(SortChangedExecute);
            ShuffleAllCommand = new DelegateCommand(ShuffleAllExecute);

            var defaultSort = _settingsUtility.Read(ApplicationSettingsConstants.SongSort,
                TrackSort.DateAdded,
                SettingsStrategy.Roam);
            DefaultSort = SortItems.IndexOf(SortItems.FirstOrDefault(p => (TrackSort)p.Tag == defaultSort));
            ChangeSort(defaultSort);
        }
Example #27
0
 public HomeController(ILogger <HomeController> logger, ILibraryService libraryService, IWebHostEnvironment webEnvironment, IBarcodeService barcodeService)
 {
     this.logger         = logger;
     this.libraryService = libraryService;
     this.webEnvironment = webEnvironment;
     this.barcodeService = barcodeService;
 }
Example #28
0
        private static async Task GetBookData(ILibraryData libraryClient, ILibraryService libraryService)
        {
            try
            {
                var books = await GetBooksData(libraryClient);

                foreach (var book in books)
                {
                    var bookmodel = new Book()
                    {
                        Id        = book.Id,
                        Name      = book.Name,
                        Publisher = book.Publisher,
                        Country   = book.Country,
                        Released  = Convert.ToDateTime(book.Released)
                    };

                    libraryService.Add(bookmodel);
                }
            }
            catch (ApiException ex)
            {
                var content = ex.GetContentAs <Dictionary <String, String> >();
                Console.WriteLine(ex.StatusCode);
            }
        }
        public WebFetchInvDescServerConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            if (configName != String.Empty)
                m_ConfigName = configName;

            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));

            string invService = serverConfig.GetString("InventoryService", String.Empty);

            if (invService == String.Empty)
                throw new Exception("No InventoryService in config file");

            Object[] args = new Object[] { config };
            m_InventoryService =
                    ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (m_InventoryService == null)
                throw new Exception(String.Format("Failed to load InventoryService from {0}; config is {1}", invService, m_ConfigName));

            string libService = serverConfig.GetString("LibraryService", String.Empty);
            m_LibraryService =
                    ServerUtils.LoadPlugin<ILibraryService>(libService, args);

            WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
            IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest);
            server.AddStreamHandler(reqHandler);
        }
Example #30
0
 public SyncClientService(ILibraryService libraryService, IAudioFileCacheService audioFileCacheService, ISyncDeviceSpecifications deviceSpecifications)
 {
     _libraryService = libraryService;
     _audioFileCacheService = audioFileCacheService;
     _deviceSpecifications = deviceSpecifications;
     Initialize();
 }
Example #31
0
        public ChangePrimaryProject(IPinService pinService,
                                    ITaskService taskService,
                                    ILibraryService libraryService,
                                    IService <Site> siteService)
        {
            if (pinService == null)
            {
                throw new ArgumentNullException(nameof(pinService));
            }
            if (taskService == null)
            {
                throw new ArgumentNullException(nameof(taskService));
            }
            if (libraryService == null)
            {
                throw new ArgumentNullException(nameof(libraryService));
            }
            if (siteService == null)
            {
                throw new ArgumentNullException(nameof(siteService));
            }

            _pinService     = pinService;
            _taskService    = taskService;
            _libraryService = libraryService;
            _siteService    = siteService;
        }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;

            IConfig assetConfig = source.Configs["DefaultXMLAssetLoader"];
            if (assetConfig == null){
                return;
            }
            string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
                        String.Empty);
            bool assetLoaderEnabled = !assetConfig.GetBoolean("PreviouslyLoaded", false);

            if (!assetLoaderEnabled)
                return;

            registry.RegisterModuleInterface<DefaultAssetXMLLoader>(this);

            MainConsole.Instance.InfoFormat("[DefaultXMLAssetLoader]: Loading default asset set from {0}", loaderArgs);
            IAssetService assetService = registry.RequestModuleInterface<IAssetService>();
            ForEachDefaultXmlAsset(loaderArgs,
                    delegate(AssetBase a)
                    {
                        if (!assetLoaderEnabled && assetService.GetExists(a.IDString))
                            return;
                        assetService.Store(a);
                    });
        }
Example #33
0
 public EditViewModel(ILibraryService libraryService, IEventAggregator eventAggregator)
 {
     this._eventAggregator = eventAggregator;
     var orderedEnumerable = libraryService.GetObjectsFromFile().Videos.OrderBy(v=>v.Category).ToList();
     this.Videos = new ObservableCollection<Video>(orderedEnumerable);
     this.SelectedVideo = this.Videos.FirstOrDefault();
 }
        public static void IgnoresParameterValuesInRecordedCalls(
            InMemoryRecordedCallRepository inMemoryRecordedCallRepository,
            ILibraryService realServiceWhileRecording,
            IEnumerable <int> countsWhileRecording,
            IEnumerable <int> countsDuringPlayback)
        {
            "Given a call storage object"
            .x(() => inMemoryRecordedCallRepository = new InMemoryRecordedCallRepository());

            "And a real service to wrap while recording"
            .x(() =>
            {
                realServiceWhileRecording = A.Fake <ILibraryService>();

                A.CallTo(() => realServiceWhileRecording.GetCount("1"))
                .Returns(0x1);
                A.CallTo(() => realServiceWhileRecording.GetCount("2"))
                .Returns(0x2);
            });

            "When I use a self-initializing fake in recording mode to get the counts for book 2 and 1"
            .x(() =>
            {
                using (var fakeService = SelfInitializingFake <ILibraryService> .For(() => realServiceWhileRecording, inMemoryRecordedCallRepository))
                {
                    var fake = fakeService.Object;

                    countsWhileRecording = new List <int>
                    {
                        fake.GetCount("2"),
                        fake.GetCount("1"),
                    };
                }
            });

            "And I use a self-initializing fake in playback mode to get the counts for book 1 and 2"
            .x(() =>
            {
                using (var playbackFakeService = SelfInitializingFake <ILibraryService> .For(UnusedFactory, inMemoryRecordedCallRepository))
                {
                    var fake = playbackFakeService.Object;

                    countsDuringPlayback = new List <int>
                    {
                        fake.GetCount("1"),
                        fake.GetCount("2"),
                    };
                }
            });

            "Then the recording fake returns the wrapped service's results"
            .x(() => countsWhileRecording.Should().Equal(0x2, 0x1));

            // These results demonstrate that the self-initializing fake relies on a script
            // defined by which methods are called, without regard to the arguments
            // passed to the methods.
            "And the playback fake returns results in 'recorded order'"
            .x(() => countsDuringPlayback.Should().Equal(0x2, 0x1));
        }
        public static void ReplaysRecordedCalls(
            InMemoryRecordedCallRepository inMemoryRecordedCallRepository,
            ILibraryService realServiceWhileRecording,
            IEnumerable <int> countsWhileRecording,
            IEnumerable <int> countsDuringPlayback)
        {
            "Given a call storage object".x(() => inMemoryRecordedCallRepository = new InMemoryRecordedCallRepository());

            "And a real service to wrap while recording"
            .x(() =>
            {
                realServiceWhileRecording = A.Fake <ILibraryService>();

                A.CallTo(() => realServiceWhileRecording.GetCount("1"))
                .ReturnsNextFromSequence(0x1A, 0x1B);
                A.CallTo(() => realServiceWhileRecording.GetCount("2"))
                .Returns(0x2);
            });

            "When I use a self-initializing fake in recording mode to get the counts for book 1, 2, and 1 again"
            .x(() =>
            {
                using (var fakeService = SelfInitializingFake <ILibraryService> .For(() => realServiceWhileRecording, inMemoryRecordedCallRepository))
                {
                    var fake             = fakeService.Object;
                    countsWhileRecording = new List <int>
                    {
                        fake.GetCount("1"),
                        fake.GetCount("2"),
                        fake.GetCount("1"),
                    };
                }
            });

            "And I use a self-initializing fake in playback mode to get the counts for book 1, 2, and 1 again"
            .x(() =>
            {
                using (var playbackFakeService = SelfInitializingFake <ILibraryService> .For(UnusedFactory, inMemoryRecordedCallRepository))
                {
                    var fake             = playbackFakeService.Object;
                    countsDuringPlayback = new List <int>
                    {
                        fake.GetCount("1"),
                        fake.GetCount("2"),
                        fake.GetCount("1"),
                    };
                }
            });

            "Then the recording fake forwards calls to the wrapped service"
            .x(() => A.CallTo(() => realServiceWhileRecording.GetCount("1"))
               .MustHaveHappenedTwiceExactly());

            "And the recording fake returns the wrapped service's results"
            .x(() => countsWhileRecording.Should().Equal(0x1A, 0x2, 0x1B));

            "And the playback fake returns the recorded results"
            .x(() => countsDuringPlayback.Should().Equal(0x1A, 0x2, 0x1B));
        }
Example #36
0
 public IndexModel(ILawyerService lawyerService, ILibraryService libraryService,
                   IVeteranService veteranService, IMatchService matchService)
 {
     _lawyerService  = lawyerService;
     _libraryService = libraryService;
     _veteranService = veteranService;
     _matchService   = matchService;
 }
 public LibraryMatchingService(ILibraryService libraryService, IMatchEngineService matchEngineService,
     IInsightsService insightsService, IDownloadService downloadService)
 {
     _libraryService = libraryService;
     _matchEngineService = matchEngineService;
     _insightsService = insightsService;
     _downloadService = downloadService;
 }
Example #38
0
 public WebToAlbumConverter(IEnumerable <IMetadataProvider> providers, ILibraryService libraryService,
                            IConverter <WebArtist, Artist> webArtistConverter, IConverter <WebSong, Track> webTrackConverter)
 {
     _libraryService     = libraryService;
     _webArtistConverter = webArtistConverter;
     _webTrackConverter  = webTrackConverter;
     _providers          = providers.FilterAndSort <IBasicMetadataProvider>();
 }
 public LibraryMatchingService(ILibraryService libraryService, IMatchEngineService matchEngineService,
                               IInsightsService insightsService, IDownloadService downloadService)
 {
     _libraryService     = libraryService;
     _matchEngineService = matchEngineService;
     _insightsService    = insightsService;
     _downloadService    = downloadService;
 }
Example #40
0
        public static void SelfInitializingOutAndRef(
            InMemoryStorage inMemoryStorage,
            ILibraryService realServiceWhileRecording,
            ILibraryService realServiceDuringPlayback,
            int @out,
            int @ref)
        {
            "Given a call storage object"
            .x(() => inMemoryStorage = new InMemoryStorage());

            "And a real service to wrap while recording"
            .x(() =>
            {
                realServiceWhileRecording = A.Fake <ILibraryService>();

                int localOut;
                int localRef = 0;
                A.CallTo(() => realServiceWhileRecording.TryToSetSomeOutAndRefParameters(out localOut, ref localRef))
                .WithAnyArguments()
                .Returns(true)
                .AssignsOutAndRefParameters(19, 8);
            });

            "And a real service to wrap while playing back"
            .x(() => realServiceDuringPlayback = A.Fake <ILibraryService>());

            "When I use a self-initialized fake in recording mode to try to set some out and ref parameters"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var fakeService = A.Fake <ILibraryService>(options => options
                                                               .Wrapping(realServiceWhileRecording).RecordedBy(recorder));

                    int localOut;
                    int localRef = 0;
                    fakeService.TryToSetSomeOutAndRefParameters(out localOut, ref localRef);
                }
            });

            "And I use a self-initialized fake in playback mode to try to set some out and ref parameters"
            .x(() =>
            {
                using (var recorder = new RecordingManager(inMemoryStorage))
                {
                    var playbackFakeService = A.Fake <ILibraryService>(options => options
                                                                       .Wrapping(realServiceDuringPlayback).RecordedBy(recorder));

                    playbackFakeService.TryToSetSomeOutAndRefParameters(out @out, ref @ref);
                }
            });

            "Then the playback fake sets the out parameter to the value seen in recording mode"
            .x(() => @out.Should().Be(19));

            "And it sets the ref parameter to the value seen in recording mode"
            .x(() => @ref.Should().Be(8));
        }
Example #41
0
 public HomeController(
     IMapper mapper,
     ILibraryService libraryService,
     IUserService userService)
 {
     this.mapper         = mapper;
     this.libraryService = libraryService;
     this.userService    = userService;
 }
Example #42
0
        public void IncomingCapsRequest(UUID agentID, Framework.Services.GridRegion region, ISimulationBase simbase, ref OSDMap capURLs)
        {
            m_agentID          = agentID;
            m_moneyModule      = simbase.ApplicationRegistry.RequestModuleInterface <IMoneyModule> ();
            m_assetService     = simbase.ApplicationRegistry.RequestModuleInterface <IAssetService> ();
            m_inventoryService = simbase.ApplicationRegistry.RequestModuleInterface <IInventoryService> ();
            m_libraryService   = simbase.ApplicationRegistry.RequestModuleInterface <ILibraryService> ();
            m_inventoryData    = Framework.Utilities.DataManager.RequestPlugin <IInventoryData> ();

            HttpServerHandle method;
            string           uri;

            method = (path, request, httpRequest, httpResponse) => HandleFetchInventoryDescendents(request, m_agentID);
            uri    = "/CAPS/FetchInventoryDescendents/" + UUID.Random() + "/";
            capURLs ["WebFetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventoryDescendents"]    = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventoryDescendents2"]   = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchLibDescendents(request, m_agentID);
            uri    = "/CAPS/FetchLibDescendents/" + UUID.Random() + "/";
            capURLs ["FetchLibDescendents"]  = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchLibDescendents2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchInventory(request, m_agentID);
            uri    = "/CAPS/FetchInventory/" + UUID.Random() + "/";
            capURLs ["FetchInventory"]  = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventory2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchLib(request, m_agentID);
            uri    = "/CAPS/FetchLib/" + UUID.Random() + "/";
            capURLs ["FetchLib"]  = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchLib2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, method));


            uri = "/CAPS/NewFileAgentInventory/" + UUID.Random() + "/";
            capURLs ["NewFileAgentInventory"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, NewAgentInventoryRequest));

            uri = "/CAPS/NewFileAgentInventoryVariablePrice/" + UUID.Random() + "/";
            capURLs ["NewFileAgentInventoryVariablePrice"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, NewAgentInventoryRequestVariablePrice));

            uri = "/CAPS/CreateInventoryCategory/" + UUID.Random() + "/";
            capURLs ["CreateInventoryCategory"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add(uri);
            MainServer.Instance.AddStreamHandler(new GenericStreamHandler("POST", uri, CreateInventoryCategory));
        }
        public void IncomingCapsRequest (UUID agentID, Framework.Services.GridRegion region, ISimulationBase simbase, ref OSDMap capURLs)
        {
            m_agentID = agentID;
            m_moneyModule = simbase.ApplicationRegistry.RequestModuleInterface<IMoneyModule> ();
            m_assetService = simbase.ApplicationRegistry.RequestModuleInterface<IAssetService> ();
            m_inventoryService = simbase.ApplicationRegistry.RequestModuleInterface<IInventoryService> ();
            m_libraryService = simbase.ApplicationRegistry.RequestModuleInterface<ILibraryService> ();
            m_inventoryData = Framework.Utilities.DataManager.RequestPlugin<IInventoryData> ();

            HttpServerHandle method;
            string uri;

            method = (path, request, httpRequest, httpResponse) => HandleFetchInventoryDescendents (request, m_agentID);
            uri = "/CAPS/FetchInventoryDescendents/" + UUID.Random () + "/";
            capURLs ["WebFetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventoryDescendents"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventoryDescendents2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchLibDescendents (request, m_agentID);
            uri = "/CAPS/FetchLibDescendents/" + UUID.Random () + "/";
            capURLs ["FetchLibDescendents"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchLibDescendents2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchInventory (request, m_agentID);
            uri = "/CAPS/FetchInventory/" + UUID.Random () + "/";
            capURLs ["FetchInventory"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchInventory2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method));

            method = (path, request, httpRequest, httpResponse) => HandleFetchLib (request, m_agentID);
            uri = "/CAPS/FetchLib/" + UUID.Random () + "/";
            capURLs ["FetchLib"] = MainServer.Instance.ServerURI + uri;
            capURLs ["FetchLib2"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, method));


            uri = "/CAPS/NewFileAgentInventory/" + UUID.Random () + "/";
            capURLs ["NewFileAgentInventory"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, NewAgentInventoryRequest));

            uri = "/CAPS/NewFileAgentInventoryVariablePrice/" + UUID.Random () + "/";
            capURLs ["NewFileAgentInventoryVariablePrice"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, NewAgentInventoryRequestVariablePrice));

            uri = "/CAPS/CreateInventoryCategory/" + UUID.Random () + "/";
            capURLs ["CreateInventoryCategory"] = MainServer.Instance.ServerURI + uri;
            m_uris.Add (uri);
            MainServer.Instance.AddStreamHandler (new GenericStreamHandler ("POST", uri, CreateInventoryCategory));
        }
Example #44
0
        public virtual void Start(IConfigSource config, IRegistryCore registry)
        {
            m_Database = DataManager.RequestPlugin<IInventoryData>();
            m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>();
            m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
            m_AssetService = registry.RequestModuleInterface<IAssetService>();

            registry.RequestModuleInterface<ISimulationBase>().EventManager.RegisterEventHandler("DeleteUserInformation", DeleteUserInformation);
        }
Example #45
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            m_service = service;
            m_assetService = service.Registry.RequestModuleInterface<IAssetService>();
            m_inventoryService = service.Registry.RequestModuleInterface<IInventoryService>();
            m_libraryService = service.Registry.RequestModuleInterface<ILibraryService>();

            RestBytesMethod method = delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HandleWebFetchInventoryDescendents(request, m_service.AgentID);
            };
            service.AddStreamHandler("WebFetchInventoryDescendents",
                new RestBytesStreamHandler("POST", service.CreateCAPS("WebFetchInventoryDescendents", ""),
                                                      method));

            method = delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HandleFetchLibDescendents(request, m_service.AgentID);
            };
            service.AddStreamHandler("FetchLibDescendents",
                new RestBytesStreamHandler("POST", service.CreateCAPS("FetchLibDescendents", ""),
                                                      method));

            method = delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HandleFetchInventory(request, m_service.AgentID);
            };
            service.AddStreamHandler("FetchInventory",
                new RestBytesStreamHandler("POST", service.CreateCAPS("FetchInventory", ""),
                                                      method));

            method = delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HandleFetchLib(request, m_service.AgentID);
            };
            service.AddStreamHandler("FetchLib",
                new RestBytesStreamHandler("POST", service.CreateCAPS("FetchLib", ""),
                                                      method));

            service.AddStreamHandler("NewFileAgentInventory",
                new RestStreamHandler("POST", service.CreateCAPS("NewFileAgentInventory", m_newInventory),
                                                      NewAgentInventoryRequest));

            /*method = delegate(string request, string path, string param,
                                                                OSHttpRequest httpRequest, OSHttpResponse httpResponse)
            {
                return HandleInventoryItemCreate(request, m_service.AgentID);
            };
            service.AddStreamHandler("InventoryItemCreate",
                new RestBytesStreamHandler("POST", service.CreateCAPS("InventoryItemCreate", ""),
                                                      method));*/
        }
        protected AbstractObjectBrowserLibraryManager(string languageName, Guid libraryGuid, __SymbolToolLanguage preferredLanguage, IServiceProvider serviceProvider)
            : base(libraryGuid, serviceProvider)
        {
            _languageName = languageName;
            _preferredLanguage = preferredLanguage;

            var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel));
            this.Workspace = componentModel.GetService<VisualStudioWorkspace>();
            this.LibraryService = this.Workspace.Services.GetLanguageServices(languageName).GetService<ILibraryService>();
            this.Workspace.WorkspaceChanged += OnWorkspaceChanged;
        }
Example #47
0
 public HomePageViewModel(IHomePage homePage, IEventAggregator eventAggregator, ILibraryService libraryService)
     : base(homePage)
 {
     this._eventAggregator = eventAggregator;
     this._libraryService = libraryService;
     this.GoToSettingsCommand = new DelegateCommand(this.GoToSettings);
     this.GoToVideosCommand = new DelegateCommand(this.GoToVideos);
     this.CleanCommand = new DelegateCommand(this.Clean);
     this.LoadCommand = new DelegateCommand(this.LoadAsync);
     this.ManageCommand = new DelegateCommand(this.GoToManage);
 }
Example #48
0
 public DownloadService(
     ILibraryService libraryService,
     IDispatcherUtility dispatcherUtility,
     IAppSettingsUtility appSettingsUtility,
     IPlayerService playerService)
 {
     _libraryService = libraryService;
     _dispatcherUtility = dispatcherUtility;
     _appSettingsUtility = appSettingsUtility;
     _playerService = playerService;
     ActiveDownloads = new ObservableCollection<Track>();
 }
Example #49
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Sessions.UI.UpdateLibraryService"/> class.
		/// </summary>
		public UpdateLibraryService(ILibraryService libraryService)
		{
			if(libraryService == null)
				throw new ArgumentNullException("The _libraryService parameter cannot be null!");

			_libraryService = libraryService;
			_workerUpdateLibrary = new BackgroundWorker();
            _workerUpdateLibrary.WorkerReportsProgress = true;
            _workerUpdateLibrary.WorkerSupportsCancellation = true;
            _workerUpdateLibrary.DoWork += new DoWorkEventHandler(workerUpdateLibrary_DoWork);
            _workerUpdateLibrary.RunWorkerCompleted += new RunWorkerCompletedEventHandler(workerUpdateLibrary_RunWorkerCompleted);
		}
        public SettingsPageViewModel(
            IAppSettingsUtility appSettingsUtility,
            IMusicImportService musicImportService,
            ILibraryService libraryService)
        {
            _musicImportService = musicImportService;
            _libraryService = libraryService;
            AppSettingsUtility = appSettingsUtility;

            ImportCommand = new DelegateCommand(ImportExecute);
            DeleteCommand = new DelegateCommand(DeleteExecute);
        }
Example #51
0
        public CloudLibraryService(ICloudService cloudService, ILibraryService libraryService, IAudioFileCacheService audioFileCacheService,
            ISyncDeviceSpecifications deviceSpecifications)
        {
            _cloudService = cloudService;
            _libraryService = libraryService;
            _audioFileCacheService = audioFileCacheService;
            _deviceSpecifications = deviceSpecifications;

            _deviceInfos = new List<CloudDeviceInfo>();
            _deviceInfosLeftToDownload = new List<string>();

            Initialize();
        }
 public EditVideoViewModel(ILibraryService libraryService, IEditView view, IEventAggregator eventAggregator)
     : base(view)
 {
     this._libraryService = libraryService;
     this._eventAggregator = eventAggregator;
     this.CategoryViewModels = new ObservableCollection<CategoryViewModel>();
     this.Tags = new ObservableCollection<Tag>();
     this.CreateCategories(libraryService);
     this.CreateTags(libraryService);
     eventAggregator.GetEvent<VideoEditing>().Subscribe(v => { this.Video = v; });
     //eventAggregator.GetEvent<VideoEdited>().Subscribe(this.VideoEdited);
     this.CreateCategoryCommand = new DelegateCommand(this.CreateCategory);
 }
        /// <summary>
        /// 
        /// </summary>
        public void Initialization()
        {
            LibraryApp._container.Install(new Log4NetInstaller());
            LibraryApp._container.Register(Component.For<IInterceptor>().ImplementedBy<TraceAspect>().Named("Trace").LifestyleSingleton());
            LibraryApp._container.Install(new LibraryAppInstaller());

            LibraryApp._container.Register(Component.For<IUserService>().ImplementedBy<UserService>());
            LibraryApp._container.Register(Component.For<ILibraryService>().ImplementedBy<LibraryService>());

            _libService = LibraryApp._container.Resolve<ILibraryService>();            
            _userService = LibraryApp._container.Resolve<IUserService>();
            _currentApp = LibraryApp._container.Resolve<ILibraryApp>();
        }
Example #54
0
        public CAPSPrivateSeedHandler(IHttpServer server, IInventoryService inventoryService, ILibraryService libraryService, IGridUserService guService, IPresenceService presenceService, string URL, UUID agentID, string HostName)
        {
            m_server = server;
            m_InventoryService = inventoryService;
            m_LibraryService = libraryService;
            m_GridUserService = guService;
            m_PresenceService = presenceService;
            SimToInform = URL;
            m_AgentID = agentID;
            m_HostName = HostName;

            if(m_server != null)
                AddServerCAPS();
        }
        public VideoFilterGridViewModel(IVideoFilterGrid videoFilterGrid, IEventAggregator eventAggregator,
            ILibraryService libraryService)
            : base(videoFilterGrid)
        {
            this._eventAggregator = eventAggregator;
            this._libraryService = libraryService;
            this.SelectedTags = new ObservableCollection<CategoryViewModel>();
            this.Tags = new ObservableCollection<CategoryViewModel>();
            this.AddTagCommand = new DelegateCommand(this.AddTag);
            this.RemoveTagCommand = new DelegateCommand(this.RemoveTag);
            this.ClearTagsCommand = new DelegateCommand(this.ClearTags);
            this.CreateTagsList(null);

            this._eventAggregator.GetEvent<VideoEdited>().Subscribe(this.CreateTagsList);
        }
Example #56
0
 public TrackSaveService(
     ILibraryService libraryService,
     IConverter<WebSong, Track> webSongConverter,
     ILibraryMatchingService matchingService,
     IInsightsService insightsService,
     IStorageUtility storageUtility,
     IDownloadService downloadService)
 {
     _libraryService = libraryService;
     _webSongConverter = webSongConverter;
     _matchingService = matchingService;
     _insightsService = insightsService;
     _storageUtility = storageUtility;
     _downloadService = downloadService;
 }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;
            m_inventoryService = registry.RequestModuleInterface<IInventoryService>();

            IConfig libConfig = source.Configs["InventoryXMLLoader"];
            string pLibrariesLocation = Path.Combine("inventory", "Libraries.xml");
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                    return; //If it is loaded, don't reload
                pLibrariesLocation = libConfig.GetString("DefaultLibrary", pLibrariesLocation);
                LoadLibraries(pLibrariesLocation);
            }
        }
        public void LoadLibrary(ILibraryService service, IConfigSource source, IRegistryCore registry)
        {
            m_service = service;
            m_registry = registry;

            IConfig libConfig = source.Configs["InventoryIARLoader"];
            const string pLibrariesLocation = "DefaultInventory/";
            AddDefaultAssetTypes();
            if (libConfig != null)
            {
                if (libConfig.GetBoolean("PreviouslyLoaded", false))
                    return; //If it is loaded, don't reload
                foreach (string iarFileName in Directory.GetFiles(pLibrariesLocation, "*.iar"))
                {
                    LoadLibraries(iarFileName);
                }
            }
        }
        public DesignLibraryCollectionService(ILibraryService libraryService)
        {
            TracksByDateAdded = new OptimizedObservableCollection<Track>(
                libraryService.Tracks.OrderByDescending(p => p.CreatedAt));
            TracksByTitle = AlphaKeyGroup.CreateGroups(libraryService.Tracks, CultureInfo.CurrentCulture,
                item => ((Track) item).Title);
            TracksByArtist = AlphaKeyGroup.CreateGroups(libraryService.Tracks, CultureInfo.CurrentCulture,
                item => ((Track) item).DisplayArtist);
            TracksByAlbum = AlphaKeyGroup.CreateGroups(libraryService.Tracks, CultureInfo.CurrentCulture,
                item => ((Track) item).AlbumTitle);

            ArtistsByName = AlphaKeyGroup.CreateGroups(
                libraryService.Artists.Where(p => !p.IsSecondaryArtist), CultureInfo.CurrentCulture,
                item => ((Artist) item).Name);

            AlbumsByTitle = AlphaKeyGroup.CreateGroups(libraryService.Albums, CultureInfo.CurrentCulture,
                item => ((Album) item).Title);
        }
Example #60
0
 public TagsListViewModel(ITagsListView view, ILibraryService libraryService, IEventAggregator eventAggregator)
     : base(view)
 {
     this._eventAggregator = eventAggregator;
     this.SelectedTags = new ObservableCollection<CategoryViewModel>();
     this.Tags = new ObservableCollection<CategoryViewModel>();
     var videos = libraryService.GetObjectsFromFile().Videos;
     IEnumerable<String> tags =
         videos.SelectMany(v => v.Tags).Select(t => t.Value).Distinct().OrderBy(t => t);
     foreach (var tag in tags)
     {
         this.Tags.Add(new CategoryViewModel
         {
             Name = tag,
             Count = videos.Count(v => v.Tags.Any(t => t.Value == tag))
         });
     }
 }