public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            try
            {
                viewModel = SimpleIoc.Default.GetInstance <CountersViewModel>();

                var source = new CountersTableViewSource();
                TableView.Source = source;

                addCounterButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
                addCounterButton.AccessibilityIdentifier = "add_counter_button";
                NavigationItem.SetRightBarButtonItem(addCounterButton, false);

                bindings.Add(this.SetBinding(() => viewModel.Counters, () => DataSource));

                // Using this - new view controller is shown
                //addCounterButton.Clicked += (sender, e) =>
                //{
                //    var storyboard = UIStoryboard.FromName("Main", null);
                //    var vc = storyboard.InstantiateViewController("CounterView");
                //    ShowViewController(vc, this);
                //};

                // Using this - app crashes
                addCounterButton.SetCommand(nameof(UIBarButtonItem.Clicked), viewModel.ShowAddNewCounterCommand);
            }
            catch { }
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new CountersTableViewSource(TableView);

            TableView.Source = source;

            var button = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            NavigationItem.SetRightBarButtonItem(button, false);

            var set = this.CreateBindingSet <CountersView, CountersViewModel>();

            set.Bind(source).To(vm => vm.Counters);
            set.Bind(button).To(vm => vm.ShowAddNewCounterCommand);
            set.Apply();
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new CountersTableViewSource(TableView);

            TableView.Source = source;

            var button = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            button.AccessibilityIdentifier = "add_counter_button";
            NavigationItem.SetRightBarButtonItem(button, false);

            var set = this.CreateBindingSet <CountersView, CountersViewModel>();

            set.Bind(source).To(vm => vm.Counters);
            set.Bind(button).To(vm => vm.ShowAddNewCounterCommand);
            set.Apply();
            // Perform any additional setup after loading the view, typically from a nib.
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Console.WriteLine("Tatiana: inside CountersView class");
            System.Diagnostics.Debug.WriteLine("Test");

            var source = new CountersTableViewSource(TableView);

            TableView.Source = source;

            var button = new UIBarButtonItem(UIBarButtonSystemItem.Add);

            button.AccessibilityIdentifier = "add_counter_button";
            NavigationItem.SetRightBarButtonItem(button, false);

            var set = this.CreateBindingSet <CountersView, CountersViewModel>();

            set.Bind(source).To(vm => vm.Counters);
            set.Bind(button).To(vm => vm.ShowAddNewCounterCommand);
            set.Apply();
        }