コード例 #1
0
        /// <summary>
        /// A Frame that contains a grid layout, with the last column being
        /// a stack layout with any number of speaker views.
        /// </summary>
        /// <param name="anEvent">Event object to be rendered on event page</param>
        public EventView(Event anEvent)
        {
            InitializeComponent();
            Label eventTopic = this.FindByName <Label>("Topic");
            Label eventDesc  = this.FindByName <Label>("Description");
            Label eventDate  = this.FindByName <Label>("Date");
            Image eventImage = this.FindByName <Image>("Image");

            eventTopic.FontSize       = 16;
            eventTopic.FontAttributes = FontAttributes.Bold;
            eventDate.Text            = EventAdapter.ConvertDate(anEvent.EventDate); // Jacksons code <<<<
            eventTopic.Text          += anEvent.EventTopic;
            eventDesc.Text            = anEvent.EventDescription;

            CultureInfo provider = CultureInfo.InvariantCulture;

            // This is the action that is executed when the event image is clicked.
            eventImage.GestureRecognizers.Add(new TapGestureRecognizer
            {
                Command = new Command(() =>
                {
                    try
                    {
                        Device.OpenUri(new Uri(anEvent.EventSignUpUrl));
                    }
                    catch (FormatException res)
                    {
                    }
                })
            });

            //Set image to the event image, if there is an error (no image, or malformed uri)
            //Set a default image.
            try
            {
                eventImage.Source = new Uri(anEvent.EventImg);
            }
            catch (FormatException res)
            {
                eventImage.Source = ImageSource.FromFile(("noimage.png"));
            }

            //Only show speakers label if there are any speaker for this event
            if (anEvent.EventSpeakers.Length > 0)
            {
                this.FindByName <Label>("Speaker").Text = "Speakers";
            }

            //For every speaker create a speaker form them under this event
            foreach (Speaker speaker in anEvent.EventSpeakers)
            {
                this.FindByName <StackLayout>("Layout").Children.Add(new SpeakerView(speaker));
            }
        }
コード例 #2
0
        public void WhiteBoxTest_EventAdapter_ConvertDate()
        {
            string Test = EventAdapter.ConvertDate("2017-03-24");

            Assert.IsTrue(Test == "March 24, 2017");
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: karasutphin/theCircuitLive
 public void testThing()
 {
     Assert.Pass(EventAdapter.ConvertDate("09 08 2015"));
 }