Example #1
0
        public async void getEvent()
        {
            _Event = await Client.GetEventFromIdAsync(CurrentEvent);
            organizer = _Event.username;

            EventDetail.CardTitle = _Event.title;
            BeginTime.CardTitle = "Begin: " + _Event.beginTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");
            EndTime.CardTitle = "End: " + _Event.endTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");

            // Add organizer's name
            Run r = new Run();
            r.Text = _Event.username; // get the name instead of the username
            OrganizerName.Inlines.Add(r);

            // Display thumbnail
            if (!string.IsNullOrEmpty(_Event.thumbnail))
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(_Event.thumbnail);
                BitmapImage bmp = new BitmapImage();
                await bmp.SetSourceAsync(await file.OpenReadAsync());
                EventThumbnail.Source = bmp;
            }

            // Set descripiton
            EventDescription.Document.SetText(TextSetOptions.FormatRtf, _Event.description);

            // Set number of tickets left
            ticketLeft.Text = _Event.ticket + " left";
            if (_Event.ticket == 0)
            {
                ticketType.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketLeft.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketRegister.IsEnabled = false;
            }

            // Set location
            var location = await Client.GetLocationFromIdAsync(_Event.location);
            EventLocation.CardTitle = location.address;
            EventMap.Center = new Geopoint(new BasicGeoposition()
            {
                Latitude = location.latitude,
                Longitude = location.longitude
            });
            EventMap.ZoomLevel = 15;

            MapIcon icon = new MapIcon();
            icon.Location = EventMap.Center;
            icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
            EventMap.MapElements.Add(icon);
        }
Example #2
0
        public async void getEvent()
        {
            _Event = await Client.GetEventFromIdAsync(CurrentEvent);

            organizer = _Event.username;

            EventDetail.CardTitle = _Event.title;
            BeginTime.CardTitle   = "Begin: " + _Event.beginTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");
            EndTime.CardTitle     = "End: " + _Event.endTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");

            // Add organizer's name
            Run r = new Run();

            r.Text = _Event.username; // get the name instead of the username
            OrganizerName.Inlines.Add(r);

            // Display thumbnail
            if (!string.IsNullOrEmpty(_Event.thumbnail))
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(_Event.thumbnail);

                BitmapImage bmp = new BitmapImage();
                await bmp.SetSourceAsync(await file.OpenReadAsync());

                //    EventThumbnail.Source = bmp;
            }

            // Set descripiton
            EventDescription.Document.SetText(TextSetOptions.FormatRtf, _Event.description);

            // Set number of tickets left
            ticketLeft.Text = (_Event.ticket - await Client.GetNumberOfRemainingTicketAsync(_Event.id)) + " left";
            bool isRegistered = await Client.IsRegisteredAsync(DatabaseHelper.CurrentUser, _Event.id);

            if (_Event.ticket == 0 || DatabaseHelper.CurrentUser == _Event.username || isRegistered)
            {
                ticketType.Foreground    = new SolidColorBrush(Colors.LightGray);
                ticketLeft.Foreground    = new SolidColorBrush(Colors.LightGray);
                ticketRegister.IsEnabled = false;
            }

            // Convert from paths to bitmaps
            await ConvertToBitmap();

            FlipviewEvent.ItemsSource = fileImages;

            // Set location
            var location = await Client.GetLocationFromIdAsync(_Event.location);

            EventLocation.CardTitle = location.address;
            EventMap.Center         = new Geopoint(new BasicGeoposition()
            {
                Latitude  = location.latitude,
                Longitude = location.longitude
            });
            EventMap.ZoomLevel = 15;

            MapIcon icon = new MapIcon();

            icon.Location = EventMap.Center;
            icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
            EventMap.MapElements.Add(icon);
        }