Ejemplo n.º 1
0
        public PlayerViewModel(
            AudioPlayerHelper helper,
            ICollectionService service,
            IAppSettingsHelper appSettingsHelper)
        {
            _helper = helper;
            _service = service;
            _appSettingsHelper = appSettingsHelper;

            if (!IsInDesignMode)
            {
                helper.TrackChanged += HelperOnTrackChanged;
                helper.PlaybackStateChanged += HelperOnPlaybackStateChanged;
                helper.Shutdown += HelperOnShutdown;

                _nextRelayCommand = new RelayCommand(NextSong);
                _prevRelayCommand = new RelayCommand(PrevSong);
                _playPauseRelayCommand = new RelayCommand(PlayPauseToggle);

                _timer = new DispatcherTimer {Interval = TimeSpan.FromSeconds(1)};
                _timer.Tick += TimerOnTick;
            }
            else
            {
                CurrentQueue = service.PlaybackQueue.FirstOrDefault();
                PlayPauseIcon = Symbol.Play;
            }
        }
 public AddViewModel(ICollectionService collectionService, ILocationService locationService, IMvxMessenger messenger)
 {
     _collectionService = collectionService;
     _locationService = locationService;
     _token = messenger.SubscribeOnMainThread<LocationMessage>(OnLocation);
     GetInitialLocation();
 }
Ejemplo n.º 3
0
 public SongDownloadService(ICollectionService service, ISqlService sqlService, CoreDispatcher dispatcher)
 {
     this.service = service;
     this.sqlService = sqlService;
     this.dispatcher = dispatcher;
     ActiveDownloads = new ObservableCollection<Song>();
 }
Ejemplo n.º 4
0
 public DbService()
 {
     DocumentDb = new DBoperation();
     Firebase = new FBoperation();
     Collection = new CollectionService();
     AzureStorage = new ASoperation();
 }
 public virtual void SetUp()
 {
     ContentAreaRepository = MockRepository.GenerateMock<IContentAreaRepository>();
     CollectionService = MockRepository.GenerateMock<ICollectionService>();
     ApplicationService = MockRepository.GenerateMock<IApplicationService>();
     ContentAreaService = new ContentAreaService(ContentAreaRepository, CollectionService);
 }
Ejemplo n.º 6
0
 public DbService(IDBoperation iDBoperation, IFBoperation iFBoperation, 
     ICollectionService iCollectionService, IASoperation iASoperation)
 {
     DocumentDb = iDBoperation;
     Firebase = iFBoperation;
     Collection = iCollectionService;
     AzureStorage = iASoperation;
 }
 public CollectionAlbumViewModel(ICollectionService service, CollectionCommandHelper commands)
 {
     _service = service;
     _commands = commands;
     _songClickCommand = new RelayCommand<ItemClickEventArgs>(SongClickExecute);
     
     if (IsInDesignMode)
         SetAlbum(0);
     else MessengerInstance.Register<GenericMessage<int>>(this, "album-coll-detail-id", ReceivedId);
 }
        public CollectionPlaylistViewModel(ICollectionService service, AudioPlayerHelper audioPlayer)
        {
            _service = service;
            _audioPlayer = audioPlayer;
            _songClickCommand = new RelayCommand<ItemClickEventArgs>(SongClickExecute);
            MessengerInstance.Register<GenericMessage<int>>(this, "playlist-coll-detail-id", ReceivedId);

            if (IsInDesignMode)
                SetPlaylist(0);
        }
        public CollectionArtistViewModel(ICollectionService service, CollectionCommandHelper commands, IScrobblerService lastService)
        {
            _service = service;
            _commands = commands;
            _lastService = lastService;
            _songClickCommand = new RelayCommand<ItemClickEventArgs>(SongClickExecute);
            MessengerInstance.Register<int>(this, "artist-coll-detail-id", ReceivedId);

            if (IsInDesignMode)
                SetArtist(0);
        }
Ejemplo n.º 10
0
        public CollectionCommandHelper(
            ICollectionService service, 
            ISqlService sqlService, 
            ISongDownloadService downloadService)
        {
            _service = service;
            _sqlService = sqlService;
            _downloadService = downloadService;

            CreateCommand();
        }
        public IBackupService GetBackupService(int sampleDocumentsToCreateInCollectionSource = 1)
        {
            SampleData = CreateCollectionService<Item>("unitTestsCollection").Result;

            for (var i = 0; i < sampleDocumentsToCreateInCollectionSource; i++)
            {
                // Add a document to create backups from it
                SampleData.CreateDocument(new Item { Name = "ImportantData_" + i });
            }

            return CreateCollectionBackupService(SampleData);
        }
 public AddViewModel(
     ICollectionService collectionService, 
     ILocationService locationService, 
     IMvxMessenger messenger, 
     IMvxPictureChooserTask pictureChooserTask, IMvxFileStore fileStore)
 {
     _collectionService = collectionService;
     _locationService = locationService;
     _pictureChooserTask = pictureChooserTask;
     _fileStore = fileStore;
     _token = messenger.SubscribeOnMainThread<LocationMessage>(OnLocation);
     GetInitialLocation();
 }
Ejemplo n.º 13
0
        /// <summary>
        ///     Initializes a new instance of the MainViewModel class.
        /// </summary>
        /// <param name="collectionService">
        ///     The collection service.
        /// </param>
        /// <param name="service">
        ///     The service.
        /// </param>
        /// <param name="spotify">
        ///     The spotify.
        /// </param>
        /// <param name="audioticaService">
        ///     The audiotica service.
        /// </param>
        /// <param name="audioPlayer">
        ///     The audio player.
        /// </param>
        /// <param name="playerViewModel"></param>
        public MainViewModel(
            ICollectionService collectionService,
            IScrobblerService service,
            ISpotifyService spotify,
            IAudioticaService audioticaService,
            AudioPlayerHelper audioPlayer,
            PlayerViewModel playerViewModel)
        {
            PlayerViewModel = playerViewModel;
            _collectionService = collectionService;
            _service = service;
            _spotify = spotify;
            _audioticaService = audioticaService;
            _audioPlayer = audioPlayer;
            _collectionService.LibraryLoaded += CollectionServiceOnLibraryLoaded;
            _audioPlayer.TrackChanged += CollectionServiceOnLibraryLoaded;

            // Load data automatically
            LoadChartDataAsync();
        }
 public ListViewModel(ICollectionService collectionService, IMvxMessenger messenger)
 {
     _collectionService = collectionService;
     ReloadList();
     _collectionChangedToken = messenger.Subscribe<CollectionChangedMessage>(OnCollectionChanged);
 }
Ejemplo n.º 15
0
 public BuildData(ICollectionService collectionService, IProductService productService)
 {
     _collectionService = collectionService;
     _productService = productService;
 }
Ejemplo n.º 16
0
 public CollectionController(ICollectionService collectionService, ICollectionItemService collectionItemService)
 {
     _collectionService     = collectionService;
     _collectionItemService = collectionItemService;
 }
Ejemplo n.º 17
0
        public CollectionTest()
        {
            var unityConfig = new UnityConfig();
            unityConfig.RegisterComponents();
            _container = unityConfig.Container;

            Database.SetInitializer(new TestDbInitializer());

            _collectionService = _container.Resolve<CollectionService>();
            //_productService = _container.Resolve<ProductService>();
        }
 public DetailViewModel(ICollectionService collectionService)
 {
     _collectionService = collectionService;
 }
Ejemplo n.º 19
0
        public App(AppOptions appOptions)
        {
            Options = appOptions ?? new AppOptions();
            if (Options.IosExtension)
            {
                Current = this;
                return;
            }
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _vaultTimeoutService       = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _secureStorageService      = ServiceContainer.Resolve <IStorageService>("secureStorageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            Bootstrap();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (!string.IsNullOrWhiteSpace(details.CancelText))
                        {
                            confirmed = await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                            details.CancelText);
                        }
                        else
                        {
                            await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                        }
                        _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                    });
                }
                else if (message.Command == "locked")
                {
                    await LockedAsync(!(message.Data as bool?).GetValueOrDefault());
                }
                else if (message.Command == "lockVault")
                {
                    await _vaultTimeoutService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    Device.BeginInvokeOnMainThread(async() =>
                                                   await LogOutAsync((message.Data as bool?).GetValueOrDefault()));
                }
                else if (message.Command == "loggedOut")
                {
                    // Clean up old migrated key if they ever log out.
                    await _secureStorageService.RemoveAsync("oldKey");
                }
                else if (message.Command == "resumed")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        ResumedAsync();
                    }
                }
                else if (message.Command == "slept")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        await SleptAsync();
                    }
                }
                else if (message.Command == "migrated")
                {
                    await Task.Delay(1000);
                    await SetMainPageAsync();
                }
                else if (message.Command == "popAllAndGoToTabGenerator" ||
                         message.Command == "popAllAndGoToTabMyVault" ||
                         message.Command == "popAllAndGoToTabSend")
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (Current.MainPage is TabsPage tabsPage)
                        {
                            while (tabsPage.Navigation.ModalStack.Count > 0)
                            {
                                await tabsPage.Navigation.PopModalAsync(false);
                            }
                            if (message.Command == "popAllAndGoToTabMyVault")
                            {
                                Options.MyVaultTile = false;
                                tabsPage.ResetToVaultPage();
                            }
                            else if (message.Command == "popAllAndGoToTabGenerator")
                            {
                                Options.GeneratorTile = false;
                                tabsPage.ResetToGeneratorPage();
                            }
                            else if (message.Command == "popAllAndGoToTabSend")
                            {
                                tabsPage.ResetToSendPage();
                            }
                        }
                    });
                }
            });
        }
 public virtual void SetUp()
 {
     CollectionService = MockRepository.GenerateMock<ICollectionService>();
     CollectionController = new CollectionController(CollectionService);
 }
 public CollectionController(ICollectionService collectionService)
 {
     this.collectionService = collectionService;
 }
 public DetailViewModel(ICollectionService collectionService)
 {
     _collectionService = collectionService;
 }
Ejemplo n.º 23
0
 public CollectionController(IServiceProvider services, ICollectionService collections, IUserService users)
 {
     _services    = services;
     _collections = collections;
     _users       = users;
 }
Ejemplo n.º 24
0
 public UserController(IServiceProvider services, IAuthService auth, IDiscordOAuthHandler discord, IUserService users, ICollectionService collections, IStripeService stripe)
 {
     _services    = services;
     _auth        = auth;
     _discord     = discord;
     _users       = users;
     _collections = collections;
     _stripe      = stripe;
 }
Ejemplo n.º 25
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            InitializeComponent();
            SetCulture();
            ThemeManager.SetThemeStyle("light");
            MainPage = new HomePage();
            var mainPageTask = SetMainPageAsync();

            ServiceContainer.Resolve <MobilePlatformUtilsService>("platformUtilsService").Init();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    if (!string.IsNullOrWhiteSpace(details.CancelText))
                    {
                        confirmed = await MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                details.CancelText);
                    }
                    else
                    {
                        await MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                    }
                    _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                }
                else if (message.Command == "locked")
                {
                    await _stateService.PurgeAsync();
                    MainPage = new NavigationPage(new LockPage());
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    await LogOutAsync(false);
                }
                else if (message.Command == "loggedOut")
                {
                    // TODO
                }
                else if (message.Command == "unlocked" || message.Command == "loggedIn")
                {
                    // TODO
                }
            });
        }
Ejemplo n.º 26
0
 public DashboardController(IAccountService _accountService, ICollectionService _collectionService, IRecipeService _recipeService)
 {
     this._accountService    = _accountService;
     this._collectionService = _collectionService;
     this._recipeService     = _recipeService;
 }
Ejemplo n.º 27
0
        public App(AppOptions appOptions)
        {
            _appOptions                = appOptions ?? new AppOptions();
            _userService               = ServiceContainer.Resolve <IUserService>("userService");
            _broadcasterService        = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _messagingService          = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService              = ServiceContainer.Resolve <IStateService>("stateService");
            _lockService               = ServiceContainer.Resolve <ILockService>("lockService");
            _syncService               = ServiceContainer.Resolve <ISyncService>("syncService");
            _tokenService              = ServiceContainer.Resolve <ITokenService>("tokenService");
            _cryptoService             = ServiceContainer.Resolve <ICryptoService>("cryptoService");
            _cipherService             = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService             = ServiceContainer.Resolve <IFolderService>("folderService");
            _settingsService           = ServiceContainer.Resolve <ISettingsService>("settingsService");
            _collectionService         = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _searchService             = ServiceContainer.Resolve <ISearchService>("searchService");
            _authService               = ServiceContainer.Resolve <IAuthService>("authService");
            _platformUtilsService      = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _storageService            = ServiceContainer.Resolve <IStorageService>("storageService");
            _secureStorageService      = ServiceContainer.Resolve <IStorageService>("secureStorageService");
            _passwordGenerationService = ServiceContainer.Resolve <IPasswordGenerationService>(
                "passwordGenerationService");
            _i18nService         = ServiceContainer.Resolve <II18nService>("i18nService") as MobileI18nService;
            _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            Bootstrap();
            _broadcasterService.Subscribe(nameof(App), async(message) =>
            {
                if (message.Command == "showDialog")
                {
                    var details     = message.Data as DialogDetails;
                    var confirmed   = true;
                    var confirmText = string.IsNullOrWhiteSpace(details.ConfirmText) ?
                                      AppResources.Ok : details.ConfirmText;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (!string.IsNullOrWhiteSpace(details.CancelText))
                        {
                            confirmed = await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText,
                                                                            details.CancelText);
                        }
                        else
                        {
                            await Current.MainPage.DisplayAlert(details.Title, details.Text, confirmText);
                        }
                        _messagingService.Send("showDialogResolve", new Tuple <int, bool>(details.DialogId, confirmed));
                    });
                }
                else if (message.Command == "locked")
                {
                    await _stateService.PurgeAsync();
                    var lockPage = new LockPage(null, !(message.Data as bool?).GetValueOrDefault());
                    Device.BeginInvokeOnMainThread(() => Current.MainPage = new NavigationPage(lockPage));
                }
                else if (message.Command == "lockVault")
                {
                    await _lockService.LockAsync(true);
                }
                else if (message.Command == "logout")
                {
                    if (Migration.MigrationHelpers.Migrating)
                    {
                        return;
                    }
                    await LogOutAsync(false);
                }
                else if (message.Command == "loggedOut")
                {
                    // Clean up old migrated key if they ever log out.
                    await _secureStorageService.RemoveAsync("oldKey");
                }
                else if (message.Command == "unlocked" || message.Command == "loggedIn")
                {
                    // TODO
                }
                else if (message.Command == "resumed")
                {
                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        SyncIfNeeded();
                    }
                }
                else if (message.Command == "migrated")
                {
                    await Task.Delay(1000);
                    await SetMainPageAsync();
                }
            });
        }
 public HomeViewModel(ICollectionService collectionService, IMvxMessenger messenger)
 {
     _collectionService = collectionService;
     _collectionChangedSubscriptionToken = messenger.Subscribe<CollectionChangedMessage>(OnCollectionChanged);
     UpdateLatest();
 }
 public ApplicationCollectionController(ICollectionService collectionService)
 {
     _collectionService = collectionService;
 }
Ejemplo n.º 30
0
        public void TestInitialize()
        {
            _store = new Store {
                Id = "1"
            };
            tempWorkContext = new Mock <IWorkContext>();
            {
                tempWorkContext.Setup(instance => instance.WorkingCurrency).Returns(_currency);
                tempWorkContext.Setup(c => c.CurrentStore).Returns(_store);
                _workContext = tempWorkContext.Object;
            }

            tempDiscountServiceMock = new Mock <IDiscountService>();
            {
                _discountService = tempDiscountServiceMock.Object;
            }

            _categoryService   = new Mock <ICategoryService>().Object;
            _collectionService = new Mock <ICollectionService>().Object;
            _brandService      = new Mock <IBrandService>().Object;

            tempProductService = new Mock <IProductService>();
            {
                _productService = tempProductService.Object;
            }
            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _shoppingCartSettings   = new ShoppingCartSettings();
            _catalogSettings        = new CatalogSettings();
            var eventPublisher = new Mock <IMediator>();

            _eventPublisher = eventPublisher.Object;

            _currencySettings = new CurrencySettings();
            _currencySettings.PrimaryExchangeRateCurrencyId = "1";
            _currencySettings.PrimaryStoreCurrencyId        = "1";
            //_currencyService = new Mock<ICurrencyService>().Object;
            _currency = new Currency {
                Id = "1", CurrencyCode = "USD", Rate = 1, Published = true, MidpointRoundId = System.MidpointRounding.ToEven, RoundingTypeId = RoundingType.Rounding001
            };

            var tempCurrency = new Mock <ICurrencyService>();
            {
                tempCurrency.Setup(instance => instance.GetPrimaryStoreCurrency()).Returns(Task.FromResult(_currency));
                //tempCurrency.Setup(instance => instance.ConvertToPrimaryStoreCurrency(It.IsAny<decimal>(), _currency)).ReturnsAsync(5);
                //_currencyService = tempCurrency.Object;
            }
            var cacheManager = new Mock <ICacheBase>().Object;
            IRepository <Currency> _currencyRepository;
            var tempCurrencyRepository = new Mock <IRepository <Currency> >();
            {
                var IMongoCollection = new Mock <IMongoCollection <Currency> >().Object;
                IMongoCollection.InsertOne(_currency);


                tempCurrencyRepository.Setup(x => x.Table).Returns(IMongoCollection.AsQueryable());
                tempCurrencyRepository.Setup(x => x.GetByIdAsync(_currency.Id)).ReturnsAsync(_currency);
                _currencyRepository = tempCurrencyRepository.Object;
            }

            IAclService _aclService      = new Mock <IAclService>().Object;
            var         _serviceProvider = new Mock <IServiceProvider>().Object;

            _currencyService = new CurrencyService(
                cacheManager, _currencyRepository, _aclService,
                _currencySettings, _eventPublisher);


            _pricingService = new PricingService(
                _workContext,
                _discountService,
                _categoryService,
                _brandService,
                _collectionService,
                _productAttributeParser,
                _productService,
                _eventPublisher,
                _currencyService,
                _shoppingCartSettings,
                _catalogSettings);
        }
Ejemplo n.º 31
0
 public SettingsViewModel(IRegionManager regionManager, IIndexingService indexingService, ICollectionService collectionService)
 {
     this.regionManager     = regionManager;
     this.indexingService   = indexingService;
     this.collectionService = collectionService;
     this.NavigateBetweenSettingsCommand = new DelegateCommand <string>(NavigateBetweenSettings);
     ApplicationCommands.NavigateBetweenSettingsCommand.RegisterCommand(this.NavigateBetweenSettingsCommand);
     this.SlideInFrom = 30;
 }
        public CollectionArtistsViewModel(IUnityContainer container) : base(container)
        {
            // Dependency injection
            this.collectionService = container.Resolve <ICollectionService>();
            this.metadataService   = container.Resolve <IMetadataService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.playlistService   = container.Resolve <IPlaylistService>();
            this.indexingService   = container.Resolve <IIndexingService>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.artistRepository  = container.Resolve <IArtistRepository>();

            // Commands
            this.ToggleArtistOrderCommand            = new DelegateCommand(async() => await this.ToggleArtistOrderAsync());
            this.ToggleTrackOrderCommand             = new DelegateCommand(async() => await this.ToggleTrackOrderAsync());
            this.ToggleAlbumOrderCommand             = new DelegateCommand(async() => await this.ToggleAlbumOrderAsync());
            this.RemoveSelectedTracksCommand         = new DelegateCommand(async() => await this.RemoveTracksFromCollectionAsync(this.SelectedTracks), () => !this.IsIndexing);
            this.RemoveSelectedTracksFromDiskCommand = new DelegateCommand(async() => await this.RemoveTracksFromDiskAsync(this.SelectedTracks), () => !this.IsIndexing);
            this.AddArtistsToPlaylistCommand         = new DelegateCommand <string>(async(iPlaylistName) => await this.AddArtistsToPlaylistAsync(this.SelectedArtists, iPlaylistName));
            this.SelectedArtistsCommand        = new DelegateCommand <object>(async(iParameter) => await this.SelectedArtistsHandlerAsync(iParameter));
            this.ShowArtistsZoomCommand        = new DelegateCommand(async() => await this.ShowSemanticZoomAsync());
            this.SemanticJumpCommand           = new DelegateCommand(() => this.HideSemanticZoom());
            this.AddArtistsToNowPlayingCommand = new DelegateCommand(async() => await this.AddArtistsToNowPlayingAsync(this.SelectedArtists));
            this.ShuffleSelectedArtistsCommand = new DelegateCommand(async() => await this.playbackService.EnqueueAsync(this.SelectedArtists, true, false));

            // Events
            this.metadataService.MetadataChanged += MetadataChangedHandlerAsync;
            this.indexingService.RefreshArtwork  += async(_, __) => await this.collectionService.RefreshArtworkAsync(this.Albums);

            this.eventAggregator.GetEvent <SettingEnableRatingChanged>().Subscribe(async(enableRating) =>
            {
                this.EnableRating = enableRating;
                this.SetTrackOrder("ArtistsTrackOrder");
                await this.GetTracksAsync(this.SelectedArtists, null, this.SelectedAlbums, this.TrackOrder);
            });

            this.eventAggregator.GetEvent <SettingEnableLoveChanged>().Subscribe(async(enableLove) =>
            {
                this.EnableLove = enableLove;
                this.SetTrackOrder("ArtistsTrackOrder");
                await this.GetTracksAsync(this.SelectedArtists, null, this.SelectedAlbums, this.TrackOrder);
            });

            // Set the initial ArtistOrder
            this.ArtistOrder = (ArtistOrder)SettingsClient.Get <int>("Ordering", "ArtistsArtistOrder");

            // Set the initial AlbumOrder
            this.AlbumOrder = (AlbumOrder)SettingsClient.Get <int>("Ordering", "ArtistsAlbumOrder");

            // Set the initial TrackOrder
            this.SetTrackOrder("ArtistsTrackOrder");

            // Subscribe to Events and Commands on creation
            this.Subscribe();

            // Set width of the panels
            this.LeftPaneWidthPercent  = SettingsClient.Get <int>("ColumnWidths", "ArtistsLeftPaneWidthPercent");
            this.RightPaneWidthPercent = SettingsClient.Get <int>("ColumnWidths", "ArtistsRightPaneWidthPercent");

            // Cover size
            this.SetCoversizeAsync((CoverSizeType)SettingsClient.Get <int>("CoverSizes", "ArtistsCoverSize"));
        }
Ejemplo n.º 33
0
 public CollectionsV1Controller(ICollectionService collectionService)
 {
     _collectionService = collectionService;
     //_storageService = storageService;
 }
Ejemplo n.º 34
0
 protected CollectionController(ICollectionService <T> service)
 {
     _service = service;
 }
Ejemplo n.º 35
0
        public async Task Update_CustomFields()
        {
            var getCustomFieldResult = (await _collectionService.GetCustomFieldAsync(1, "jason.abc"));
            getCustomFieldResult.Error.Should().BeNull();
            
            var customField = getCustomFieldResult.ResultValue;
            customField.Should().NotBeNull();

            customField.Key = "jaSon";
            customField.Value = "false";

            var updateResult = (await _collectionService.UpdateCustomFieldAsync(customField));
            updateResult.Error.Should().BeNull();

            getCustomFieldResult = (await _collectionService.GetCustomFieldAsync(1, "jason"));
            getCustomFieldResult.Error.Should().BeNull();

            var newCustomField = getCustomFieldResult.ResultValue;
            newCustomField.Should().NotBeNull();

            newCustomField.Key.Should().Be(customField.Key);
            newCustomField.Value.Should().Be(customField.Value);

            //get new service instance
            //error test
            _collectionService = _container.Resolve<CollectionService>();

            getCustomFieldResult = (await _collectionService.GetCustomFieldAsync(1, "jason"));
            getCustomFieldResult.Error.Should().BeNull();

            customField = getCustomFieldResult.ResultValue;
            customField.Should().NotBeNull();
            customField.Key = "";
            customField.Value = string.Empty; //error

            updateResult = await _collectionService.UpdateCustomFieldAsync(customField);
            updateResult.Error.Should().NotBeNull();
            Console.WriteLine(updateResult.Error.Message);

        }
Ejemplo n.º 36
0
 public TempDataService(ICollectionService collectionService, IFollowerService followerService)
 {
     _collectionService = collectionService;
     _followerService   = followerService;
 }
Ejemplo n.º 37
0
 public SearchController(ICategoryService categroyService,ICollectionService collectionService,ISearchService searchService)
 {
     _categoryService = categroyService;
     _collectionService = collectionService;
     _searchService = searchService;
 }
Ejemplo n.º 38
0
 public CollectionManagerVm()
 {
     _collectionService = ServiceLocator.GetService <ICollectionService>();
 }
 public CollectionAppService(ICollectionService collectionService)
     : base(collectionService)
 {
     _collectionService = collectionService;
 }
Ejemplo n.º 40
0
 public CollectionAlbumViewModel(ICollectionService service)
 {
     _service          = service;
     _songClickCommand = new Command <ItemClickEventArgs>(SongClickExecute);
 }
Ejemplo n.º 41
0
 public CollectionServiceTest()
 {
     _service = new CollectionService(_mockDiscogsApi.Object);
 }
Ejemplo n.º 42
0
        public AddEditPageViewModel()
        {
            _deviceActionService    = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _cipherService          = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService          = ServiceContainer.Resolve <IFolderService>("folderService");
            _userService            = ServiceContainer.Resolve <IUserService>("userService");
            _platformUtilsService   = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _auditService           = ServiceContainer.Resolve <IAuditService>("auditService");
            _messagingService       = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _collectionService      = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _eventService           = ServiceContainer.Resolve <IEventService>("eventService");
            GeneratePasswordCommand = new Command(GeneratePassword);
            TogglePasswordCommand   = new Command(TogglePassword);
            ToggleCardCodeCommand   = new Command(ToggleCardCode);
            CheckPasswordCommand    = new Command(CheckPasswordAsync);
            UriOptionsCommand       = new Command <LoginUriView>(UriOptions);
            FieldOptionsCommand     = new Command <AddEditPageFieldViewModel>(FieldOptions);
            Uris        = new ExtendedObservableCollection <LoginUriView>();
            Fields      = new ExtendedObservableCollection <AddEditPageFieldViewModel>();
            Collections = new ExtendedObservableCollection <CollectionViewModel>();

            TypeOptions = new List <KeyValuePair <string, CipherType> >
            {
                new KeyValuePair <string, CipherType>(AppResources.TypeLogin, CipherType.Login),
                new KeyValuePair <string, CipherType>(AppResources.TypeCard, CipherType.Card),
                new KeyValuePair <string, CipherType>(AppResources.TypeIdentity, CipherType.Identity),
                new KeyValuePair <string, CipherType>(AppResources.TypeSecureNote, CipherType.SecureNote),
            };
            CardBrandOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>("Visa", "Visa"),
                new KeyValuePair <string, string>("Mastercard", "Mastercard"),
                new KeyValuePair <string, string>("American Express", "Amex"),
                new KeyValuePair <string, string>("Discover", "Discover"),
                new KeyValuePair <string, string>("Diners Club", "Diners Club"),
                new KeyValuePair <string, string>("JCB", "JCB"),
                new KeyValuePair <string, string>("Maestro", "Maestro"),
                new KeyValuePair <string, string>("UnionPay", "UnionPay"),
                new KeyValuePair <string, string>(AppResources.Other, "Other")
            };
            CardExpMonthOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>($"01 - {AppResources.January}", "1"),
                new KeyValuePair <string, string>($"02 - {AppResources.February}", "2"),
                new KeyValuePair <string, string>($"03 - {AppResources.March}", "3"),
                new KeyValuePair <string, string>($"04 - {AppResources.April}", "4"),
                new KeyValuePair <string, string>($"05 - {AppResources.May}", "5"),
                new KeyValuePair <string, string>($"06 - {AppResources.June}", "6"),
                new KeyValuePair <string, string>($"07 - {AppResources.July}", "7"),
                new KeyValuePair <string, string>($"08 - {AppResources.August}", "8"),
                new KeyValuePair <string, string>($"09 - {AppResources.September}", "9"),
                new KeyValuePair <string, string>($"10 - {AppResources.October}", "10"),
                new KeyValuePair <string, string>($"11 - {AppResources.November}", "11"),
                new KeyValuePair <string, string>($"12 - {AppResources.December}", "12")
            };
            IdentityTitleOptions = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>($"-- {AppResources.Select} --", null),
                new KeyValuePair <string, string>(AppResources.Mr, AppResources.Mr),
                new KeyValuePair <string, string>(AppResources.Mrs, AppResources.Mrs),
                new KeyValuePair <string, string>(AppResources.Ms, AppResources.Ms),
                new KeyValuePair <string, string>(AppResources.Dr, AppResources.Dr),
            };
            FolderOptions    = new List <KeyValuePair <string, string> >();
            OwnershipOptions = new List <KeyValuePair <string, string> >();
        }
Ejemplo n.º 43
0
 public FileController(IFileService fileService, IProductService productService, ICollectionService collectionService, ICategoryService categoryService, ICloudStorage cloudStorage)
 {
     _fileService       = fileService;
     _productService    = productService;
     _collectionService = collectionService;
     _categoryService   = categoryService;
     _cloudStorage      = cloudStorage;
 }
Ejemplo n.º 44
0
        public CollectionArtistsViewModel(IUnityContainer container) : base(container)
        {
            // Dependency injection
            this.collectionService = container.Resolve <ICollectionService>();
            this.metadataService   = container.Resolve <IMetadataService>();
            this.playbackService   = container.Resolve <IPlaybackService>();
            this.playlistService   = container.Resolve <IPlaylistService>();
            this.indexingService   = container.Resolve <IIndexingService>();
            this.dialogService     = container.Resolve <IDialogService>();
            this.searchService     = container.Resolve <ISearchService>();
            this.eventAggregator   = container.Resolve <IEventAggregator>();
            this.artistRepository  = container.Resolve <IArtistRepository>();

            // Commands
            this.ToggleArtistOrderCommand            = new DelegateCommand(async() => await this.ToggleArtistOrderAsync());
            this.ToggleTrackOrderCommand             = new DelegateCommand(async() => await this.ToggleTrackOrderAsync());
            this.ToggleAlbumOrderCommand             = new DelegateCommand(async() => await this.ToggleAlbumOrderAsync());
            this.RemoveSelectedTracksCommand         = new DelegateCommand(async() => await this.RemoveTracksFromCollectionAsync(this.SelectedTracks), () => !this.IsIndexing);
            this.RemoveSelectedTracksFromDiskCommand = new DelegateCommand(async() => await this.RemoveTracksFromDiskAsync(this.SelectedTracks), () => !this.IsIndexing);
            this.AddArtistsToPlaylistCommand         = new DelegateCommand <string>(async(iPlaylistName) => await this.AddArtistsToPlaylistAsync(this.SelectedArtists, iPlaylistName));
            this.SelectedArtistsCommand        = new DelegateCommand <object>(async(iParameter) => await this.SelectedArtistsHandlerAsync(iParameter));
            this.ShowArtistsZoomCommand        = new DelegateCommand(async() => await this.ShowSemanticZoomAsync());
            this.AddArtistsToNowPlayingCommand = new DelegateCommand(async() => await this.AddArtistsToNowPlayingAsync(this.SelectedArtists));
            this.ShuffleSelectedArtistsCommand = new DelegateCommand(async() => await this.playbackService.EnqueueArtistsAsync(this.SelectedArtists, true, false));

            this.SemanticJumpCommand = new DelegateCommand <string>((header) =>
            {
                this.HideSemanticZoom();
                this.eventAggregator.GetEvent <PerformSemanticJump>().Publish(new Tuple <string, string>("Artists", header));
            });

            // Settings
            SettingsClient.SettingChanged += async(_, e) =>
            {
                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableRating"))
                {
                    this.EnableRating = (bool)e.SettingValue;
                    this.SetTrackOrder("ArtistsTrackOrder");
                    await this.GetTracksAsync(this.SelectedArtists, null, this.SelectedAlbumIds, this.TrackOrder);
                }

                if (SettingsClient.IsSettingChanged(e, "Behaviour", "EnableLove"))
                {
                    this.EnableLove = (bool)e.SettingValue;
                    this.SetTrackOrder("ArtistsTrackOrder");
                    await this.GetTracksAsync(this.SelectedArtists, null, this.SelectedAlbumIds, this.TrackOrder);
                }
            };

            // PubSub Events
            this.eventAggregator.GetEvent <ShellMouseUp>().Subscribe((_) => this.IsArtistsZoomVisible = false);

            // Events
            this.metadataService.MetadataChanged   += MetadataChangedHandlerAsync;
            this.indexingService.AlbumArtworkAdded += async(_, e) => await this.RefreshArtworkAsync(e.AlbumIds);

            // Set the initial ArtistOrder
            this.ArtistOrder = (ArtistOrder)SettingsClient.Get <int>("Ordering", "ArtistsArtistOrder");

            // Set the initial AlbumOrder
            this.AlbumOrder = (AlbumOrder)SettingsClient.Get <int>("Ordering", "ArtistsAlbumOrder");

            // Set the initial TrackOrder
            this.SetTrackOrder("ArtistsTrackOrder");

            // Set width of the panels
            this.LeftPaneWidthPercent  = SettingsClient.Get <int>("ColumnWidths", "ArtistsLeftPaneWidthPercent");
            this.RightPaneWidthPercent = SettingsClient.Get <int>("ColumnWidths", "ArtistsRightPaneWidthPercent");

            // Cover size
            this.SetCoversizeAsync((CoverSizeType)SettingsClient.Get <int>("CoverSizes", "ArtistsCoverSize"));
        }
Ejemplo n.º 45
0
 public ProductService(IShopTimeToken token, ICollectionService collectionService, IDBConetxt repository)
 {
     _repository = repository;
     _token = token;
     _collectionService = collectionService;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="collectionService"></param>
 public WxCollectionController(ICollectionService collectionService)
 {
     _collectionService = collectionService;
 }
 public HomeViewModel(ICollectionService collectionService)
 {
     _collectionService = collectionService;
     UpdateLatest();
 }
Ejemplo n.º 48
0
        public CollectionFoldersViewModel(IIndexingService indexingService, IDialogService dialogService, ICollectionService collectionservice, IFolderRepository folderRepository)
        {
            this.indexingService   = indexingService;
            this.dialogService     = dialogService;
            this.collectionservice = collectionservice;
            this.folderRepository  = folderRepository;

            this.AddFolderCommand = new DelegateCommand <string>((_) => { this.AddFolder(); });

            this.RemoveFolderCommand = new DelegateCommand <long?>(folderId =>
            {
                if (this.dialogService.ShowConfirmation(0xe11b, 16, ResourceUtils.GetString("Language_Remove"), ResourceUtils.GetString("Language_Confirm_Remove_Folder"), ResourceUtils.GetString("Language_Yes"), ResourceUtils.GetString("Language_No")))
                {
                    this.RemoveFolder(folderId.Value);
                }
            });

            this.ShowInCollectionChangedCommand = new DelegateCommand <long?>(folderId =>
            {
                this.ShowAllFoldersInCollection = false;

                lock (this.Folders)
                {
                    this.collectionservice.MarkFolderAsync(this.Folders.Select((f) => f.Folder).Where((f) => f.FolderID == folderId).FirstOrDefault());
                }
            });

            this.ShowAllFoldersInCollection = SettingsClient.Get <bool>("Indexing", "ShowAllFoldersInCollection");

            // Makes sure IsIndexng is set if this ViewModel is created after the indexer has started indexing
            if (this.indexingService.IsIndexing)
            {
                this.IsIndexing = true;
            }

            // These events handle changes of indexer status after the ViewModel is created
            this.indexingService.IndexingStarted += (_, __) => this.IsIndexing = true;
            this.indexingService.IndexingStopped += (_, __) => this.IsIndexing = false;

            this.GetFoldersAsync();
        }
Ejemplo n.º 49
0
 public void Setup()
 {
     _collectionService = new CollectionService("veiculo");
 }
 public ListViewModel(ICollectionService collectionService)
 {
     _collectionService = collectionService;
     Items = _collectionService.All();
 }
Ejemplo n.º 51
0
 public SongDownloadService(ICollectionService service, ISqlService sqlService)
 {
     this.service    = service;
     this.sqlService = sqlService;
     ActiveDownloads = new ObservableCollection <Song>();
 }
Ejemplo n.º 52
0
 public CollectionController(ICollectionService collectionService, IBranchRepository branchRepository)
 {
     this.collectionService = collectionService;
     this.branchRepository = branchRepository;
 }
 public CollectionStatisticsViewModel(ICollectionService service)
 {
     Service = service;
 }
Ejemplo n.º 54
0
 public CollectionController()
 {
     this.dbContext             = new CollectionDbContext();
     this.collectionService     = new CollectionService(this.dbContext);
     this.collectionTypeService = new CollectionTypeService(this.dbContext);
 }