private void UpdateInfo(string hexCode, bool isRefresh) { RenderActivity(); commentRequests.GetCommentsByLand(selectedLand.Id); }
private void UpdateInfo(string hexCode, bool isRefresh) { if (selectedLand == null || !selectedLand.GeohexKey.Equals(hexCode) || isRefresh) { if (Current.Instance.EarthwatcherLand != null && Current.Instance.EarthwatcherLand.GeohexKey.Equals(hexCode)) { selectedLand = Current.Instance.EarthwatcherLand; selectedEarthwatcher = Current.Instance.Earthwatcher; txtName.Text = selectedEarthwatcher.FullName; txtCountry.Text = selectedEarthwatcher.Country; //this.reportIcon.Source this.reportText.Text = "REPORTAR"; this.ActionButton.Visibility = System.Windows.Visibility.Visible; this.reportIcon.Source = ResourceHelper.GetBitmap("/Resources/Images/reportar.png"); } else { foreach (var land in Current.Instance.LandInView) { if (land.GeohexKey.Equals(hexCode)) { selectedLand = land; } } if (selectedLand == null) { return; } if (selectedLand.LandStatus == LandStatus.Alert) { this.ActionButton.Visibility = System.Windows.Visibility.Visible; this.reportText.Text = "REVISAR"; this.reportIcon.Source = ResourceHelper.GetBitmap("/Resources/Images/revisar.png"); } else { this.ActionButton.Visibility = System.Windows.Visibility.Collapsed; } earthwatcherRequest.GetById(selectedLand.EarthwatcherId.ToString()); } commentRequests.GetCommentsByLand(selectedLand.Id); } /* * //A new zone is clicked request data * if (selectedLand == null || !selectedLand.GeohexKey.Equals(hexCode) || isRefresh) * { * ClearInfo(); * * //If the zone is the zone of the logged in user);); * if (Current.Instance.EarthwatcherLand != null && * Current.Instance.EarthwatcherLand.GeohexKey.Equals(hexCode)) * { * unassignedGrid.Visibility = Visibility.Collapsed; * confirmation.Visibility = Visibility.Collapsed; * statusChanger.Visibility = Visibility.Visible; * * selectedLand = Current.Instance.EarthwatcherLand; * selectedEarthwatcher = Current.Instance.Earthwatcher; * * commentRequests.GetCommentsByLand(selectedLand.Id); * * var selectedIndex = 0; * if (((int) selectedLand.LandStatus) - 2 > -1) //-2 cause first 2 can not be set by user * selectedIndex = (int) selectedLand.LandStatus - 2; * * cbSetStatus.SelectedIndex = selectedIndex; * txtStatus.Text = selectedLand.LandStatus.ToString(); * * txtName.Text = selectedEarthwatcher.FullName; * txtCountry.Text = selectedEarthwatcher.Country; * } * else * { * foreach (var land in Current.Instance.LandInView) * { * if (land.GeohexKey.Equals(hexCode)) * selectedLand = land; * } * * if (selectedLand == null) * return; * * //If there is no user attached to the land * if (selectedLand.LandStatus == LandStatus.Unwatched || * selectedLand.LandStatus == LandStatus.Unassigned) * { * unassignedGrid.Visibility = Visibility.Visible; * } * else * { * unassignedGrid.Visibility = Visibility.Collapsed; * statusChanger.Visibility = Visibility.Collapsed; * * if (selectedLand.LandStatus == LandStatus.Alert && Current.Instance.Earthwatcher != null) * confirmation.Visibility = Visibility.Visible; * if (selectedLand.LandStatus != LandStatus.Alert || Current.Instance.Earthwatcher == null) * confirmation.Visibility = Visibility.Collapsed; * * commentRequests.GetCommentsByLand(selectedLand.Id); * earthwatcherRequest.GetById(selectedLand.EarthwatcherId.ToString()); * } * } * * if (selectedLand.LandStatus == LandStatus.Alert)//if alerted show confirmers deconfirmers * { * txtConfirmed.Visibility = Visibility.Visible; * txtDeconfirmed.Visibility = Visibility.Visible; * * var countConfirm = selectedLand.DeforestationConfirmers.Split(','); * var countDeconfirm = selectedLand.DeforestationDeconfirmers.Split(','); * * if (countConfirm[0].Equals("")) * countConfirm = new string[0]; * if (countDeconfirm[0].Equals("")) * countDeconfirm = new string[0]; * * txtConfirmed.Text = "Confirmed: " + countConfirm.Length; * txtDeconfirmed.Text = "Deconfirmed: " + countDeconfirm.Length; * } * } * */ }