public DemandWindow(Land land, Earthwatcher earthwatcher)
        {
            InitializeComponent();

            selectedLand = land;
            selectedEarthwatcher = earthwatcher;
            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);
            
            if (Current.Instance.Scores.Any(x => x.Action.Equals(ActionPoints.Action.DemandAuthorities.ToString()) && (x.LandId == selectedLand.Id)))
            {
                this.DemandIcon.Source = Earthwatchers.UI.Resources.ResourceHelper.GetBitmap("/Resources/Images/demandarShare.png");
                this.Title.Text = Labels.DemandWindow2;
                this.DemandText.Text = Labels.DemandWindow3;
                this.DemandText2.Text = Labels.DemandWindow4;
                this.DemandTitleText.Text = Labels.DemandWindow2;
            }
            else
            {
                this.DemandIcon.Source = Earthwatchers.UI.Resources.ResourceHelper.GetBitmap("/Resources/Images/demandar.png");
                this.Title.Text = Labels.DemandWindow1;
                this.DemandText.Text = Labels.DemandWindow5;
                this.DemandText2.Text = Labels.DemandWindow6;
                this.DemandTitleText.Text = Labels.DemandWindow1;
            }


        }
        public ReportWindow(Land land, Earthwatcher earthwatcher)
        {
            InitializeComponent();

            commentRequests = new CommentRequests(Constants.BaseApiUrl);
            collectionRequests = new CollectionRequests(Constants.BaseApiUrl);
            landRequests = new LandRequests(Constants.BaseApiUrl);
            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);
            bcLayer = (BasecampLayer)Current.Instance.LayerHelper.FindLayer(Constants.BasecampsLayer); //TEST
            //Add event listeners
            commentRequests.CommentsByLandReceived += CommentRequestCommentsByLandReceived;
            collectionRequests.NewItemReceived += collectionRequests_NewItemReceived;
            collectionRequests.ItemsCountReceived += collectionRequests_ItemsCountReceived;
            collectionRequests.GetTotalItems(Current.Instance.Earthwatcher.Id);
            Current.Instance.MapControl.zoomFinished += MapControlZoomFinished;
            Current.Instance.MapControl.zoomStarted += MapControlZoomStarted;

            landRequests = new LandRequests(Constants.BaseApiUrl);
            landRequests.StatusChanged += SetLandStatusStatusChanged;
            landRequests.ConfirmationAdded += landRequests_ConfirmationAdded;

            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);

            this.Loaded += ReportWindow_Loaded;

            this.ShareStoryBoard.Completed += ShareStoryBoard_Completed;
        }
Example #3
0
        private static void LoadHexagon(LayerHelper layerHelper)
        {
            var layer = new HexagonLayer(Constants.Hexagonlayername)
            {
                Enabled = true
            };

            layerHelper.AddLayer(layer);
        }
        public HexagonInfo()
        {
            InitializeComponent();

            commentRequests = new CommentRequests(Constants.BaseApiUrl);
            collectionRequests = new CollectionRequests(Constants.BaseApiUrl);
            landRequests = new LandRequests(Constants.BaseApiUrl);
            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);
            bcLayer  = (BasecampLayer)Current.Instance.LayerHelper.FindLayer(Constants.BasecampsLayer); //TEST
            //Add event listeners
            commentRequests.CommentsByLandReceived += CommentRequestCommentsByLandReceived;
            collectionRequests.NewItemReceived += collectionRequests_NewItemReceived;
            collectionRequests.ItemsCountReceived += collectionRequests_ItemsCountReceived;
            Current.Instance.MapControl.zoomFinished += MapControlZoomFinished;
            Current.Instance.MapControl.zoomStarted += MapControlZoomStarted;

            HtmlPage.RegisterScriptableObject("HexagonInfo", this);
            collectionRequests.GetTotalItems(Current.Instance.Earthwatcher.Id);
        }
 private static void LoadHexagon(LayerHelper layerHelper)
 {
     var layer = new HexagonLayer(Constants.Hexagonlayername) {Enabled = true};
     layerHelper.AddLayer(layer);
 }
        public ReportWindow(Land land, Earthwatcher earthwatcher)
        {
            InitializeComponent();

            this.ShareStoryBoard.Completed += ShareStoryBoard_Completed;

            selectedLand = land;

            string[] oks = null;
            string[] alerts = null;
            char[] charsep = new char[] { ',' };

            if (!string.IsNullOrEmpty(selectedLand.OKs))
            {
                oks = selectedLand.OKs.Split(charsep, StringSplitOptions.RemoveEmptyEntries);
            }

            if (!string.IsNullOrEmpty(selectedLand.Alerts))
            {
                alerts = selectedLand.Alerts.Split(charsep, StringSplitOptions.RemoveEmptyEntries);
            }

            if (Current.Instance.Earthwatcher.Lands.Any(x => x.Id == selectedLand.Id))
            {
                //NO SELECCIONAR LA MANITO OK o ALERT SEGUN EL STATUS, SINO LO QUE EL USER REPORTO
                this.ReportGrid.Visibility = System.Windows.Visibility.Visible;
                this.ConfirmGrid.Visibility = System.Windows.Visibility.Collapsed;

                //if (land.LandStatus == LandStatus.Alert)
                if (alerts != null && alerts.Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString())))
                {
                    this.AlertButton.BorderThickness = new Thickness(4);
                    this.AlertButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));
                }

                //if (land.LandStatus == LandStatus.Ok)
                else if (oks != null && oks.Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString())))
                {
                    this.OkButton.BorderThickness = new Thickness(4);
                    this.OkButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));
                }
            }
            else
            {
                this.Title.Text = Labels.Report5;
                this.ReportButton.Content = Labels.Report11;

                this.ReportGrid.Visibility = System.Windows.Visibility.Collapsed;
                this.ConfirmGrid.Visibility = System.Windows.Visibility.Visible;

                if (oks != null && oks.Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString())))
                {
                    this.ConfirmButton.BorderThickness = new Thickness(4);
                    this.ConfirmButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));

                    this.ConfirmButton.IsHitTestVisible = false;
                    this.ConfirmButton.Cursor = Cursors.Arrow;
                }

                if (alerts != null && alerts.Any(x => x.Equals(Current.Instance.Earthwatcher.Id.ToString())))
                {
                    this.DeconfirmButton.BorderThickness = new Thickness(4);
                    this.DeconfirmButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));

                    this.DeconfirmButton.IsHitTestVisible = false;
                    this.DeconfirmButton.Cursor = Cursors.Arrow;
                }
            }

            int countConfirm = 0;
            int countDeconfirm = 0;

            if (oks != null)
            {
                countConfirm = oks.Length;
            }

            if (alerts != null)
            {
                countDeconfirm = alerts.Length;
            }

            //asocia esto a algún mensaje que muestre confirmación / deconfirmación
            this.countConfirm1.Text = string.Format("{0} {1}", countConfirm + countDeconfirm, Labels.Report12);
            this.countConfirm2.Text = string.Format("{0} {1}", countConfirm + countDeconfirm, Labels.Report12);

            //Limite de 30 verificaciones
            if (selectedLand.IsLocked || selectedLand.DemandAuthorities)
            {
                DisableActions();
            }
/*
            if (land.DemandAuthorities)
            {
                this.shareText.Text = Labels.Share5;
            }
 * */

            selectedEarthwatcher = earthwatcher;
            if (earthwatcher.IsPowerUser)
            {
                this.badgeIcon.Source = Earthwatchers.UI.Resources.ResourceHelper.GetBitmap("/Resources/Images/badgej.png");
                ToolTipService.SetToolTip(this.badgeIcon, "Jaguar");
            }

            if (Current.Instance.Scores.Count(x => x.Action == ActionPoints.Action.FoundTheJaguar.ToString()) != 0)
            {
                JaguarBadge.Visibility = Visibility.Visible;
            }
            if (Current.Instance.Scores.Any(x => x.Action.StartsWith(ActionPoints.Action.ContestWon.ToString())))
            {
                this.ContestWinnerBadge.Visibility = Visibility.Visible;
            }
            landRequests = new LandRequests(Constants.BaseApiUrl);
            landRequests.StatusChanged += SetLandStatusStatusChanged;
            landRequests.ConfirmationAdded += landRequests_ConfirmationAdded;

            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);

            this.Loaded += ReportWindow_Loaded;
        }