Example #1
0
        public App()
        {
            MainPage = new NavigationPage(new RestaurantList(restaurants));

            MessagingCenter.Subscribe <RestaurantGuide.App, string> (this, "show", async(sender, arg) => {
                // do something whenever the "Hi" message is sent
                Debug.WriteLine("Search argument: " + arg);

                var restaurant = from r in restaurants
                                 where r.Name == arg
                                 select r;

                // set initial state
                await MainPage.Navigation.PopToRootAsync();

                // load screen

                var rPage = new RestaurantDetail();
                // set BindingContext
                rPage.BindingContext = restaurant.FirstOrDefault();

                // display screen
                await MainPage.Navigation.PushAsync(rPage);
            });
        }
Example #2
0
        protected override void OnStart()
        {
            // Handle when your app starts
            var startingRestId = " (not set)";

            if (Application.Current.Properties.ContainsKey("rid"))
            {
                var o = Application.Current.Properties ["rid"];
                // contains the value (eg. 5)
                var s = Application.Current.Properties ["rid"] as string;
                // contains null (used to contain "5")
                //var t = (string)Application.Current.Properties ["rid"];
                // throws an invalid cast exception!

                startingRestId = o.ToString();
                if (!String.IsNullOrWhiteSpace(startingRestId))
                {
                    var rPage = new RestaurantDetail();
                    // set BindingContext
                    rPage.BindingContext = restaurants [Convert.ToInt32(o)];
                    MainPage.Navigation.PushAsync(rPage);
                }
                else
                {
                    startingRestId = "(set but not valid)";
                }
            }
            Debug.WriteLine("OnStart:" + startingRestId);
        }
Example #3
0
		public App ()
		{	
			MainPage = new NavigationPage(new RestaurantList (restaurants));

			MessagingCenter.Subscribe<RestaurantGuide.App, string> (this, "show", async (sender, arg) => {
				// do something whenever the "Hi" message is sent
				Debug.WriteLine("Search argument: " + arg);

				var restaurant = from r in restaurants
						where r.Name == arg
						select r;

				// set initial state
				await MainPage.Navigation.PopToRootAsync ();

				// load screen

				var rPage = new RestaurantDetail ();
				// set BindingContext
				rPage.BindingContext = restaurant.FirstOrDefault();

				// display screen
				await MainPage.Navigation.PushAsync (rPage);
			});
		}
Example #4
0
		protected override void OnStart()
		{
			// Handle when your app starts
			var startingRestId = " (not set)";

			if (Application.Current.Properties.ContainsKey("rid")){
				var o = Application.Current.Properties ["rid"];
				// contains the value (eg. 5)
				var s = Application.Current.Properties ["rid"] as string;
				// contains null (used to contain "5")
				//var t = (string)Application.Current.Properties ["rid"];
				// throws an invalid cast exception!

				startingRestId = o.ToString ();
				if (!String.IsNullOrWhiteSpace (startingRestId)) {
					var rPage = new RestaurantDetail ();
					// set BindingContext
					rPage.BindingContext = restaurants [Convert.ToInt32 (o)];
					MainPage.Navigation.PushAsync (rPage);
				} else {
					startingRestId = "(set but not valid)";
				}
				
			}
			Debug.WriteLine ("OnStart:" + startingRestId);
		}
		public void OnItemSelected (object sender, SelectedItemChangedEventArgs e) {
			var r = (Restaurant)e.SelectedItem;

			var rPage = new RestaurantDetail();
			rPage.BindingContext = r;
			Navigation.PushAsync(rPage);
		}
		public void OnItemSelected (object sender, SelectedItemChangedEventArgs e) {
			var r = (Restaurant)e.SelectedItem;

			Application.Current.Properties ["rid"] = r.Number;

			var rPage = new RestaurantDetail();
			rPage.BindingContext = r;
			Navigation.PushAsync(rPage);
		}
        public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var r = (Restaurant)e.SelectedItem;

            var rPage = new RestaurantDetail();

            rPage.BindingContext = r;
            Navigation.PushAsync(rPage);
        }
Example #8
0
        public void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var r = (Restaurant)e.SelectedItem;

            Application.Current.Properties ["rid"] = r.Number;

            var rPage = new RestaurantDetail();

            rPage.BindingContext = r;
            Navigation.PushAsync(rPage);
        }
		public async void OnItemSelected (object sender, SelectedItemChangedEventArgs e) {
			if (e.SelectedItem == null)
				return;
			
			var r = (Restaurant)e.SelectedItem;

			Application.Current.Properties ["rid"] = r.Number;
			await App.Current.SavePropertiesAsync ();

			var rPage = new RestaurantDetail();
			rPage.BindingContext = r;
			await Navigation.PushAsync(rPage);

			((ListView)sender).SelectedItem = null;
		}
Example #10
0
		protected override void OnStart()
		{
			// Handle when your app starts
			var r = "";
			if (Application.Current.Properties.ContainsKey("rid")){
				r = Application.Current.Properties ["rid"] as string;
				if (!String.IsNullOrWhiteSpace(r)) {
					var rPage = new RestaurantDetail();
					// set BindingContext
					MainPage.Navigation.PushAsync(rPage);
				}
				
			}
			Debug.WriteLine ("OnStart:" + r);
		}
Example #11
0
        protected override void OnStart()
        {
            // Handle when your app starts
            var r = "";

            if (Application.Current.Properties.ContainsKey("rid"))
            {
                r = Application.Current.Properties ["rid"] as string;
                if (!String.IsNullOrWhiteSpace(r))
                {
                    var rPage = new RestaurantDetail();
                    // set BindingContext
                    MainPage.Navigation.PushAsync(rPage);
                }
            }
            Debug.WriteLine("OnStart:" + r);
        }
Example #12
0
        public async void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
            {
                return;
            }

            var r = (Restaurant)e.SelectedItem;

            Application.Current.Properties ["rid"] = r.Number;
            await App.Current.SavePropertiesAsync();

            var rPage = new RestaurantDetail();

            rPage.BindingContext = r;
            await Navigation.PushAsync(rPage);

            ((ListView)sender).SelectedItem = null;
        }