Ejemplo n.º 1
0
        public ContactsPage()
        {
            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            ViewModel = new ContactsPageViewModel(contactStore, pageService);

            InitializeComponent();
        }
        public ContactDetailPage(ContactViewModel viewModel)
        {
            InitializeComponent();

            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            BindingContext = new ContactDetailViewModel(
                viewModel ?? new ContactViewModel(), contactStore, pageService);
        }
Ejemplo n.º 3
0
        public ContactDetailPage(ContactViewModel viewModel)
        {
            InitializeComponent();

            // BindingContext = viewModel;

            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            // Note that I've pushed the responsibility of creating a
            // ContactDetailViewModel into this page. This simplifies the code
            // in the consumer of this page (ContactsPageViewModel). So, every time
            // we create a new ContactDetailPage, we don't have to worry about
            // instantiating the underlying view model.

            BindingContext = new ContactDetailViewModel(
                viewModel ?? new ContactViewModel(), contactStore, pageService);
        }