예제 #1
0
        void TagSelected(object sender, SelectedItemChangedEventArgs e)
        {
            TagToReview tag = (TagToReview)e.SelectedItem;

            ReviewTagForm form = new ReviewTagForm();

            form.SetTag(tag);

            Navigation.PushModalAsync(form);
        }
예제 #2
0
        public void SetTag(TagToReview _tag)
        {
            m_Tag = _tag;

            m_User.Text            = string.Format("User: {0}", _tag.Username);
            m_Hydrants.ItemsSource = _tag.NearbyHydrants;
            m_Image.Source         = ImageSource.FromUri(new System.Uri(m_Tag.ImageUrl));

            if (m_Tag.Position != null)
            {
                var pos  = new Position(m_Tag.Position.Latitude, m_Tag.Position.Longitude);
                var span = MapSpan.FromCenterAndRadius(pos, Distance.FromMiles(.1));
                m_Map.MoveToRegion(span);
            }
        }
예제 #3
0
        private BaseResponse HandleGetTagsToReview(DynamicDictionary _parameters)
        {
            User user;

            if (AuthHelper.IsAuthorized(Request, out user))
            {
                if (user.UserType == UserTypes.SuperUser ||
                    user.UserType == UserTypes.Administrator)
                {
                    HydrantWikiManager hwm  = new HydrantWikiManager();
                    List <Tag>         tags = hwm.GetPendingTags();

                    List <TagToReview> tagsToReview = new List <TagToReview>();

                    foreach (var tag in tags)
                    {
                        TagToReview reviewTag = new TagToReview();
                        reviewTag.TagId     = tag.Guid;
                        reviewTag.ImageGuid = tag.ImageGuid;

                        TGUser tagUser = hwm.GetUser(tag.UserGuid);
                        if (tagUser != null)
                        {
                            reviewTag.Username = tagUser.Username;

                            UserStats stats = hwm.GetUserStats(tagUser.Guid);
                            reviewTag.UserTagsApproved = stats.ApprovedTagCount;
                            reviewTag.UserTagsRejected = stats.RejectedTagCount;
                        }

                        if (tag.ImageGuid != null)
                        {
                            reviewTag.ThumbnailUrl = tag.GetUrl(true);
                            reviewTag.ImageUrl     = tag.GetUrl(false);
                        }

                        if (tag.Position != null)
                        {
                            reviewTag.Position = new Position()
                            {
                                Latitude  = tag.Position.Y,
                                Longitude = tag.Position.X
                            };

                            List <Hydrant> nearby = hwm.GetHydrants(
                                reviewTag.Position.Latitude,
                                reviewTag.Position.Longitude,
                                200);

                            reviewTag.NearbyHydrants = ProcessHydrants(nearby, tag.Position);
                        }

                        tagsToReview.Add(reviewTag);
                    }

                    hwm.LogInfo(user.Guid, string.Format("Retrieved Tags to Review ({0})", tagsToReview.Count));

                    return(new TagsToReviewResponse()
                    {
                        Success = true,
                        Tags = tagsToReview
                    });
                }
                else
                {
                    return(new BaseResponse {
                        Error = "User not allowed to review tags",
                        Success = false
                    });
                }
            }
            else
            {
                LogUnauthorized(Request);
                return(new BaseResponse
                {
                    Error = "Not authenticated",
                    Success = false
                });
            }
        }