public PersonalChartsPage()
        {
            InitializeComponent();

            pageLayout     = new StackLayout();
            absolutelayout = new AbsoluteLayout();
            lView          = InitializeListView();
            navBar         = new NavigationBarViewModel(lView, new List <Models.ItemsListView>(), master);
            floatingButton = InitializeFloatingButton();

            this.Icon = new FileImageSource {
                File = "ic_pie_chart_black_24dp.png"
            };
            this.Title   = "My Charts";
            this.Content = absolutelayout;

            pageLayout.Children.Add(navBar);
            UpdateLayout();
            AbsoluteLayout.SetLayoutFlags(pageLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(pageLayout, new Rectangle(0f, 0f, 1f, 1f));

            absolutelayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            absolutelayout.VerticalOptions   = LayoutOptions.FillAndExpand;
            absolutelayout.Children.Add(pageLayout);
            absolutelayout.Children.Add(floatingButton);
        }
Exemplo n.º 2
0
        public NavigationBarView()
        {
            InitializeComponent();

            viewModel = new NavigationBarViewModel();
            recordedMinutesLabel.BindingContext = viewModel;
        }
        public MainPage()
        {
            var themeLoader = new ThemeLoader();

            themeLoader.LoadTheme();

            InitializeComponent();

            repository         = new Repository();
            period             = new Period();
            pageService        = new PageService();
            initializeDatabase = new InitializeDatabase(pageService);
            period.Init(DateTime.Now, PeriodType.Month);
            trans = repository.GetTransactions(period);
            navigationBarViewModel = new NavigationBarViewModel(trans, pageService, repository, period);
            charts = new ChartsViewModel(navigationBarViewModel, pageService, repository);
            transactionsViewModel = new TransactionsViewModel(navigationBarViewModel, pageService, repository, period);

            MainVM = new MainPageViewModel(pageService, repository, initializeDatabase);

            this.BindingContext         = MainVM;
            overview.BindingContext     = charts;
            transactions.BindingContext = transactionsViewModel;

            MessagingCenter.Subscribe <NavigationBarViewModel>(this, MessagingString.UpdatePeriod, RefreshTransactions);
            MessagingCenter.Subscribe <SettingsPage>(this, MessagingString.UpdateTransactionsAfterSettingsChange, RefreshTransactions);
            MessagingCenter.Subscribe <SettingsViewModel>(this, MessagingString.UpdateTransactionsAfterReset, RefreshTransactions);
            MessagingCenter.Subscribe <TransactionsDetailsViewModel>(this, MessagingString.UpdateTransactions, RefreshTransactions);
            MessagingCenter.Subscribe <TransactionsViewModel>(this, MessagingString.DeleteTransactions, RefreshTransactions);
            MessagingCenter.Subscribe <TransactionsViewModel>(this, MessagingString.RefreshTransactions, RefreshTransactions);
        }
Exemplo n.º 4
0
 public NavigationBar()
 {
     InitializeComponent();
     DataContext = new NavigationBarViewModel();
     ViewModel = (NavigationBarViewModel)DataContext;
     RemoteToggleButton.IsChecked = true;
 }
Exemplo n.º 5
0
 public NavigationBar()
 {
     InitializeComponent();
     DataContext = new NavigationBarViewModel();
     ViewModel   = (NavigationBarViewModel)DataContext;
     RemoteToggleButton.IsChecked = true;
 }
 public IViewComponentResult Invoke(INavigationBar model)
 {
     if (!NavigationBarViewModel.RestoreNavTree(model))
     {
         NavigationBarViewModel.NavItems.Add(model);
     }
     return(View());
 }
Exemplo n.º 7
0
 public App()
 {
     _accountStore           = new AccountStore();
     _navigationStore        = new NavigationStore();
     _navigationBarViewModel = new NavigationBarViewModel(
         _accountStore,
         CreateHomeNavigationService(),
         CreateAccountNavigationService(),
         CreateLoginNavigationService());
 }
Exemplo n.º 8
0
        public void Given_a_search_string_that_doesnt_match_a_navigator_then_go_should_be_disabled()
        {
            var mp3Navigator = new Mock <ICanNavigate>();

            mp3Navigator.Setup(n => n.CanNavigateTo(It.IsRegex(".*mp3$"))).Returns(true);

            var model = new NavigationBarViewModel(new[] { mp3Navigator.Object });

            Assert.IsFalse(model.CanGo);

            model.SearchValue = "file.mp3";
            Assert.IsTrue(model.CanGo);

            model.SearchValue = "vid.mp4";
            Assert.IsFalse(model.CanGo);
        }
Exemplo n.º 9
0
        public void When_search_text_contains_empty_string_or_whitespace_should_disable_go_button()
        {
            var anyNavigator = new Mock <ICanNavigate>();

            anyNavigator.Setup(n => n.CanNavigateTo(It.IsAny <string>())).Returns(true);

            var model = new NavigationBarViewModel(new [] { anyNavigator.Object });

            Assert.IsFalse(model.CanGo);

            model.SearchValue = "  ";
            Assert.IsFalse(model.CanGo);

            model.SearchValue = "file.mp3";
            Assert.IsTrue(model.CanGo);
        }
Exemplo n.º 10
0
        private void Verify(Func <IEnumerable <Mock <ICanNavigate> >, Mock <ICanNavigate> > navigatorPicker, string searchString)
        {
            var mp3Navigator = new Mock <ICanNavigate>();

            mp3Navigator.Setup(n => n.CanNavigateTo(It.IsRegex(".*mp3$"))).Returns(true);

            var mp4Navigator = new Mock <ICanNavigate>();

            mp4Navigator.Setup(n => n.CanNavigateTo(It.IsRegex(".*mp4$"))).Returns(true);

            var navigators = new[] { mp3Navigator, mp4Navigator };

            var model = new NavigationBarViewModel(navigators.Select(x => x.Object));

            model.SearchValue = searchString;
            Assert.IsTrue(model.CanGo);

            model.Go();

            navigatorPicker(navigators).Verify(n => n.NavigateTo(searchString));
        }
Exemplo n.º 11
0
 public NavigationBarView(NavigationBarViewModel viewModel)
 {
     InitializeComponent();
     DataContext = viewModel;
 }
 private void RefreshTransactions(NavigationBarViewModel obj) => RefreshTransactions();