示例#1
0
 public ScriptViewModel(ObservableCollection <Script> scripts)
 {
     Scripts = scripts;
     AddExpressionCommand = new DelegateCommand(ExecuteAddExpression);
     AddFileCommand       = new DelegateCommand(ExecuteAddFile);
     RemoveScriptCommand  = new AutomaticCommand <Script>(ExecuteRemoveScript, CanExecuteRemoveScript);
     EditScriptCommand    = new AutomaticCommand <Script>(ExecuteEditScript, CanExecuteEditScript);
 }
 public PlaylistViewModel(IPlayerController player, IEventAggregator eventAggregator)
 {
     Player = player;
     _eventAggregator = eventAggregator;
     MoveItemCommand = new AutomaticCommand<Tuple<int, int>>(ExecuteMoveItem, CanExecuteMoveItem);
     RemoveItemCommand = new AutomaticCommand<IPlaylistTrack>(ExecuteRemoveItem, CanExecuteRemoveItem);
     RemoveItemsCommand = new AutomaticCommand<IEnumerable<IPlaylistTrack>>(ExecuteRemoveItems,
                                                                            CanExecuteRemoveItems);
 }
示例#3
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 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);
        }
        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);
        }
        public SpotifyLoginSection(ILoadingIndicatorService loadingIndicator)
        {
            LoadingIndicator = loadingIndicator;
            HeaderInfo       = new HeaderInfo
            {
                Title = "Login details"
            };

            UI = new SpotifyLoginSectionView
            {
                Model = this
            };

            LogOutCommand = new AutomaticCommand(ExecuteLogOut, CanExecuteLogOut);
        }
        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);
        }
        public FilesetListViewModel(
            Dispatcher dispatcher,
            IFilesetService filesetService,
            IFileReplicationService replicationService)
        {
            _dispatcher         = dispatcher;
            _filesetService     = filesetService;
            _replicationService = replicationService;
            _filesets           = new ObservableCollection <FilesetViewModel>();

            AddFilesetCommand      = new DelegateCommand(ExecuteAddFileset);
            RemoveFilesetCommand   = new AutomaticCommand <FilesetViewModel>(ExecuteRemoveFileset, CanExecuteRemoveFileset);
            SaveAllFilesetsCommand = new DelegateCommand(ExecuteSaveAllFilesets);
            ExportFilesetCommand   = new AutomaticCommand <FilesetViewModel>(ExecuteExportFileset, CanExecuteExportFileset);
            ImportFilesetCommand   = new DelegateCommand(ExecuteImportFileset);
            CommandBar             = new CommandBar();
        }
        public FilesetViewViewModel(
            IFilesetService filesetService,
            IFileReplicationService fileReplicationService,
            IActivityLogService activityLogService)
        {
            _filesetService         = filesetService;
            _fileReplicationService = fileReplicationService;
            _activityLogService     = activityLogService;
            _categories             = new ObservableCollection <string>();

            Categories = CollectionViewSource.GetDefaultView(_categories);

            BrowseDestinationFolderCommand = new AutomaticCommand(ExecuteBrowseDestinationFolder, CanExecuteBrowseDestinationFolder);
            BrowseSourceFolderCommand      = new AutomaticCommand(ExecuteBrowseSourceFolder, CanExecuteBrowseSourceFolder);

            AddIncludeFileCommand    = new AutomaticCommand(ExecuteAddIncludeFile, CanExecuteAddIncludeFile);
            RemoveIncludeFileCommand = new AutomaticCommand <IEnumerable>(ExecuteRemoveIncludeFile, CanExecuteRemoveIncludeFile);

            AddExcludeFileCommand    = new AutomaticCommand(ExecuteAddExcludeFile, CanExecuteAddExcludeFile);
            RemoveExcludeFileCommand = new AutomaticCommand <IEnumerable>(ExecuteRemoveExcludeFile, CanExecuteRemoveExcludeFile);

            ManualCopyCommand       = new DelegateCommand(ExecuteManualCopy);
            ClearActivityLogCommand = new DelegateCommand(ExecuteClearActiviyLog);
        }
 public StationsViewModel()
 {
     NavigateToTileCommand = new AutomaticCommand <Tile>(ExecuteNavigateToTile, CanExecuteNavigateToTile);
 }