Ejemplo n.º 1
0
        public HexagonInfo()
        {
            InitializeComponent();
            earthwatcherRequest = new EarthwatcherRequests(Constants.BaseApiUrl);
            commentRequests = new CommentRequests(Constants.BaseApiUrl);
            landRequests = new LandRequests(Constants.BaseApiUrl);
            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);

            //Add event listeners
            commentRequests.CommentsByLandReceived += CommentRequestCommentsByLandReceived;
            earthwatcherRequest.EarthwatcherReceived += EarthwatcherChanged;
            Current.Instance.MapControl.zoomFinished += MapControlZoomFinished;
            Current.Instance.MapControl.zoomStarted += MapControlZoomStarted;

            HtmlPage.RegisterScriptableObject("HexagonInfo", this);
        }
Ejemplo n.º 2
0
        public ReportWindow(Land land, Earthwatcher earthwatcher)
        {
            InitializeComponent();

            selectedLand = land;

            string[] confirms = null;
            string[] deconfirms = null;

            if (!string.IsNullOrEmpty(selectedLand.DeforestationConfirmers))
            {
                confirms = selectedLand.DeforestationConfirmers.Split(',');
            }

            if (!string.IsNullOrEmpty(selectedLand.DeforestationDeconfirmers))
            {
                deconfirms = selectedLand.DeforestationDeconfirmers.Split(',');
            }

            if (Current.Instance.Earthwatcher.LandId.HasValue && Current.Instance.Earthwatcher.LandId == selectedLand.Id)
            {
                this.ReportGrid.Visibility = System.Windows.Visibility.Visible;
                this.ConfirmGrid.Visibility = System.Windows.Visibility.Collapsed;

                if (land.LandStatus == LandStatus.Alert)
                {
                    this.AlertButton.BorderThickness = new Thickness(4);
                    this.AlertButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));
                }

                if (land.LandStatus == LandStatus.Ok)
                {
                    this.OkButton.BorderThickness = new Thickness(4);
                    this.OkButton.Background = new SolidColorBrush(Color.FromArgb(255, 241, 251, 187));
                }
            }
            else
            {
                this.Title.Text = "VALIDAR PARCELA EN ALERTA";
                this.ReportButton.Content = "VALIDAR";

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

                if (confirms != null && confirms.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 (deconfirms != null && deconfirms.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;
                }
            }

            //asocia esto a algún mensaje que muestre confirmación / deconfirmación
            if (land.LandStatus == LandStatus.Alert)
            {
                int countConfirm = 0;
                int countDeconfirm = 0;

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

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

                this.countConfirm1.Text = string.Format("{0} confirmaciones", countConfirm);
                this.countConfirm2.Text = string.Format("{0} confirmaciones", countConfirm);
                this.countDeConfirm1.Text = string.Format("{0} nada sospechoso", countDeconfirm);
                this.countDeConfirm2.Text = string.Format("{0} nada sospechoso", countDeconfirm);
            }
            else
            {
                this.countConfirm1.Visibility = System.Windows.Visibility.Collapsed;
                this.countConfirm2.Visibility = System.Windows.Visibility.Collapsed;
                this.countDeConfirm1.Visibility = System.Windows.Visibility.Collapsed;
                this.countDeConfirm2.Visibility = System.Windows.Visibility.Collapsed;
            }

            selectedEarthwatcher = earthwatcher;
            landRequests = new LandRequests(Constants.BaseApiUrl);
            hexagonLayer = (HexagonLayer)Current.Instance.LayerHelper.FindLayer(Constants.Hexagonlayername);

            this.Loaded += ReportWindow_Loaded;
        }
Ejemplo n.º 3
0
 private static void LoadHexagon(LayerHelper layerHelper)
 {
     var layer = new HexagonLayer(Constants.Hexagonlayername) {Enabled = true};
     layerHelper.AddLayer(layer);
 }