Esempio n. 1
0
        public ShellViewModel(Func <TabViewModel> createTabViewModel)
        {
            if (createTabViewModel == null)
            {
                throw new ArgumentNullException(nameof(createTabViewModel));
            }

            _createTabViewModel = createTabViewModel;

            OpenTabCommand = DelegateCommand.NoParameter()
                             .OnExecute(() => OpenTab())
                             .Build();

            CloseTabCommand = DelegateCommand.WithParameter <TabViewModel>()
                              .OnExecute(item => DeactivateItem(item, true))
                              .Build();
        }
        public MainPageViewModel()
        {
            Characters = new BindableCollection <CharacterViewModel>
            {
                new CharacterViewModel("Arya Stark", "ms-appx:///resources/images/arya.jpg"),
                new CharacterViewModel("Catelyn Stark", "ms-appx:///resources/images/catelyn.jpg"),
                new CharacterViewModel("Cercei Lannister", "ms-appx:///resources/images/cercei.jpg"),
                new CharacterViewModel("Jamie Lannister", "ms-appx:///resources/images/jamie.jpg"),
                new CharacterViewModel("Jon Snow", "ms-appx:///resources/images/jon.jpg"),
                new CharacterViewModel("Rob Stark", "ms-appx:///resources/images/rob.jpg"),
                new CharacterViewModel("Sandor Clegane", "ms-appx:///resources/images/sandor.jpg"),
                new CharacterViewModel("Sansa Stark", "ms-appx:///resources/images/sansa.jpg"),
                new CharacterViewModel("Tyrion Lannister", "ms-appx:///resources/images/tyrion.jpg")
            };

            CharacterSelectedCommand = DelegateCommand.WithParameter <CharacterViewModel>()
                                       .OnExecute(p => CharacterSelected(p))
                                       .Build();
        }