//creates a popup with a text //creates the splash window private Border createSplashWindow(string text) { Border brdSplasInner = new Border(); brdSplasInner.BorderBrush = Brushes.Black; brdSplasInner.BorderThickness = new Thickness(2, 2, 0, 0); Border brdSplashOuter = new Border(); brdSplashOuter.BorderBrush = Brushes.White; brdSplashOuter.BorderThickness = new Thickness(0, 0, 2, 2); brdSplasInner.Child = brdSplashOuter; TextBlock txtSplash = UICreator.CreateTextBlock(text); txtSplash.Width = 200; txtSplash.Height = 100; txtSplash.TextAlignment = TextAlignment.Center; txtSplash.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush2"); txtSplash.FontWeight = FontWeights.Bold; brdSplashOuter.Child = txtSplash; return(brdSplasInner); }
//creates the a town panel public static WrapPanel CreateTownPanel(Town town) { WrapPanel townPanel = new WrapPanel(); if (town.State != null) { TextBlock txtTown = UICreator.CreateTextBlock(string.Format("{0}, {1}", town.Name, town.State.ShortName)); txtTown.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; townPanel.Children.Add(txtTown); if (town.State.Flag != null) { Image imgFlag = new Image(); imgFlag.Source = new BitmapImage(new Uri(town.State.Flag, UriKind.RelativeOrAbsolute)); imgFlag.Height = 24; RenderOptions.SetBitmapScalingMode(imgFlag, BitmapScalingMode.HighQuality); imgFlag.Margin = new Thickness(5, 0, 0, 0); townPanel.Children.Add(imgFlag); } } else if (town.Country is TerritoryCountry && town.State == null) { TextBlock txtTown = UICreator.CreateTextBlock(string.Format("{0}", town.Name)); txtTown.VerticalAlignment = System.Windows.VerticalAlignment.Bottom; townPanel.Children.Add(txtTown); Image imgFlag = new Image(); imgFlag.Source = new BitmapImage(new Uri(town.Country.Flag, UriKind.RelativeOrAbsolute)); imgFlag.Height = 24; RenderOptions.SetBitmapScalingMode(imgFlag, BitmapScalingMode.HighQuality); imgFlag.Margin = new Thickness(5, 0, 0, 0); townPanel.Children.Add(imgFlag); } else { townPanel.Children.Add(UICreator.CreateTextBlock(town.Name)); } return(townPanel); }