Ejemplo n.º 1
0
        public PandoraPlaybackViewModel(INavigationServiceEx navigationServise, IPandoraService pandoraService, IPlaybackService playbackService)
        {
            _navigationServise = navigationServise;
            _pandoraService    = pandoraService;
            _playbackService   = playbackService;

            TogglePlayPauseCommand = new RelayCommand(TogglePlayPause);
            SkipNextCommand        = new RelayCommand(SkipNext, CanSkipNext);
            ThumbUpCommand         = new RelayCommand(() => { });
            ThumbDownCommand       = new RelayCommand(() => { });
            IncreaseVolumeCommand  = new RelayCommand(IncreaseVolume, CanIncreaseVolume);
            DecreaseVolumeCommand  = new RelayCommand(DecreaseVolume, CanDecreaseVolume);
            ToggleMuteCommand      = new RelayCommand <bool>(ToggleMute);

            Messenger.Default.Register <MediaEndedMessage>(this, (message) => { SkipNext(); });
            Messenger.Default.Register <MediaPlaybackSession>(this, (session) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    Position           = session.Position.ToString(@"hh\:mm\:ss");
                    Duration           = session.NaturalDuration.ToString(@"hh\:mm\:ss");
                    PercentagePosition = (session.Position.TotalSeconds / session.NaturalDuration.TotalSeconds) * 100;
                });
            });
        }
Ejemplo n.º 2
0
        public UniversalBaseViewModel(INavigationServiceEx navService)
        {
            NavigationService = navService;
            NavigationService.CanGoBackChanged += NavigationService_CanGoBackChanged;

            _systemNavManager = SystemNavigationManager.GetForCurrentView();
        }
Ejemplo n.º 3
0
        public PandoraMainViewModel(INavigationServiceEx navigationService, IPandoraService pandoraService, IDialogService dialogService)
        {
            _navigationService = navigationService;
            _pandoraService    = pandoraService;
            _dialogService     = dialogService;

            SearchCommand = new RelayCommand <string>((searchText) => Search(searchText));

            Messenger.Default.Register <AwaitableOperationMessage>(this, (args) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() => { IsBusy = args.IsRunning; BusyMessage = args.Message; });
            });

            Messenger.Default.Register <FaultMessage>(this, (args) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    if (args.FaultDetails != null)
                    {
                        _dialogService.ShowError(args.FaultDetails, "Connection error", "OK", () => { _navigationService.NavigateTo(PageKeys.HOME); });
                    }
                    else
                    {
                        _dialogService.ShowError(args.DisplayedMessage, "Connection error", "OK", () => { _navigationService.NavigateTo(PageKeys.HOME); });
                    }
                });
            });

            Connect();
        }
Ejemplo n.º 4
0
        public ShellViewModel(INavigationServiceEx navigationService)
        {
            navigationService.Navigated += (sender, args) =>
            {
                switch (navigationService.CurrentPageKey)
                {
                case PageKeys.HOME:
                case PageKeys.SETTINGS:
                case PageKeys.ABOUT:
                {
                    navigationService.Root.BackStack.Clear();
                }
                break;
                }

                if (navigationService.Root.CanGoBack)
                {
                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                }
                else
                {
                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                }

                foreach (var item in PrimaryMenu)
                {
                    (item.NavigateCommand as RelayCommand).RaiseCanExecuteChanged();
                }

                foreach (var item in SecondaryMenu)
                {
                    (item.NavigateCommand as RelayCommand).RaiseCanExecuteChanged();
                }
            };

            // Build the menus
            PrimaryMenu.Add(new MenuItem()
            {
                Glyph           = Icon.GetIcon("HomeIcon"),
                Text            = "Home",
                NavigateCommand = new RelayCommand(() => { navigationService.NavigateTo(PageKeys.HOME); },
                                                   () => { return(!navigationService.CurrentPageKey.Equals(PageKeys.HOME)); })
            });

            SecondaryMenu.Add(new MenuItem()
            {
                Glyph           = Icon.GetIcon("GearIcon"),
                Text            = "Settings",
                NavigateCommand = new RelayCommand(() => { navigationService.NavigateTo(PageKeys.SETTINGS); },
                                                   () => { return(!navigationService.CurrentPageKey.Equals(PageKeys.SETTINGS)); })
            });
            SecondaryMenu.Add(new MenuItem()
            {
                Glyph           = Icon.GetIcon("InfoIcon"),
                Text            = "About",
                NavigateCommand = new RelayCommand(() => { navigationService.NavigateTo(PageKeys.ABOUT); },
                                                   () => { return(!navigationService.CurrentPageKey.Equals(PageKeys.ABOUT)); })
            });
        }
Ejemplo n.º 5
0
        public SettingsViewModel(IFileService fileService, INavigationServiceEx navService, IInitializationValueService ivService) : base(navService)
        {
            _fileService = fileService;
            _ivService   = ivService;

            FileGroups.Add(new FileCollection(Constants.ROAMED_FILES_TITLE, _fileService.RoamedFiles, FileService.FileLocation.Roamed));
            FileGroups.Add(new FileCollection(Constants.LOCAL_FILES_TITLE, _fileService.LocalFiles, FileService.FileLocation.Local));
        }
Ejemplo n.º 6
0
        public QuizzenViewModel(IQuizService quizService, INavigationServiceEx navigationService)
        {
            _quizService       = quizService;
            _navigationService = navigationService;
            FetchListOfQuizzes();

            _navigationService.Navigated += NavigationService_Navigated;
        }
Ejemplo n.º 7
0
 public RoundViewModel(IRoundService roundService, INavigationServiceEx navigationService, IMessengerCache messengerCache)
 {
     _roundService      = roundService;
     _navigationService = navigationService;
     _messengerCache    = messengerCache;
     SelectedRound      = _messengerCache.CachedSelectedRound;
     Messenger.Default.Register <Round>(this, (round) => { SelectedRound = round; });
 }
Ejemplo n.º 8
0
        public TeamsViewModel(ITeamService teamService, INavigationServiceEx navigationService)
        {
            _teamService       = teamService;
            _navigationService = navigationService;
            FetchListOfTeams();

            _navigationService.Navigated += NavigationService_Navigated;
        }
Ejemplo n.º 9
0
        public void RegisterFrame(Frame frame)
        {
            navigationService = new NavigationService(frame);

            _container.Instance(navigationService);

            //navigationService.NavigateToViewModel(typeof(ProfileViewModel), "Main", null);
        }
Ejemplo n.º 10
0
        public MainViewModel(ITeamService teamService, IRoundService roundService, INavigationServiceEx navigationService)
        {
            _teamService       = teamService;
            _roundService      = roundService;
            _navigationService = navigationService;
            GetRoundsFromEnabledQuiz();

            _navigationService.Navigated += NavigationService_Navigated;
        }
        public EditTeamViewModel(ITeamService teamService, INavigationServiceEx navigationService, IMessengerCache messengerCache)
        {
            _teamService       = teamService;
            _navigationService = navigationService;
            _messengerCache    = messengerCache;

            SelectedTeam = _messengerCache.CachedSelectedTeam;
            Messenger.Default.Register <Team>(this, (team) => { SelectedTeam = team; });
        }
Ejemplo n.º 12
0
        public EditQuizViewModel(IQuizService quizService, INavigationServiceEx navigationServiceEx, IMessengerCache messengerCache)
        {
            _quizService       = quizService;
            _navigationService = navigationServiceEx;
            _messengerCache    = messengerCache;

            SelectedQuiz = _messengerCache.CachedSelectedQuiz;
            Messenger.Default.Register <Quiz>(this, (quiz) => { SelectedQuiz = quiz; });
            FetchListOfQuizzes();
        }
Ejemplo n.º 13
0
        public PandoraStationDetailsViewModel(INavigationServiceEx navigationService, IPandoraService pandoraService)
        {
            _navigationService = navigationService;
            _pandoraService    = pandoraService;

            FilterThumbsUpCommand   = new RelayCommand(FilterThumbsUp, () => { return(_canFilterThumbsUp); });
            FilterThumbsDownCommand = new RelayCommand(FilterThumbsDown, () => { return(_canFilterThumbsDown); });

            PlayStationCommand = new RelayCommand <string>((token) => { _navigationService.NavigateTo(PageKeys.PANDORA_PLAYBACK, token); });
        }
Ejemplo n.º 14
0
 public void RegisterFrame(Frame frame)
 {
     navigationService = new NavigationService(frame);
     _container.Instance(navigationService);
     window = GetView() as MetroWindow;
     if (window is null)
     {
         throw new Exception("Can't get view");
     }
     NavigateToView("Home");
 }
        public CorrectViewModel(ITeamService teamService, IRoundService roundService, INavigationServiceEx navigationService)
        {
            _teamService       = teamService;
            _roundService      = roundService;
            _navigationService = navigationService;

            _teamRoundDictionary = new Dictionary <int, int>();

            FetchListOfEnabledTeams();
            _navigationService.Navigated += NavigationService_Navigated;
        }
Ejemplo n.º 16
0
        public MainViewModel(IFileService fileService, INavigationServiceEx navService) : base(navService)
        {
            _fileService = fileService;

            _narrowNumberScope.Names.Add(new InputScopeName(InputScopeNameValue.Number));
            _narrowDefaultScope.Names.Add(new InputScopeName(InputScopeNameValue.Default));
            _wideNumberScope.Names.Add(new InputScopeName(InputScopeNameValue.Number));
            _wideDefaultScope.Names.Add(new InputScopeName(InputScopeNameValue.Default));

            CurrentNarrowInputScope = _narrowNumberScope;
            CurrentWideInputScope   = _wideNumberScope;

            FileGroups.Add(new FileCollection(Constants.ROAMED_FILES_TITLE, _fileService.RoamedFiles, FileService.FileLocation.Roamed));
            FileGroups.Add(new FileCollection(Constants.LOCAL_FILES_TITLE, _fileService.LocalFiles, FileService.FileLocation.Local));
        }
Ejemplo n.º 17
0
        public SettingsViewModelDesign(IFileService fileService, INavigationServiceEx navService, IInitializationValueService ivService) : base(fileService, navService, ivService)
        {
            ObservableCollection <IBindableStorageFile> localFiles = new ObservableCollection <IBindableStorageFile>
            {
                new MockBindableStorageFile(),
                new MockBindableStorageFile()
            };
            ObservableCollection <IBindableStorageFile> roamedFiles = new ObservableCollection <IBindableStorageFile>
            {
                new MockBindableStorageFile(),
                new MockBindableStorageFile()
            };

            FileGroups = new ObservableCollection <FileCollection>
            {
                new FileCollection(Constants.LOCAL_FILES_TITLE, localFiles, FileService.FileLocation.Local),
                new FileCollection(Constants.ROAMED_FILES_TITLE, roamedFiles, FileService.FileLocation.Roamed)
            };
            this.RoamingSpaceUsed = 50.23;
        }
Ejemplo n.º 18
0
 public SettingsViewModelDesign(IFileService fileService, INavigationServiceEx navService)
     : base(fileService, navService)
 {
     ObservableCollection<IBindableStorageFile> localFiles = new ObservableCollection<IBindableStorageFile>
     {
         new MockBindableStorageFile(),
         new MockBindableStorageFile()
     };
     ObservableCollection<IBindableStorageFile> roamedFiles = new ObservableCollection<IBindableStorageFile>
     {
         new MockBindableStorageFile(),
         new MockBindableStorageFile()
     };
     FileGroups = new ObservableCollection<FileCollection>
     {
         new FileCollection(Constants.LOCAL_FILES_TITLE, localFiles, FileService.FileLocation.Local),
         new FileCollection(Constants.ROAMED_FILES_TITLE, roamedFiles, FileService.FileLocation.Roamed)
     };
     this.RoamingSpaceUsed = 50.23;
 }
Ejemplo n.º 19
0
        protected override void ConfigureViewModelLocator()
        {
            ViewModelLocationProvider.SetDefaultViewModelFactory((view, type) =>
            {
                INavigationServiceEx navigationService = null;
                switch (view)
                {
                case Page page:
                    navigationService = Container.CreateNavigationService(page);
                    break;

                case VisualElement visualElement:
                    if (visualElement.TryGetParentPage(out var attachedPage))
                    {
                        navigationService = Container.CreateNavigationService(attachedPage);
                    }
                    break;
                }

                return(Container.Resolve(type, (typeof(INavigationServiceEx), navigationService)));
            });
        }
Ejemplo n.º 20
0
 public ShellViewModel(INavigationServiceEx navigationService)
 {
     _navigationService = navigationService;
 }
Ejemplo n.º 21
0
 public MainViewModelDesign(IFileService fileService, INavigationServiceEx navService)
     : base(fileService, navService)
 {
 }
Ejemplo n.º 22
0
 public MainViewModelDesign(IFileService fileService, INavigationServiceEx navService) : base(fileService, navService)
 {
 }
Ejemplo n.º 23
0
 public SettingsViewModel(IFileService fileService, INavigationServiceEx navService)
 {
     _fileService = fileService as FileService;
     _navigationService = navService as NavigationServiceEx;            
 }        
Ejemplo n.º 24
0
 public NavigationContext()
 {
     this.navigationService = SimpleIoc.Default.GetInstance <INavigationServiceEx>();
 }
Ejemplo n.º 25
0
 public CreateQuizViewModel(IQuizService quizService, INavigationServiceEx navigationServiceEx)
 {
     _quizService       = quizService;
     _navigationService = navigationServiceEx;
 }
Ejemplo n.º 26
0
 public MainViewModel(IFileService fileService, INavigationServiceEx navService)
 {
     _fileService = (fileService as FileService);
     _navigationService = navService as NavigationServiceEx;            
 }        
Ejemplo n.º 27
0
 public NavigationContext()
 {
     this.navigationService = SimpleIoc.Default.GetInstance<INavigationServiceEx>();
 }