Exemplo n.º 1
0
        public VocabularyPage()
        {
            InitializeComponent();

            if (Device.RuntimePlatform == Device.UWP || Device.RuntimePlatform == Device.iOS)
            {
                VocabularyListView.Header = null;
            }

            _viewModel = new VocabularyViewModel();
            ContainerStackLayout.BindingContext = _viewModel;
            BindingContext = _viewModel;

            MessagingCenter.Subscribe <SelectProgenyPage>(this, "Reload", async(sender) =>
            {
                _reload = true;
                await SetUserAndProgeny();
                _viewModel.PageNumber = 1;
                await Reload();
            });

            MessagingCenter.Subscribe <AccountViewModel>(this, "Reload", async(sender) =>
            {
                _reload = true;
                await SetUserAndProgeny();
                _viewModel.PageNumber = 1;
                await Reload();
            });
        }
Exemplo n.º 2
0
        public VocabularyDetailPage(VocabularyViewModel viewModel)
        {
            var connection = new VocabularyDB(DependencyService.Get <ISqliteConnection>());
            var page       = new NavigationService();

            Title          = (viewModel.Word == null || viewModel.Meaning == null) ? "Add new word" : "Edit word";
            BindingContext = new VocabDetailViewModel(viewModel ?? new VocabularyViewModel(), connection, page);
            InitializeComponent();
        }