public AndroidImageButtonPageCS()
        {
            var imageButton = new Xamarin.Forms.ImageButton {
                Source = "XamarinLogo.png", BackgroundColor = Color.GhostWhite, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand
            };

            imageButton.Clicked += (sender, e) => imageButton.On <Android>().SetIsShadowEnabled(!imageButton.On <Android>().GetIsShadowEnabled());

            imageButton.On <Android>()
            .SetIsShadowEnabled(true)
            .SetShadowColor(Color.Gray)
            .SetShadowOffset(new Size(10, 10))
            .SetShadowRadius(12);

            Title   = "Android ImageButton";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    imageButton,
                    new Label {
                        Text = "Tap the ImageButton to toggle the shadow effect.",FontSize                                                    = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center
                    }
                }
            };
        }
Exemplo n.º 2
0
        public Sides()
        {
            StackLayout stacklayout = new StackLayout();

            BackgroundColor = Constants.BackgroundColor;
            Padding         = new Thickness(60, 20, 60, 20);

            var Lbl_fries = new Label {
                Text = "Happytite SFries", TextColor = Color.Black
            };
            var p1 = new Label {
                Text = "Price: 4$"
            };
            var fries = new Xamarin.Forms.ImageButton {
                Source = "side.jpg", BackgroundColor = Color.Transparent
            };
            var add1 = new Button {
                Text = "Add to cart"
            };

            var Lbl_salad = new Label {
                Text = "Chicken Ceasar Salad", TextColor = Color.Black
            };
            var p2 = new Label {
                Text = "Price: 5$"
            };
            var salad = new Xamarin.Forms.ImageButton {
                Source = "Salad.jpg", BackgroundColor = Color.Transparent
            };
            var add2 = new Button {
                Text = "Add to cart"
            };


            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { Lbl_fries, p1, fries, add1, Lbl_salad, p2, salad, add2 }
            };

            ScrollView scroll = new ScrollView
            {
                Content = Content
            };

            Content = scroll;

            add1.Clicked += (object s, EventArgs e) =>
            {
            };

            add2.Clicked += (object s, EventArgs e) =>
            {
            };
        }
 private static Action <IShadow, ImageSource> GetSetAction(IShadow <Xamarin.Forms.Element> shadow)
 {
     return(shadow.Item switch
     {
         Xamarin.Forms.Button _ => ImageSourceMappers.Button,
         Xamarin.Forms.Image _ => ImageSourceMappers.Image,
         Xamarin.Forms.ToolbarItem _ => ImageSourceMappers.ToolbarItem,
         Xamarin.Forms.ImageButton _ => ImageSourceMappers.ImageButton,
         Xamarin.Forms.ImageCell _ => ImageSourceMappers.ImageCell,
         _ => throw new ArgumentException()
     });
Exemplo n.º 4
0
        private static Xamarin.Forms.ImageButton createImButtonForFooter(string source)
        {
            var imButton = new Xamarin.Forms.ImageButton
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Source            = source,
                WidthRequest      = 40,
                HeightRequest     = 40,
                BackgroundColor   = Color.White
            };

            return(imButton);
        }
Exemplo n.º 5
0
 protected async override void Invoke(ImageButton button)
 {
     Xamarin.Forms.ImageButton     img = (Xamarin.Forms.ImageButton)button;
     Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)img.Source;
     if (objFileImageSource.File == "yes.png")
     {
         button.Source = "no.png";
     }
     else
     {
         button.Source = "yes.png";
     }
 }
Exemplo n.º 6
0
        public MenuArt()
        {
            InitializeComponent();

            var imageButton = new Xamarin.Forms.ImageButton {
                Source = "XamarinLogo.png", BackgroundColor = Color.GhostWhite
            };

            imageButton.On <Android>()
            .SetIsShadowEnabled(true)
            .SetShadowColor(Color.Gray)
            .SetShadowOffset(new Size(10, 10))
            .SetShadowRadius(12);
        }
		/// <summary>
		/// Sets the image source.
		/// </summary>
		/// <param name="targetButton">The target button.</param>
		/// <param name="model">The model.</param>
		/// <param name="imageSource">Optional source for disabled image.</param>
		/// <returns>A <see cref="Task"/> for the awaited operation.</returns>
		private async Task SetImageSourceAsync (global::Android.Widget.Button targetButton, ImageButton model)
		{
			const int Padding = 10;
			var source = model.IsEnabled ? model.Source : model.DisabledSource ?? model.Source;

			using (var bitmap = await this.GetBitmapAsync (source)) {
				if (bitmap != null) {
					Drawable drawable = new BitmapDrawable (bitmap);
					var scaledDrawable = GetScaleDrawable (drawable, GetWidth (model.ImageWidthRequest),
						                     GetHeight (model.ImageHeightRequest));
					scaledDrawable.Alpha = (int)(255 * model.ImageOpacity);

					Drawable left = null;
					Drawable right = null;
					Drawable top = null;
					Drawable bottom = null;
					targetButton.CompoundDrawablePadding = Padding;
					switch (model.Orientation) {
					case ImageOrientation.ImageToLeft:
						targetButton.Gravity = GravityFlags.Left | GravityFlags.CenterVertical;
						left = scaledDrawable;
						break;
					case ImageOrientation.ImageToRight:
						targetButton.Gravity = GravityFlags.Right | GravityFlags.CenterVertical;
						right = scaledDrawable;
						break;
					case ImageOrientation.ImageOnTop:
						top = scaledDrawable;
						break;
					case ImageOrientation.ImageOnBottom:
						bottom = scaledDrawable;
						break;
					}

					targetButton.SetCompoundDrawables (left, top, right, bottom);
				}
			}
		}
Exemplo n.º 8
0
        private async void Daily_MovieClicked(object sender, EventArgs e)
        {
            Xamarin.Forms.ImageButton imageButton = (Xamarin.Forms.ImageButton)sender;


            //string TrailerUrl = imageButton.CommandParameter.ToString();
            int ID = int.Parse(string.Format("{0}", imageButton.CommandParameter));

            string TrailerUrl = "";

            if (ID == 1)
            {
                TrailerUrl = "https://www.youtube.com/watch?v=CZ0B22z22pI";
                var ans = await DisplayAlert("Mr. and Mrs. Smith" + Title, "Sıradan bir evlilik yaşayan John ve Jane Smith'in hayatları gün geçtikçe daha sıkıcı bir hal almaktadır. " +
                                             "Hayatlarındaki monotonluğu bozan tek şey; birbirlerine söyledikleri yalanlardır. Çift, aslında, birbirine rakip iki organizasyona tetikçi olarak çalışmaktadır."
                                             , "Watch the trailer", "Back");

                if (ans == true)
                {
                    Device.OpenUri(new System.Uri(TrailerUrl));
                }
                else
                {
                }
            }
            else if (ID == 2)
            {
                TrailerUrl = "https://www.youtube.com/watch?v=axGVrfwm9L4";
                var ans = await DisplayAlert("8 Mile" + Title, "Freestyle Rap Movie"
                                             , "Watch the trailer", "Back");

                if (ans == true)
                {
                    Device.OpenUri(new System.Uri(TrailerUrl));
                }
                else
                {
                }
            }
            else if (ID == 3)
            {
                TrailerUrl = "https://www.youtube.com/watch?v=I5kzcwcQA1Q";
                var ans = await DisplayAlert("Warrior", "Tom Hardy Movie", "Watch the trailer", "Back");

                if (ans == true)
                {
                    Device.OpenUri(new System.Uri(TrailerUrl));
                }
                else
                {
                }
            }
            else if (ID == 4)
            {
                TrailerUrl = "https://www.youtube.com/watch?v=-NTRVR7evUg";
                var ans = await DisplayAlert("Fast and Furious 8", "Faster and wilder! ", "Watch the trailer", "Back");

                if (ans == true)
                {
                    Device.OpenUri(new System.Uri(TrailerUrl));
                }
                else
                {
                }
            }
            else if (ID == 5)
            {
                TrailerUrl = "https://www.youtube.com/watch?v=2QKg5SZ_35I";
                var ans = await DisplayAlert("Jumanji", "a Dwayne Johnson Movie", "Watch the trailer", "Back");

                if (ans == true)
                {
                    Device.OpenUri(new System.Uri(TrailerUrl));
                }
                else
                {
                }
            }
        }
Exemplo n.º 9
0
        public Meals()
        {
            StackLayout stacklayout = new StackLayout();

            BackgroundColor = Constants.BackgroundColor;
            Padding         = new Thickness(60, 20, 60, 20);
            var description = new Label {
                Text = "Meal items come with fries and drink", TextColor = Color.Black
            };

            var Lbl_chicken = new Label {
                Text = "Chicken Sandwich Meal", TextColor = Color.Black
            };
            var p1 = new Label {
                Text = "Price: 12$"
            };
            var chicken = new Xamarin.Forms.ImageButton {
                Source = "chicken.jpg", BackgroundColor = Color.Transparent
            };
            var add1 = new Button {
                Text = "Add to cart"
            };

            var Lbl_ham = new Label {
                Text = "Ham Burger Meal", TextColor = Color.Black
            };
            var p2 = new Label {
                Text = "Price: 10$"
            };
            var ham = new Xamarin.Forms.ImageButton {
                Source = "ham.jpg", BackgroundColor = Color.Transparent
            };
            var add2 = new Button {
                Text = "Add to cart"
            };

            var Lbl_bacon = new Label {
                Text = "Bacon Cheeseburger Meal", TextColor = Color.Black
            };
            var p3 = new Label {
                Text = "Price: 15$"
            };
            var bacon = new Xamarin.Forms.ImageButton {
                Source = "bacon.jpg", BackgroundColor = Color.Transparent
            };
            var add3 = new Button {
                Text = "Add to cart"
            };

            var Lbl_wings = new Label {
                Text = "12 Pc Wings Meal", TextColor = Color.Black
            };
            var p4 = new Label {
                Text = "Price: 12$"
            };
            var wings = new Xamarin.Forms.ImageButton {
                Source = "wings.jpg", BackgroundColor = Color.Transparent
            };
            var add4 = new Button {
                Text = "Add to cart"
            };

            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { description, Lbl_chicken, p1, chicken, add1, Lbl_bacon, p2, bacon, add2, Lbl_ham, p3, ham, add3, Lbl_wings, p4, wings, add4 }
            };

            ScrollView scroll = new ScrollView
            {
                Content = Content
            };

            Content = scroll;

            add1.Clicked += (object s, EventArgs e) =>
            {
            };

            add2.Clicked += (object s, EventArgs e) =>
            {
            };

            add3.Clicked += (object s, EventArgs e) =>
            {
            };

            add4.Clicked += (object s, EventArgs e) =>
            {
            };
        }
Exemplo n.º 10
0
        public Drinks()
        {
            StackLayout stacklayout = new StackLayout();

            BackgroundColor = Constants.BackgroundColor;
            Padding         = new Thickness(60, 20, 60, 20);
            var lbl_coke = new Label {
                Text = "Coke", TextColor = Color.Black
            };
            var p1 = new Label {
                Text = "Price: 1.5$"
            };
            var coke = new Xamarin.Forms.ImageButton {
                Source = "coke.jpg", BackgroundColor = Color.Transparent
            };
            var add1 = new Button {
                Text = "Add to cart"
            };

            var lbl_sprite = new Label {
                Text = "Sprite", TextColor = Color.Black
            };
            var p2 = new Label {
                Text = "Price: 1.5$"
            };
            var sprite = new Xamarin.Forms.ImageButton {
                Source = "sprite.jpg", BackgroundColor = Color.Transparent
            };
            var add2 = new Button {
                Text = "Add to cart"
            };

            var lbl_fanta = new Label {
                Text = "Fanta", TextColor = Color.Black
            };
            var p3 = new Label {
                Text = "Price: 1.5$"
            };
            var fanta = new Xamarin.Forms.ImageButton {
                Source = "fanta.png", BackgroundColor = Color.Transparent
            };
            var add3 = new Button {
                Text = "Add to cart"
            };

            var lbl_lemon = new Label {
                Text = "Iced Tea", TextColor = Color.Black
            };
            var p4 = new Label {
                Text = "Price: 1.5$"
            };
            var lemon = new Xamarin.Forms.ImageButton {
                Source = "lemon.png", BackgroundColor = Color.Transparent
            };
            var add4 = new Button {
                Text = "Add to cart"
            };

            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { lbl_coke, p1, coke, add1, lbl_sprite, p2, sprite, add2, lbl_fanta, p3, fanta, add3, lbl_lemon, p4, lemon, add4 }
            };

            ScrollView scroll = new ScrollView
            {
                Content = Content
            };

            Content = scroll;

            add1.Clicked += (object s, EventArgs e) =>
            {
            };

            add2.Clicked += (object s, EventArgs e) =>
            {
            };

            add3.Clicked += (object s, EventArgs e) =>
            {
            };

            add4.Clicked += (object s, EventArgs e) =>
            {
            };
        }
        public ImageButtonHandler(NativeComponentRenderer renderer, XF.ImageButton imageButtonControl) : base(renderer, imageButtonControl)
        {
            ImageButtonControl = imageButtonControl ?? throw new ArgumentNullException(nameof(imageButtonControl));

            Initialize(renderer);
        }
Exemplo n.º 12
0
        public Menu()
        {
            StackLayout stacklayout = new StackLayout();

            BackgroundColor = Constants.BackgroundColor;
            Padding         = new Thickness(60, 20, 60, 20);
            var Lbl_meals = new Label {
                Text = "Meals"
            };
            var meals = new Xamarin.Forms.ImageButton {
                Source = "meal.jpg", BackgroundColor = Color.Transparent
            };

            var Lbl_drinks = new Label {
                Text = "Drinks"
            };
            var drinks = new Xamarin.Forms.ImageButton {
                Source = "drinkss.jpg", BackgroundColor = Color.Transparent
            };

            var Lbl_sides = new Label {
                Text = "Sides"
            };
            var sides = new Xamarin.Forms.ImageButton {
                Source = "side.jpg", BackgroundColor = Color.Transparent
            };

            var Lbl_specials = new Label {
                Text = "Specials"
            };
            var specials = new Xamarin.Forms.ImageButton {
                Source = "specials.jpg", BackgroundColor = Color.Transparent
            };

            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          = { Lbl_meals, meals, Lbl_sides, sides, Lbl_drinks, drinks, Lbl_specials, specials }
            };

            ScrollView scroll = new ScrollView
            {
                Content = Content
            };

            Content = scroll;

            meals.Clicked += (object s, EventArgs e) =>
            {
                Navigation.PushAsync(new Meals());
            };

            drinks.Clicked += (object s, EventArgs e) =>
            {
                Navigation.PushAsync(new Drinks());
            };
            sides.Clicked += (object s, EventArgs e) =>
            {
                Navigation.PushAsync(new Sides());
            };
        }