Esempio n. 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _sideMenuManager = new SideMenuManager();
            NavigationItem.SetLeftBarButtonItem(
                new UIBarButtonItem(ConstantsHelper.Menu, UIBarButtonItemStyle.Plain, (sender, e) => {
                PresentViewController(_sideMenuManager.LeftNavigationController, true, null);
            }),
                false);
            SetupSideMenu();

            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, NavigateToEditToDoController)
            {
                AccessibilityLabel = ConstantsHelper.AddNewToDoButtonAccessibilityLabel
            };

            NavigationItem.RightBarButtonItem = addButton;

            Repository = new ToDoRepository(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ConstantsHelper.DatabaseName));

            _activeTab = new ToDoActiveViewController(Repository);
            _doneTab   = new ToDoDoneViewController(Repository);

            ViewControllers = new[] { _activeTab, _doneTab };
            SelectedIndex   = 1;
        }
 public ToDoDataSource(ToDoBaseViewController controller)
 {
     _controller = controller;
     if (controller is ToDoActiveViewController activeViewController)
     {
         ToDoModels = activeViewController.Repository.GetAll().Where(x => x.Status == "Active").ToList();
     }
     else if (controller is ToDoDoneViewController doneViewController)
     {
         ToDoModels = doneViewController.Repository.GetAll().Where(x => x.Status == "Done").ToList();
     }
 }