public void GetImage(NatureArea na) { foreach (var item in na.Abundant) { abundantData.Add( new BindingImage { ImagePath = $"ms-appx:///Assets/GameResources/{item}.png" }); } foreach (var item in na.Occasional) { occasionalData.Add( new BindingImage { ImagePath = $"ms-appx:///Assets/GameResources/{item}.png" }); } foreach (var item in na.Rare) { rareData.Add( new BindingImage { ImagePath = $"ms-appx:///Assets/GameResources/{item}.png" }); } }
private async void AreaGridView_ItemClick(object sender, ItemClickEventArgs e) { NatureArea na = e.ClickedItem as NatureArea; var contentDialog = new ContentDialog() { Content = new NatureAreaDialog(na), PrimaryButtonText = "确定", FullSizeDesired = false }; contentDialog.Style = transparent; contentDialog.Closed += async(_s, _e) => { await NatureGrid.Blur(value : 0, duration : 0, delay : 0).StartAsync(); contentDialog.Hide(); }; contentDialog.PrimaryButtonClick += async(_s, _e) => { await NatureGrid.Blur(value : 0, duration : 0, delay : 0).StartAsync(); contentDialog.Hide(); }; await NatureGrid.Blur(value : 7, duration : 100, delay : 0).StartAsync(); await contentDialog.ShowAsync(); }
private static Collection <NatureArea> GenerateNatureAreasFromShapeFile(string shapeFilePath, int epsgCode, string knr, int startFeature, int featureCount) { var natureAreas = new Collection <NatureArea>(); shapeFilePath = FileLocator.FindFileInTree(shapeFilePath); Shapefile shapeFile = Shapefile.OpenFile(shapeFilePath); var endFeature = startFeature + featureCount < shapeFile.Features.Count ? startFeature + featureCount : shapeFile.Features.Count; for (var number = startFeature; number < endFeature; number++) { var feature = shapeFile.Features[number]; var area = new NatureArea { UniqueId = new Identification() }; var numberString = number.ToString(); var guid = "00000000-0000-0000-" + knr + "-"; for (int i = 0; i < 12 - numberString.Length; ++i) { guid += "0"; } area.UniqueId.LocalId = new Guid(guid + numberString); area.UniqueId.NameSpace = "NBIC"; area.UniqueId.VersionId = "1.0"; area.Version = "1"; area.Nivå = Types.NatureLevel.Natursystem; area.Area = SqlGeometry.STGeomFromText(new SqlChars(feature.BasicGeometry.ToString()), epsgCode); var natureAreaType = new NatureAreaType(); const int rowOffset = 0; // 1 for melhus natureAreaType.Code = (string)feature.DataRow[rowOffset + 4]; natureAreaType.Share = 1; if (feature.DataRow[rowOffset + 3] != DBNull.Value) { var descriptionVariable = new DescriptionVariable(); var descriptionVariableParts = ((string)feature.DataRow[rowOffset + 3]).Split('_'); descriptionVariable.Code = descriptionVariableParts[0]; descriptionVariable.Value = descriptionVariableParts[1]; natureAreaType.AdditionalVariables.Add(descriptionVariable); } area.Parameters.Add(natureAreaType); area.Surveyed = DateTime.Parse(feature.DataRow[rowOffset + 5].ToString()); area.Surveyer = new Contact { Company = (string)feature.DataRow[rowOffset + 8] }; natureAreas.Add(area); } return(natureAreas); }
public NatureAreaDialog(NatureArea na) { this.InitializeComponent(); GetImage(na); AreaImage.Source = new BitmapImage(new Uri(na.Picture)); AreaName.Text = na.Name; AreaEnName.Text = na.EnName; ROG.IsChecked = na.IsROG; SW.IsChecked = na.IsSW; DST.IsChecked = na.IsDST; AreaIntroduction.Text = na.Introduction; }
public void Add(NatureAreaType natureAreaType, NatureArea natureArea) { if (!ContainsKey(natureAreaType.Code)) { this[natureAreaType.Code] = new HashSet <int> { natureArea.Id } } ; else { this[natureAreaType.Code].Add(natureArea.Id); } }
public void ConvertToGmlTest() { var natureArea = new NatureArea { UniqueId = new Identification { LocalId = Guid.NewGuid(), NameSpace = "NiN", VersionId = "2.0" } }; var natureAreas = new Collection <NatureArea> { natureArea }; gmlWriter.ConvertToGml(natureAreas); }
private NinXElement Naturområde(NatureArea n) { return(new NinXElement("naturOmraader", "", new NinXElement("NaturOmraade", "", new XAttribute((XNamespace)Config.Settings.Namespace.Gml + "id", "NATUREAREA_" + n.UniqueId.LocalId), IdentificationElement("unikId", n.UniqueId), new NinXElement("versjon", "n.Version", n.Version), NatureLevelElement("nivaa", n.Nivå), AreaElement("omraade", n.Area, n.UniqueId.LocalId), ContactElement("kartlegger", n.Surveyer), new NinXElement("kartlagtDato", "n.Surveyed", n.Surveyed), new NinXElement("beskrivelse", "n.Description", n.Description), DocumentElements(n.Documents), AddParameterElements(n.Parameters) ) )); }