コード例 #1
0
        public MainViewModel()
        {
            _autoCompleteList = new ObservableCollection<string>();

            SearchBarLoadingIndicatorService = new LoadingIndicatorService();
            NavigateBackCommand = new AutomaticCommand(ExecuteNavigateBack, CanExecuteNavigateBack);
            NavigateForwardCommand = new AutomaticCommand(ExecuteNavigateForward, CanExecuteNavigateForward);
            NavigateToHomeCommand = new AutomaticCommand(ExecuteNavigateToHome, CanExecuteNavigateToHome);
            NavigateToSettingsCommand = new AutomaticCommand(ExecuteNavigateToSettings, CanExecuteNavigateToSettings);
            SearchCommand = new AutomaticCommand<string>(ExecuteSearch, CanExecuteSearch);
        }
コード例 #2
0
        public NowPlayingViewModel(IRadio radio, [Import("CorePlayer")] ITrackPlayer player, Dispatcher dispatcher)
        {
            _radio = radio;
            _player = player;
            _dispatcher = dispatcher;
            _random = new Random();
            _taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            NavigateBackCommand = new AutomaticCommand(ExecuteNavigateBack, CanExecuteNavigateBack);
            NextTrackCommand = new ManualCommand(ExecuteNextTrack, CanExecuteNextTrack);
            TogglePlayPauseCommand = new ManualCommand(ExecuteTogglePlayPause, CanExecuteTogglePlayPause);
            ShareTrackCommand = new ManualCommand<Track>(ExecuteShareTrack, CanExecuteShareTrack);
        }
コード例 #3
0
        public SpotifyLoginSection(ILoadingIndicatorService loadingIndicator)
        {
            LoadingIndicator = loadingIndicator;
            HeaderInfo = new HeaderInfo
            {
                Title = "Login details"
            };

            UI = new SpotifyLoginSectionView
            {
                Model = this
            };

            LogOutCommand = new AutomaticCommand(ExecuteLogOut, CanExecuteLogOut);
        }
コード例 #4
0
        public HotkeySection()
        {
            HeaderInfo = new HeaderInfo
            {
                Title = "Global hotkeys"
            };

            UI = new HotkeySectionView
            {
                DataContext = this
            };

            AddHotkeyCommand = new StaticCommand(ExecuteAddHotkey);
            RemoveHotkeyCommand = new AutomaticCommand<GlobalHotkey>(ExecuteRemoveHotkey, CanExecuteRemoveHotkey);
            RestoreDefaultHotkeysCommand = new StaticCommand(ExecuteRestoreDefaultHotkeys);
        }
コード例 #5
0
 public StationsViewModel()
 {
     NavigateToTileCommand = new AutomaticCommand<Tile>(ExecuteNavigateToTile, CanExecuteNavigateToTile);
 }
コード例 #6
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;
        }