示例#1
0
 public UserDetailViewModel(INavigationService navigationService,
                            IPageDialogService dialogService,
                            ILoadingIndicatorService loadingIndicatorService)
     : base(navigationService, loadingIndicatorService)
 {
     Title           = "Detail Page";
     ResourceManager = TranslateExtension.ResourceManager;
 }
 public HomePageViewModel(INavigationService navigationService,
                          IPageDialogService dialogService,
                          ILoadingIndicatorService loadingIndicatorService)
     : base(navigationService, loadingIndicatorService)
 {
     Title           = "Main Page";
     UserList        = new ObservableCollection <Result>();
     ResourceManager = TranslateExtension.ResourceManager;
 }
        public SpotifySettingsPageModel(ILoadingIndicatorService loadingIndicator)
        {
            HeaderInfo = new HeaderInfo();
            HeaderInfo.Title = "Spotify";
            //HeaderInfo.IconUri = "pack://application:,,,/Torshify.Radio.Spotify;component/Resources/Spotify_Logo.png";

            _sections = new ObservableCollection<ISettingsSection>();
            _sections.Add(new SpotifyLoginSection(loadingIndicator));
        }
示例#4
0
        public SpotifySettingsPageModel(ILoadingIndicatorService loadingIndicator)
        {
            HeaderInfo       = new HeaderInfo();
            HeaderInfo.Title = "Spotify";
            //HeaderInfo.IconUri = "pack://application:,,,/Torshify.Radio.Spotify;component/Resources/Spotify_Logo.png";

            _sections = new ObservableCollection <ISettingsSection>();
            _sections.Add(new SpotifyLoginSection(loadingIndicator));
        }
示例#5
0
        public MainStationViewModel(
            ILoadingIndicatorService loadingIndicatorService,
            IRadio radio,
            IToastService toastService,
            ILoggerFacade logger,
            IDocumentStore documentStore)
        {
            _loadingIndicatorService = loadingIndicatorService;
            _radio                            = radio;
            _toastService                     = toastService;
            _logger                           = logger;
            _documentStore                    = documentStore;
            _fetchPreviewTimer                = new Timer(1000);
            _fetchPreviewTimer.Elapsed       += FetchPreviewTimerTick;
            _scheduler                        = TaskScheduler.FromCurrentSynchronizationContext();
            _styles                           = new ObservableCollection <TermModel>();
            _moods                            = new ObservableCollection <TermModel>();
            _selectedMoods                    = new ObservableCollection <TermModel>();
            _selectedMoods.CollectionChanged += (sender, args) =>
            {
                RaisePropertyChanged("SelectedMoodsText");
                _fetchPreviewTimer.Stop();
                _fetchPreviewTimer.Start();
            };

            _selectedStyles = new ObservableCollection <TermModel>();
            _selectedStyles.CollectionChanged += (sender, args) =>
            {
                RaisePropertyChanged("SelectedStylesText");
                _fetchPreviewTimer.Stop();
                _fetchPreviewTimer.Start();
            };

            ToggleStyleCommand   = new StaticCommand <TermModel>(ExecuteToggleStyle);
            ToggleMoodCommand    = new StaticCommand <TermModel>(ExecuteToggleMood);
            StartRadioCommand    = new AutomaticCommand(ExecuteStartRadio, CanExecuteStartRadio);
            IncreaseBoostCommand = new StaticCommand <TermModel>(ExecuteIncreaseBoost);
            DecreaseBoostCommand = new StaticCommand <TermModel>(ExecuteDecreaseBoost);
            RequireTermCommand   = new StaticCommand <TermModel>(ExecuteRequireTerm);
            BanTermCommand       = new StaticCommand <TermModel>(ExecuteBanTerm);
            Tempo                           = new Range();
            Tempo.Rounding                  = MidpointRounding.ToEven;
            Tempo.RangeChanged             += MetricChanged;
            Loudness                        = new Range();
            Loudness.RangeChanged          += MetricChanged;
            Energy                          = new Range();
            Energy.RangeChanged            += MetricChanged;
            ArtistFamiliarity               = new Range();
            ArtistFamiliarity.RangeChanged += MetricChanged;
            ArtistHotness                   = new Range();
            ArtistHotness.RangeChanged     += MetricChanged;
            SongHotness                     = new Range();
            SongHotness.RangeChanged       += MetricChanged;
            Danceability                    = new Range();
            Danceability.RangeChanged      += MetricChanged;
        }
        public MainStationViewModel(
            ILoadingIndicatorService loadingIndicatorService,
            IRadio radio,
            IToastService toastService,
            ILoggerFacade logger,
            IDocumentStore documentStore)
        {
            _loadingIndicatorService = loadingIndicatorService;
            _radio = radio;
            _toastService = toastService;
            _logger = logger;
            _documentStore = documentStore;
            _fetchPreviewTimer = new Timer(1000);
            _fetchPreviewTimer.Elapsed += FetchPreviewTimerTick;
            _scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            _styles = new ObservableCollection<TermModel>();
            _moods = new ObservableCollection<TermModel>();
            _selectedMoods = new ObservableCollection<TermModel>();
            _selectedMoods.CollectionChanged += (sender, args) =>
            {
                RaisePropertyChanged("SelectedMoodsText");
                _fetchPreviewTimer.Stop();
                _fetchPreviewTimer.Start();
            };

            _selectedStyles = new ObservableCollection<TermModel>();
            _selectedStyles.CollectionChanged += (sender, args) =>
            {
                RaisePropertyChanged("SelectedStylesText");
                _fetchPreviewTimer.Stop();
                _fetchPreviewTimer.Start();
            };

            ToggleStyleCommand = new StaticCommand<TermModel>(ExecuteToggleStyle);
            ToggleMoodCommand = new StaticCommand<TermModel>(ExecuteToggleMood);
            StartRadioCommand = new AutomaticCommand(ExecuteStartRadio, CanExecuteStartRadio);
            IncreaseBoostCommand = new StaticCommand<TermModel>(ExecuteIncreaseBoost);
            DecreaseBoostCommand = new StaticCommand<TermModel>(ExecuteDecreaseBoost);
            RequireTermCommand = new StaticCommand<TermModel>(ExecuteRequireTerm);
            BanTermCommand = new StaticCommand<TermModel>(ExecuteBanTerm);
            Tempo = new Range();
            Tempo.Rounding = MidpointRounding.ToEven;
            Tempo.RangeChanged += MetricChanged;
            Loudness = new Range();
            Loudness.RangeChanged += MetricChanged;
            Energy = new Range();
            Energy.RangeChanged += MetricChanged;
            ArtistFamiliarity = new Range();
            ArtistFamiliarity.RangeChanged += MetricChanged;
            ArtistHotness = new Range();
            ArtistHotness.RangeChanged += MetricChanged;
            SongHotness = new Range();
            SongHotness.RangeChanged += MetricChanged;
            Danceability = new Range();
            Danceability.RangeChanged += MetricChanged;
        }
        public RepositoriesExploreViewModel(
            IApplicationService applicationService           = null,
            ILoadingIndicatorService loadingIndicatorService = null)
        {
            applicationService      = applicationService ?? Locator.Current.GetService <IApplicationService>();
            loadingIndicatorService = loadingIndicatorService ?? Locator.Current.GetService <ILoadingIndicatorService>();

            Title = "Explore";

            var showDescription = applicationService.Account.RepositoryDescriptionInList;

            var repositories = new ReactiveList <Client.V1.Repository>();

            Items = repositories.CreateDerivedCollection(x =>
            {
                var description = showDescription ? x.Description : string.Empty;
                var vm          = new RepositoryItemViewModel(x.Name, description, x.Owner, new Avatar(x.Logo));
                vm.GoToCommand
                .Select(_ => new RepositoryViewModel(x.Owner, x.Slug))
                .Subscribe(NavigateTo);
                return(vm);
            });

            var canSearch = this.WhenAnyValue(x => x.SearchText).Select(x => !string.IsNullOrEmpty(x));

            SearchCommand = ReactiveCommand.CreateFromTask(async _ =>
            {
                repositories.Clear();

                if (string.IsNullOrEmpty(SearchText))
                {
                    return;
                }

                var client     = new HttpClient(new LoadingMessageHandler(loadingIndicatorService));
                client.Timeout = TimeSpan.FromSeconds(10);
                client.DefaultRequestHeaders.Add("Accept", "application/json");
                var resp  = await client.GetAsync("https://bitbucket.org/xhr/repos?term=" + Uri.EscapeDataString(SearchText));
                var body  = await resp.Content.ReadAsStringAsync().ConfigureAwait(false);
                var repos = JsonConvert.DeserializeObject <List <RepositorySearch> >(body);

                repositories.Reset(repos.Select(x =>
                {
                    return(new Client.V1.Repository
                    {
                        Name = x.Slug,
                        Description = x.Name,
                        Owner = x.Owner,
                        Logo = x.Avatar,
                        Website = x.Href,
                        Slug = x.Slug
                    });
                }));
            }, canSearch);
        }
        public SpotifyLoginSection(ILoadingIndicatorService loadingIndicator)
        {
            LoadingIndicator = loadingIndicator;
            HeaderInfo = new HeaderInfo
            {
                Title = "Login details"
            };

            UI = new SpotifyLoginSectionView
            {
                Model = this
            };

            LogOutCommand = new AutomaticCommand(ExecuteLogOut, CanExecuteLogOut);
        }
        public SpotifyLoginSection(ILoadingIndicatorService loadingIndicator)
        {
            LoadingIndicator = loadingIndicator;
            HeaderInfo       = new HeaderInfo
            {
                Title = "Login details"
            };

            UI = new SpotifyLoginSectionView
            {
                Model = this
            };

            LogOutCommand = new AutomaticCommand(ExecuteLogOut, CanExecuteLogOut);
        }
        public HotArtistsViewModel(
            IRadio radio,
            IToastService toastService,
            ILoadingIndicatorService loadingIndicator,
            ILoggerFacade logger,
            Dispatcher dispatcher)
        {
            _radio            = radio;
            _toastService     = toastService;
            _loadingIndicator = loadingIndicator;
            _logger           = logger;
            _dispatcher       = dispatcher;
            _artists          = new ObservableCollection <HotArtistModel>();

            PlayAllTracksCommand = new DelegateCommand(ExecutePlayAllTracks);
            PlayTopTrackCommand  = new DelegateCommand <HotArtistModel>(ExecutePlayTopTrack);
            QueueTopTrackCommand = new DelegateCommand <HotArtistModel>(ExecuteQueueTopTrack);
        }
示例#11
0
        public LoginPageViewModel(INavigationService navigationService,
                                  ILoadingIndicatorService loadingIndicatorService)
            : base(navigationService, loadingIndicatorService)
        {
            ResourceManager                 = TranslateExtension.ResourceManager;
            ChangeVisibilityCommand         = new Command(ChangePasswordStatus);
            LoginCommand                    = new AsyncCommand(Login);
            NavigateToForgotPasswordCommand = new AsyncCommand(Login);
            UnfocusedEmailCommand           = new Command <FocusEventArgs>(UnfocusedEmailAction);
            FocusedEmailCommand             = new Command <FocusEventArgs>(FocusedEmailAction);
            IsValidEmail                    = true;
            IsPasswordVisible               = false;

#if DEBUG
            Email    = "*****@*****.**";
            Password = "******";
#endif
        }
        public HotArtistsViewModel(
            IRadio radio,
            IToastService toastService,
            ILoadingIndicatorService loadingIndicator,
            ILoggerFacade logger,
            Dispatcher dispatcher)
        {
            _radio = radio;
            _toastService = toastService;
            _loadingIndicator = loadingIndicator;
            _logger = logger;
            _dispatcher = dispatcher;
            _artists = new ObservableCollection<HotArtistModel>();

            PlayAllTracksCommand = new DelegateCommand(ExecutePlayAllTracks);
            PlayTopTrackCommand = new DelegateCommand<HotArtistModel>(ExecutePlayTopTrack);
            QueueTopTrackCommand = new DelegateCommand<HotArtistModel>(ExecuteQueueTopTrack);
        }
示例#13
0
 public CoreRadio(
     [Import("CorePlayer")] ITrackPlayer corePlayer,
     IDocumentStore documentStore,
     ILoadingIndicatorService loadingIndicatorService,
     IToastService toastService,
     ILoggerFacade logger,
     Dispatcher dispatcher)
 {
     _trackQueuePublic        = new ObservableCollection <Track>();
     _trackStreamQueuePublic  = new ObservableCollection <ITrackStream>();
     _trackStreamQueue        = new ConcurrentQueue <ITrackStream>();
     _trackQueue              = new ConcurrentQueue <Track>();
     _corePlayer              = corePlayer;
     _documentStore           = documentStore;
     _loadingIndicatorService = loadingIndicatorService;
     _toastService            = toastService;
     _logger                    = logger;
     _dispatcher                = dispatcher;
     _corePlayer.Volume         = 0.2;
     _corePlayer.TrackComplete += OnTrackComplete;
     _corePlayer.Initialize();
 }
 public CoreRadio(
     [Import("CorePlayer")]ITrackPlayer corePlayer,
     IDocumentStore documentStore,
     ILoadingIndicatorService loadingIndicatorService,
     IToastService toastService,
     ILoggerFacade logger,
     Dispatcher dispatcher)
 {
     _trackQueuePublic = new ObservableCollection<Track>();
     _trackStreamQueuePublic = new ObservableCollection<ITrackStream>();
     _trackStreamQueue = new ConcurrentQueue<ITrackStream>();
     _trackQueue = new ConcurrentQueue<Track>();
     _corePlayer = corePlayer;
     _documentStore = documentStore;
     _loadingIndicatorService = loadingIndicatorService;
     _toastService = toastService;
     _logger = logger;
     _dispatcher = dispatcher;
     _corePlayer.Volume = 0.2;
     _corePlayer.TrackComplete += OnTrackComplete;
     _corePlayer.Initialize();
 }
 public LoadingMessageHandler(ILoadingIndicatorService loadingService)
     : base(new HttpClientHandler())
 {
     _loadingService = loadingService;
 }
 public void Setup()
 {
     _indicatorService = new LoadingIndicatorService();
 }
 public void Setup()
 {
     _indicatorService = new LoadingIndicatorService();
 }