Exemple #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);
            };
        }
Exemple #3
0
        void StateTable_Changed(object sender, EventArgs e)
        {
            state = stateTableSource.SelectedItem;

            cityTableSource.ValueChange -= CityTable_Changed;
            cityTableSource.Dispose();
            cityTableSource = null;

            cityTableSource      = new CityTableSource(locations, state);
            CityTableView.Source = cityTableSource;
            CityTableView.ReloadData();
            Console.WriteLine(state);
            cityTableSource.ValueChange += CityTable_Changed;
        }
        void StateTable_Changed(object sender, EventArgs e)
        {
            state = stateTableSource.SelectedItem;

            cityTableSource.ValueChange -= CityTable_Changed;
            cityTableSource.Dispose();
            cityTableSource = null;

            cityTableSource = new CityTableSource(locations, state);
            CityTableView.Source = cityTableSource;
            CityTableView.ReloadData();
            Console.WriteLine(state);
            cityTableSource.ValueChange += CityTable_Changed;
        }