Пример #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.SetLeftBarButtonItem(
                new UIBarButtonItem(UIImage.FromBundle("menu.png"), UIBarButtonItemStyle.Plain, (s, e) => NavigationController.PopViewController(true)),
                true);

            locations = new AvailableLocations();

            state           = locations.States.ElementAt(0);
            currentSelected = locations.PotentialLocations.Where(loc => loc.State == state).ElementAt(0);

            stateTableSource      = new StateTableSource(locations);
            cityTableSource       = new CityTableSource(locations, locations.States.ElementAt(0));
            StateTableView.Source = stateTableSource;
            CityTableView.Source  = cityTableSource;

            StateTableView.SelectRow(NSIndexPath.FromRowSection(0, 0), false, UITableViewScrollPosition.None);

            stateTableSource.ValueChanged += StateTable_Changed;
            cityTableSource.ValueChange   += CityTable_Changed;

            RecentCitiesButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                var storyboard = UIStoryboard.FromName("Main", null);
                var recentCitiesViewController = (RecentCitiesTableViewController)storyboard.InstantiateViewController("RecentCitiesTableViewController");
                recentCitiesViewController.FromMenu = false;
                this.ShowViewController(recentCitiesViewController, this);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationItem.SetLeftBarButtonItem(
                new UIBarButtonItem(UIImage.FromBundle("menu.png"), UIBarButtonItemStyle.Plain, (s, e) => NavigationController.PopViewController(true)),
                true);

            locations = new AvailableLocations();

            state = locations.States.ElementAt(0);
            currentSelected = locations.PotentialLocations.Where(loc => loc.State == state).ElementAt(0);

            stateTableSource = new StateTableSource(locations);
            cityTableSource = new CityTableSource(locations, locations.States.ElementAt(0));
            StateTableView.Source = stateTableSource;
            CityTableView.Source = cityTableSource;

            StateTableView.SelectRow(NSIndexPath.FromRowSection(0, 0), false, UITableViewScrollPosition.None);

            stateTableSource.ValueChanged += StateTable_Changed;
            cityTableSource.ValueChange += CityTable_Changed;

            RecentCitiesButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                var storyboard = UIStoryboard.FromName("Main", null);
                var recentCitiesViewController = (RecentCitiesTableViewController)storyboard.InstantiateViewController("RecentCitiesTableViewController");
                recentCitiesViewController.FromMenu = false;
                this.ShowViewController(recentCitiesViewController, this);
            };
        }