Esempio n. 1
0
        public EventSpecificPage(EventItem item)
        {
            //get AllEvents index
            for (int i = 0; i < app.AllEvents_collection.Count; i++)
            {
                if (string.Equals(item.Name, app.AllEvents_collection[i].Name) == true)
                {
                    app.all_index = i;
                }
            }

            //get myEvents index and set AllEvents isFav
            for (int i = 0; i < app.MyEvents_collection.Count; i++)
            {
                if (string.Equals(item.Name, app.MyEvents_collection[i].Name) == true)
                {
                    my_index = i;
                    app.AllEvents_collection[app.all_index].IsFavorited = true;
                    break;
                }
                else
                {
                    app.AllEvents_collection[app.all_index].IsFavorited = false;
                }
            }


            event_label = new Label
            {
                Text                    = item.Name,
                FontAttributes          = FontAttributes.Bold,
                TextColor               = Color.Maroon,
                FontSize                = 20,
                HorizontalTextAlignment = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.Center,
            };

            Uri uri = new Uri(item.Source);

            event_image1 = new Image
            {
                WidthRequest  = 50,
                HeightRequest = 70,
                Source        = uri
            };

            event_image2 = new Image
            {
                WidthRequest  = 50,
                HeightRequest = 70,
                Source        = uri
            };


            desc = new Label
            {
                Text = "Date: " + item.Date.ToString("d") + "\nTime: " + item.Time + "\nLocation: " + item.Location + "\n\n" + item.Info,
                HorizontalTextAlignment = TextAlignment.Center,
                //FontFamily = Device.OnPlatform("Eczar-Regular", "null", "null")
                FontAttributes = FontAttributes.Italic,
                TextColor      = Color.Maroon
            };

            add_to_events = new Button
            {
                Text            = "Add to MyEvents",
                BorderWidth     = 1,
                BorderColor     = Color.Maroon,
                HeightRequest   = 50,
                WidthRequest    = 160,
                TextColor       = Color.Maroon,
                VerticalOptions = LayoutOptions.End
            };

            remove_button = new Button
            {
                Text            = "Remove from MyEvents",
                BorderWidth     = 1,
                BorderColor     = Color.Maroon,
                HeightRequest   = 50,
                WidthRequest    = 160,
                TextColor       = Color.Maroon,
                VerticalOptions = LayoutOptions.End,
            };

            logo = new Image
            {
                Source        = ImageSource.FromResource("SCUEvents.SCU_Events_logo.jpg"),
                WidthRequest  = 300,
                HeightRequest = 50
            };

            add_to_events.Clicked += buttonClicked;
            remove_button.Clicked += buttonClicked;

            //set add/remove button
            setAddRemove();

            Content = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    logo,


                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        Padding           = 20,
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Spacing           = 20,
                        Children          =
                        {
                            event_image1,
                            event_label,
                            event_image2
                        }
                    },

                    new Frame
                    {
                        OutlineColor = Color.Maroon,
                        HasShadow    = false,
                        Content      = desc
                    },

                    new StackLayout
                    {
                        VerticalOptions = LayoutOptions.End,
                        Children        =
                        {
                            add_to_events,
                            remove_button,
                        }
                    }
                }
            };
        }
Esempio n. 2
0
 public void RemoveItem(EventItem item)
 {
     app.MyEvents_collection.Remove(this);
     app.AllEvents_collection[app.all_index].IsFavorited = false;
 }
Esempio n. 3
0
 void notify_function(EventItem item)
 {
     DisplayAlert("Don't Forget", item.Name +
                  " " + item.Time, "OK");
 }