Пример #1
0
        public ContactsPage()
        {
            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            ViewModel = new ContactsPageViewModel(contactStore, pageService);
            InitializeComponent();
        }
Пример #2
0
        public ContactDetailPage(ContactViewModel viewModel)
        {
            InitializeComponent();
            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            BindingContext = new ContactDetailViewModel(viewModel ?? new ContactViewModel(), contactStore, pageService);
        }
        public ContactsDetailPage(ContactViewModel viewModel)
        {
            InitializeComponent();

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

            Title          = (viewModel.Phone == null) ? "Novo Contato" : "Editar Contato";
            BindingContext = new ContactsDetailViewModel(viewModel ?? new ContactViewModel(), contactStore, pageService);
        }
Пример #4
0
        public ContactsPage()
        {
            //Al iniciar el objeto creamos una instancia de la BBDD y otra del servicio de las Pages
            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            var pageService  = new PageService();

            //Iniciamos el modelo de datos con la BBDD y el servicio de la Page
            ViewModel = new ContactsPageViewModel(contactStore, pageService);

            InitializeComponent();
        }
        public ContactDetailPage(ContactViewModel viewModel)
        {
            InitializeComponent();
            //Iniciamos el almacenamiento en la BBDD desde aqui en el detalle de la Page de contactos.
            var contactStore = new SQLiteContactStore(DependencyService.Get <ISQLiteDb>());
            //Iniciamos el servicio de Xamarin.
            var pageService = new PageService();

            //Asignamos el contexto al modelo detallado de la vista para el DataBinding, en caso de que no este iniciado,
            //lo iniciamos con los parametros.
            BindingContext = new ContactDetailViewModel(viewModel ?? new ContactViewModel(), contactStore, pageService);
        }