Inheritance: IAudioStationSession
Ejemplo n.º 1
0
        public CollectionPageViewModel(AudioStationSession audioStationSession)
        {
            this.session = audioStationSession;
            InitializeApplicationSettingsSections();

            SettingsChangedCommand = new DelegateCommand<SettingsView>(OnSettingsChanged);
            LoadingDefaultSettingsCommand = new DelegateCommand<LoadingDefaultSettingsEventArgs>(OnLoadingDefaultSettings);
            PointerPressedCommand = new DelegateCommand(OnPointerPressed);
            ValidatedSearchQueryCommand = new DelegateCommand(OnValidatedSearchQuery);
        }
Ejemplo n.º 2
0
        public SplitPageViewModel()
        {
            Artists = new ObservableCollection<ArtistViewModel>();
            Artists.Add(new ArtistViewModel(null) { Name = "Bob" });
            Artists.Add(new ArtistViewModel(null) { Name = "Ralph" });
            Artists.Add(new ArtistViewModel(null) { Name = "Noah" });

            SearchCriteria = "Role";

            AudioStationSession session = new AudioStationSession();
            session.Host = "ds509.hamilcar.ch";
            session.Port = 5000;
            session.LoginAsync("fabio", "fabioFTP",
                o =>
                {
                },
                e =>
                {
                },
                    false);
        }
Ejemplo n.º 3
0
 // TODO: Create a data model appropriate for your problem domain to replace the sample data
 public App()
 {
     audioStationSession = new AudioStationSession();
     InitializeComponent();
 }
Ejemplo n.º 4
0
        private void InitializeSettings()
        {
            EventAggregator eventAggregator = new EventAggregator();
            IoC.Container.Bind<IEventAggregator>().ToConstant(eventAggregator);

            string synoSettings = "SynoSettings";
            _openSynoSettings = IsolatedStorageSettings.ApplicationSettings.Contains(synoSettings) ? (OpenSynoSettings)IsolatedStorageSettings.ApplicationSettings[synoSettings] : new OpenSynoSettings();

            // FIXME : Try to get rid of thses registrations and use DI instead.
            IoC.Container.Bind<IOpenSynoSettings>().ToConstant(_openSynoSettings);

            // FIXME : Load from config files instead of  hard-coded bindings.

            IVersionDependentResourcesProvider versionDependentResourcesProvider = new VersionDependentResourcesProvider();
            IoC.Container.Bind<IVersionDependentResourcesProvider>().ToConstant(versionDependentResourcesProvider).InSingletonScope();

            // Retrieve the type IAudioStationSession from a config file, so we can change it.
            // Also possible : RemoteFileMockAudioStationSession
            IAudioStationSession audioStationSession;
            if (PhoneApplicationService.Current.State.ContainsKey("IAudioStationSession"))
            {
                audioStationSession = (IAudioStationSession)PhoneApplicationService.Current.State["IAudioStationSession"];
            }
            else
            {
                audioStationSession = new AudioStationSession(versionDependentResourcesProvider, _openSynoSettings.DsmVersion) { Host = _openSynoSettings.Host, Port = _openSynoSettings.Port, Token = _openSynoSettings.Token };
            }

            IoC.Container.Bind<IAudioStationSession>().ToConstant(audioStationSession).InSingletonScope();

            // Retrieve the type SearchService from a config file, so we can change it.
            // also possible: MockSearchService;
            // IoC.Container.Bind<ISearchService>().To(typeof(MockSearchService)).InSingletonScope();
            IoC.Container.Bind<ISearchService>().To(typeof(SearchService)).InSingletonScope();
            IoC.Container.Bind<ISignInService>().To(typeof(SignInService)).InSingletonScope();

            IoC.Container.Bind<IPageSwitchingService>().To<PageSwitchingService>().InSingletonScope();
            IoC.Container.Bind<INavigatorService>().To<NavigatorService>().InSingletonScope();
            IoC.Container.Bind<ISearchAllResultsViewModelFactory>().To<SearchAllResultsViewModelFactory>().InSingletonScope();
            IoC.Container.Bind<SearchViewModel>().ToSelf().InSingletonScope();
            IoC.Container.Bind<SearchResultsViewModelFactory>().ToSelf().InSingletonScope();
            IoC.Container.Bind<ArtistPanoramaViewModelFactory>().ToSelf().InSingletonScope();
            IoC.Container.Bind<ArtistDetailViewModelFactory>().To<ArtistDetailViewModelFactory>().InSingletonScope();
            IoC.Container.Bind<ITrackViewModelFactory>().To<TrackViewModelFactory>();

            IoC.Container.Bind<PlayQueueViewModel>().ToSelf().InSingletonScope();
            IoC.Container.Bind<SearchResultsViewModel>().ToSelf().InSingletonScope();

            _logService = new IsolatedStorageLogService();
            IoC.Container.Bind<ILogService>().ToConstant(_logService).InSingletonScope();

            IoC.Container.Bind<ISearchResultItemViewModelFactory>().To<SearchResultItemViewModelFactory>().InSingletonScope();

            IoC.Container.Bind<IUrlParameterToObjectsPlateHeater>().To<UrlParameterToObjectsPlateHeater>().InSingletonScope();
            IoC.Container.Bind<IAudioTrackFactory>().To<AudioTrackFactory>().InSingletonScope();

            _notificationService = new NotificationService();
            IoC.Container.Bind<INotificationService>().ToConstant(_notificationService).InSingletonScope();
            ImageCachingService imageCachingService;
            if (IsolatedStorageSettings.ApplicationSettings.Contains("ImageCachingService"))
            {
                imageCachingService = (ImageCachingService)IsolatedStorageSettings.ApplicationSettings["ImageCachingService"];
                imageCachingService.Initialize();
            }
            else
            {
                // Todo : we should use a factory in order to have a mockable service.
                imageCachingService = new ImageCachingService(_logService);
            }

            imageCachingService.SaveRequested += this.ImageCachingServiceSaveRequested;

            IoC.Container.Bind<ImageCachingService>().ToConstant(imageCachingService).InSingletonScope();

            IoC.Container.Bind<IPlaybackService>().To<PlaybackService>().InSingletonScope();
            IoC.Container.Bind<AlbumViewModelFactory>().To<AlbumViewModelFactory>();
            ActivateEagerTypes();

            ResolvePrivateMembers();
        }