public void AddAmendmentLine1(string textValue) { Paragraph paragraph = new Paragraph(new Run(textValue)); paragraph.Margin = new Thickness(10, 0, 0, 0); paragraph.FontSize = (double)m_FontSizeConverter.ConvertFromString("8pt"); paragraph.FontFamily = new FontFamily("Verdana"); paragraph.TextAlignment = TextAlignment.Left; Section section = new Section(paragraph); section.Margin = new Thickness(0, 1, 0, 0); section.BorderBrush = Brushes.Black; section.BorderThickness = new Thickness(0, 1, 0, 0); TableCell cell = new TableCell(section); cell.ColumnSpan = 3; cell.BorderBrush = Brushes.Black; cell.BorderThickness = new Thickness(0, 2, 0, 0); TableRow row = new TableRow(); row.Cells.Add(cell); this.m_MoneyBoxTable.RowGroups[0].Rows.Add(row); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var n = (int)value; var converter = new FontSizeConverter(); return(converter.ConvertFromString($"{n}pt")); }
public PaintingWithImagesExample() { Background = Brushes.White; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(20.0); // Create a button. Button berriesButton = new Button(); berriesButton.Foreground = Brushes.White; berriesButton.FontWeight = FontWeights.Bold; FontSizeConverter sizeConverter = new FontSizeConverter(); berriesButton.FontSize = (Double)sizeConverter.ConvertFromString("16pt"); berriesButton.FontFamily = new FontFamily("Verdana"); berriesButton.Content = "Berries"; berriesButton.Padding = new Thickness(20.0); berriesButton.HorizontalAlignment = HorizontalAlignment.Left; // Create an ImageBrush. ImageBrush berriesBrush = new ImageBrush(); berriesBrush.ImageSource = new BitmapImage( new Uri(@"sampleImages\berries.jpg", UriKind.Relative) ); // Use the brush to paint the button's background. berriesButton.Background = berriesBrush; mainPanel.Children.Add(berriesButton); this.Content = mainPanel; }
private static Inline BuildFont(ElementToken token, Hint hint) { var span = new Span(); if (token.Attributes.TryGetValue("size", out var size)) { var fc = new FontSizeConverter(); var sz = (double)fc.ConvertFromString(size); span.FontSize = sz; } if (token.Attributes.TryGetValue("face", out var face)) { span.FontFamily = new FontFamily(face); } if (token.Attributes.TryGetValue("color", out var color)) { var bc = new BrushConverter(); var br = (Brush)bc.ConvertFromString(color); span.Foreground = br; } return(span.Fill(token, hint)); }
public CodeTextEditor() { // Defaults FontSize = (double)fontSizeConverter.ConvertFromString("10pt"); FontFamily = new FontFamily("Consolas"); BorderBrush = new SolidColorBrush(Colors.Silver); BorderThickness = new Thickness(1); // Indentation settings Options.IndentationSize = 2; Options.ConvertTabsToSpaces = true; Options.InheritWordWrapIndentation = false; // Create search panel this.searchPanel = SearchPanel.Install(TextArea); TextArea.TextEntering += OnTextEntering; TextArea.TextEntered += OnTextEntered; TextArea.MouseRightButtonDown += TextArea_MouseRightButtonDown; this.CtrlSpaceCommand = new RoutedCommand(); this.CtrlSpaceCommand.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control)); CommandBinding cb = new CommandBinding(this.CtrlSpaceCommand, OnCtrlSpaceCommand); this.CommandBindings.Add(cb); cb = new CommandBinding(ApplicationCommands.Replace, OnReplace, OnCanReplace); this.CommandBindings.Add(cb); this.completion = new LuaCodeCompletion(); }
private void changeSize(object sender, SelectionChangedEventArgs args) { ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem); FontSizeConverter myFontSizeConverter = new FontSizeConverter(); text1.FontSize = (Double)myFontSizeConverter.ConvertFromString(li.Content.ToString()); }
public static TextRange Size(this TextRange range, string size) { FontSizeConverter fc = new FontSizeConverter(); var fontSize = fc.ConvertFromString(size); range.ApplyPropertyValue(TextElement.FontSizeProperty, fontSize); return(range); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var fontSize = value as int?; if (!fontSize.HasValue) { return(value); } return(Converter.ConvertFromString(fontSize.Value + "pt")); }
private void createVisualBrushExample(Panel examplePanel) { // <SnippetGraphicsMMVisualBrushExampleInline> Rectangle exampleRectangle = new Rectangle(); exampleRectangle.Width = 75; exampleRectangle.Height = 75; // Create a VisualBrush and use it // to paint the rectangle. VisualBrush myBrush = new VisualBrush(); // // Create the brush's contents. // StackPanel aPanel = new StackPanel(); // Create a DrawingBrush and use it to // paint the panel. DrawingBrush myDrawingBrushBrush = new DrawingBrush(); GeometryGroup aGeometryGroup = new GeometryGroup(); aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(0, 0, 50, 50))); aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(50, 50, 50, 50))); RadialGradientBrush checkerBrush = new RadialGradientBrush(); checkerBrush.GradientStops.Add(new GradientStop(Colors.MediumBlue, 0.0)); checkerBrush.GradientStops.Add(new GradientStop(Colors.White, 1.0)); GeometryDrawing checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup); myDrawingBrushBrush.Drawing = checkers; aPanel.Background = myDrawingBrushBrush; // Create some text. TextBlock someText = new TextBlock(); someText.Text = "Hello, World"; FontSizeConverter fSizeConverter = new FontSizeConverter(); someText.FontSize = (double)fSizeConverter.ConvertFromString("10pt"); someText.Margin = new Thickness(10); aPanel.Children.Add(someText); myBrush.Visual = aPanel; exampleRectangle.Fill = myBrush; // </SnippetGraphicsMMVisualBrushExampleInline> examplePanel.Children.Add(exampleRectangle); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { string str = value as string; if (string.IsNullOrEmpty(str)) { return(null); } FontSizeConverter fontSizeConverter = new FontSizeConverter(); double result; if (double.TryParse(str, NumberStyles.Float | NumberStyles.AllowThousands, (IFormatProvider)culture, out result)) { return((object)UnitTypedSize.CreateFromUnits(result, this.unitType)); } return((object)UnitTypedSize.CreateFromPixels((double)fontSizeConverter.ConvertFromString(context, culture, str), this.unitType)); }
public static TextStyleStack Parse(string stack) { var value = new TextStyleStack(); var stackMembers = stack.Split(' '); foreach (var stackMember in stackMembers) { if (stackMember.ToLower() == "bold") { value.FontWeight = FontWeights.Bold; } if (stackMember.EndsWith("pt")) { value.FontSize = (double)fsc.ConvertFromString(stackMember); } } return(value); }
public TiledImageBrushExample() { Background = Brushes.White; StackPanel mainPanel = new StackPanel(); mainPanel.Margin = new Thickness(20.0); // Create a button. Button berriesButton = new Button(); berriesButton.Foreground = Brushes.White; berriesButton.FontWeight = FontWeights.Bold; FontSizeConverter sizeConverter = new FontSizeConverter(); berriesButton.FontSize = (Double)sizeConverter.ConvertFromString("16pt"); berriesButton.FontFamily = new FontFamily("Verdana"); berriesButton.Content = "Berries"; berriesButton.Padding = new Thickness(20.0); berriesButton.HorizontalAlignment = HorizontalAlignment.Left; // Create an ImageBrush. ImageBrush berriesBrush = new ImageBrush(); berriesBrush.ImageSource = new BitmapImage( new Uri(@"sampleImages\berries.jpg", UriKind.Relative) ); // Set the ImageBrush's Viewport and TileMode // so that it produces a pattern from // the image. berriesBrush.Viewport = new Rect(0, 0, 0.5, 0.5); berriesBrush.TileMode = TileMode.FlipXY; // Use the brush to paint the button's background. berriesButton.Background = berriesBrush; mainPanel.Children.Add(berriesButton); this.Content = mainPanel; }
public BlockBrush() { flag = new ImageBrush(); flag.ImageSource = new BitmapImage(new Uri("pack://application:,,,/image/flag.png")); mine = new ImageBrush(); mine.ImageSource = new BitmapImage(new Uri("pack://application:,,,/image/mine.png")); for (int i = 0; i < 9; i++) { var my_brush = new VisualBrush(); StackPanel aPanel = new StackPanel(); TextBlock someText = new TextBlock(); someText.Text = i.ToString(); FontSizeConverter fSizeConverter = new FontSizeConverter(); someText.FontSize = (double)fSizeConverter.ConvertFromString("10pt"); someText.Margin = new Thickness(10); someText.Foreground = new SolidColorBrush(colors[i]); if (i != 0) { aPanel.Children.Add(someText); } my_brush.Visual = aPanel; numbers.Add(my_brush); } }
/// <summary> /// コメント表示 /// </summary> private void FlyingComment() { AppModel model = DataContext as AppModel; if (model != null) { string flytext = model.PopText(); if (string.IsNullOrEmpty(flytext) == false) { // コメントのテキストコントロール OutlineTextControl CommentBlock = new OutlineTextControl(); // 表示文字設定 CommentBlock.Text = flytext; // フォント設定 CommentBlock.Font = new FontFamily(model.FontName);; // ボールド設定 CommentBlock.Bold = model.FontBald; // イタリック設定 CommentBlock.Italic = model.FontItalic; // フォントサイズ設定 try { FontSizeConverter myFontSizeConverter = new FontSizeConverter(); CommentBlock.FontSize = (Double)myFontSizeConverter.ConvertFromString(model.FontSize); } catch (Exception ex) { _logger.Error($"フォントサイズ変換に失敗{ ex.Message}"); } // 文字色設定 ColorConverter ColorConv = new ColorConverter(); try { Color col = (Color)ColorConv.ConvertFrom(model.FontColor); CommentBlock.Fill = new SolidColorBrush(col); } catch (Exception ex) { _logger.Error($"文字色変換に失敗{ ex.Message}"); } // テキストの枠線の色 try { Color col = (Color)ColorConv.ConvertFrom(model.FontThicknessColor); CommentBlock.Stroke = new SolidColorBrush(col); } catch (Exception ex) { _logger.Error($"文字の縁色変換に失敗{ ex.Message}"); } // テキストの枠の太さ try { ushort thic = 0; ushort.TryParse(model.FontThickness, out thic); CommentBlock.StrokeThickness = thic; } catch (Exception ex) { _logger.Error($"文字の縁の太さ変換に失敗{ ex.Message}"); } try { // 位置設定Y軸 // 全体のサイズ/コメントの縦幅で、画面の行数を計算 long linecount = (long)(m_Canvas.ActualHeight / CommentBlock.FormattedTextHeight); long pos = 0; if (linecount >= 2) { // 前回の行数と異なる場所になるようにする。 pos = _LastLine; while (_LastLine == pos) { pos = _rnd.Next(0, (int)linecount); } _LastLine = pos; } double ypos = pos * CommentBlock.FormattedTextHeight; //CommentBlock.SetValue(Canvas.LeftProperty, 200.0); CommentBlock.SetValue(Canvas.TopProperty, ypos); // アニメーション設定 DoubleAnimation myDoubleAnimation = new DoubleAnimation(); // キャンバスの右端から myDoubleAnimation.From = m_Canvas.ActualWidth; // キャンバスの左端-コメントの長さ=コメントが全て見きれる位置 myDoubleAnimation.To = 0 - CommentBlock.FormattedTextWidth; // コメント滞在時間 try { long time = 0; long.TryParse(model.CommentTime, out time); myDoubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(time)); } catch (Exception ex) { _logger.Error($"コメント滞在時間の変換に失敗{ ex.Message}"); throw; } // 繰り返しを無しに設定 myDoubleAnimation.AutoReverse = false; // アニメーションの終了イベントを設定 myDoubleAnimation.Completed += (s, _) => CommentScrollCompleted(CommentBlock); // アニメーションを開始 CommentBlock.BeginAnimation(Canvas.LeftProperty, myDoubleAnimation); m_Canvas.Children.Add(CommentBlock); } catch (Exception ex) { _logger.Error($"コメントコントロールの作成に失敗{ ex.Message}"); } } } }
private void OuterBorder_MouseUp(object sender, MouseButtonEventArgs e) { WebModelingStaticClass.IsMainGridClik = true; Point pt = e.GetPosition(this); pt.Y = pt.Y; if (WebModelingStaticClass.ul.NewButton.IsSelected || IsUIChecked[0] == true) { UI_Button my = new UI_Button("Button", "이태릭체", "없음", 10); Rectangle r = new Rectangle(); Button mq = new Button(); r.RadiusX = 0; r.RadiusY = 0; //ImageBrush myBrush = new ImageBrush(); //myBrush.ImageSource = // new BitmapImage(new Uri(@"C:\Users\inhye\Desktop\1497330714590.jpg", UriKind.Relative)); //r.Fill = myBrush; // r.Fill = new SolidColorBrush(Colors.Black); VisualBrush myBrush = new VisualBrush(); StackPanel aPanel = new StackPanel(); // Create a DrawingBrush and use it to // paint the panel. DrawingBrush myDrawingBrushBrush = new DrawingBrush(); GeometryGroup aGeometryGroup = new GeometryGroup(); aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(0, 0, 50, 50))); //aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(50, 50, 50, 50))); RadialGradientBrush checkerBrush = new RadialGradientBrush(); checkerBrush.GradientStops.Add(new GradientStop(Colors.Gray, 0.0)); //checkerBrush.GradientStops.Add(new GradientStop(Colors.White, 1.0)); GeometryDrawing checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup); myDrawingBrushBrush.Drawing = checkers; aPanel.Background = myDrawingBrushBrush; // Create some text. TextBlock someText = new TextBlock(); someText.Text = "Button"; FontSizeConverter fSizeConverter = new FontSizeConverter(); someText.FontSize = (double)fSizeConverter.ConvertFromString("10pt"); someText.Margin = new Thickness(10); aPanel.Children.Add(someText); myBrush.Visual = aPanel; r.Fill = myBrush; r.Fill.Opacity = 0.8; this.Add(r, my, pt); WebModelingStaticClass.ul.NewButton.IsSelected = false; } else if ((WebModelingStaticClass.ul.NewCheckBox.IsSelected) || IsUIChecked[1] == true) { UI_TextBox my = new UI_TextBox("TextBox", "이태릭체", "없음", 10); Rectangle r = new Rectangle(); r.RadiusX = 0; r.RadiusY = 0; VisualBrush myBrush = new VisualBrush(); StackPanel aPanel = new StackPanel(); DrawingBrush myDrawingBrushBrush = new DrawingBrush(); GeometryGroup aGeometryGroup = new GeometryGroup(); aGeometryGroup.Children.Add(new RectangleGeometry(new Rect(0, 0, 50, 50))); RadialGradientBrush checkerBrush = new RadialGradientBrush(); checkerBrush.GradientStops.Add(new GradientStop(Colors.LightCyan, 0.0)); GeometryDrawing checkers = new GeometryDrawing(checkerBrush, null, aGeometryGroup); myDrawingBrushBrush.Drawing = checkers; aPanel.Background = myDrawingBrushBrush; // Create some text. TextBlock someText = new TextBlock(); someText.Text = "텍스트박스"; FontSizeConverter fSizeConverter = new FontSizeConverter(); someText.FontSize = (double)fSizeConverter.ConvertFromString("10pt"); someText.Margin = new Thickness(10); aPanel.Children.Add(someText); myBrush.Visual = aPanel; r.Fill = myBrush; r.Fill.Opacity = 0.8; this.Add(r, my, pt); WebModelingStaticClass.ul.NewCheckBox.IsSelected = false; } for (int i = 0; i < IsUIChecked.Length; i++) { IsUIChecked[i] = false; } WebModelingStaticClass.IsMainGridClik = false; }
/// <summary> /// Creates the <see cref="GeometryRectangles"/> with <see cref="TextBlock"/>s in them, /// which contains the value of the packet at the special place. /// </summary> private void createPacketCubes() { int i = 0; VisualBrush visualBrush; StackPanel stackPanel; DrawingBrush drawingBrush; GeometryGroup geometryGroup; RadialGradientBrush ragrbr; GeometryDrawing gedr; TextBlock textBlock; Path temp; for (int j = 1; j <= 12; j++) { for (int k = 0; k < 8; k++) { if (i < 74) { temp = pathesIP[j - 1, k]; temp.Data = new RectangleGeometry(new Rect(k, j, 30, 30)); drawingBrush = new DrawingBrush(); geometryGroup = new GeometryGroup(); geometryGroup.Children.Add(new RectangleGeometry(new Rect(k, j, 30, 30))); ragrbr = new RadialGradientBrush(); ragrbr.GradientStops.Add(new GradientStop(Colors.LightGray, 0.0)); gedr = new GeometryDrawing(ragrbr, null, geometryGroup); drawingBrush.Drawing = gedr; stackPanel = new StackPanel(); stackPanel.Background = drawingBrush; textBlock = new TextBlock(); textBlock.Text = String.Format("{0:X2}", iPPacket[i]); FontSizeConverter fsc = new FontSizeConverter(); textBlock.FontSize = (double)fsc.ConvertFromString("12pt"); textBlock.Margin = new Thickness(10); stackPanel.Children.Add(textBlock); visualBrush = new VisualBrush(); visualBrush.Visual = stackPanel; temp.Fill = visualBrush; temp.Opacity = 0.5; DoubleAnimation myDoubleAnimationIn = new DoubleAnimation(); myDoubleAnimationIn.From = 0.5; myDoubleAnimationIn.To = 1.0; myDoubleAnimationIn.Duration = new Duration(TimeSpan.FromSeconds(1)); myDoubleAnimationIn.AutoReverse = false; DoubleAnimation myDoubleAnimationOut = new DoubleAnimation(); myDoubleAnimationOut.From = 1.0; myDoubleAnimationOut.To = 0.5; myDoubleAnimationOut.Duration = new Duration(TimeSpan.FromSeconds(1)); myDoubleAnimationOut.AutoReverse = false; Storyboard myStoryboardIn = new Storyboard(); myStoryboardIn.Children.Add(myDoubleAnimationIn); Storyboard.SetTargetName(myDoubleAnimationIn, temp.Name); Storyboard.SetTargetProperty(myDoubleAnimationIn, new PropertyPath(Path.OpacityProperty)); Storyboard myStoryboardOut = new Storyboard(); myStoryboardOut.Children.Add(myDoubleAnimationOut); Storyboard.SetTargetName(myDoubleAnimationOut, temp.Name); Storyboard.SetTargetProperty(myDoubleAnimationOut, new PropertyPath(Path.OpacityProperty)); temp.MouseEnter += new MouseEventHandler(mouseEnter); temp.MouseLeave += new MouseEventHandler(mouseLeave); myStoryboardInArray[0, i] = myStoryboardIn; myStoryboardOutArray[0, i] = myStoryboardOut; pathesIP[j - 1, k].Data = temp.Data; } i++; } } i = 0; for (int j = 1; j <= 8; j += 1) { for (int k = 0; k < 8; k += 1) { if (i < 42) { temp = pathesARP[j - 1, k]; temp.Data = new RectangleGeometry(new Rect(k, j, 30, 30)); drawingBrush = new DrawingBrush(); geometryGroup = new GeometryGroup(); geometryGroup.Children.Add(new RectangleGeometry(new Rect(k, j, 30, 30))); ragrbr = new RadialGradientBrush(); ragrbr.GradientStops.Add(new GradientStop(Colors.LightGray, 0.0)); gedr = new GeometryDrawing(ragrbr, null, geometryGroup); drawingBrush.Drawing = gedr; stackPanel = new StackPanel(); stackPanel.Background = drawingBrush; textBlock = new TextBlock(); textBlock.Text = String.Format("{0:X2}", aRPPacket[i]); FontSizeConverter fsc = new FontSizeConverter(); textBlock.FontSize = (double)fsc.ConvertFromString("12pt"); textBlock.Margin = new Thickness(10); stackPanel.Children.Add(textBlock); visualBrush = new VisualBrush(); visualBrush.Visual = stackPanel; temp.Fill = visualBrush; temp.Opacity = 0.5; DoubleAnimation myDoubleAnimationIn = new DoubleAnimation(); myDoubleAnimationIn.From = 0.5; myDoubleAnimationIn.To = 1.0; myDoubleAnimationIn.Duration = new Duration(TimeSpan.FromSeconds(1)); myDoubleAnimationIn.AutoReverse = false; DoubleAnimation myDoubleAnimationOut = new DoubleAnimation(); myDoubleAnimationOut.From = 1.0; myDoubleAnimationOut.To = 0.5; myDoubleAnimationOut.Duration = new Duration(TimeSpan.FromSeconds(1)); myDoubleAnimationOut.AutoReverse = false; Storyboard myStoryboardIn = new Storyboard(); myStoryboardIn.Children.Add(myDoubleAnimationIn); Storyboard.SetTargetName(myDoubleAnimationIn, temp.Name); Storyboard.SetTargetProperty(myDoubleAnimationIn, new PropertyPath(Path.OpacityProperty)); Storyboard myStoryboardOut = new Storyboard(); myStoryboardOut.Children.Add(myDoubleAnimationOut); Storyboard.SetTargetName(myDoubleAnimationOut, temp.Name); Storyboard.SetTargetProperty(myDoubleAnimationOut, new PropertyPath(Path.OpacityProperty)); temp.MouseEnter += new MouseEventHandler(mouseEnter); temp.MouseLeave += new MouseEventHandler(mouseLeave); myStoryboardInArray[1, i] = myStoryboardIn; myStoryboardOutArray[1, i] = myStoryboardOut; pathesARP[j - 1, k].Data = temp.Data; } i++; } } }
public static double ToFontSize(this string fontSize) { var fontSizeConverter = new FontSizeConverter(); return((double)fontSizeConverter.ConvertFromString(fontSize)); }
/// <summary> /// Initializes a new instance of the <see cref="SplashScreen"/> class. /// </summary> public SplashScreen() : base(DataWindowMode.Custom) { var assembly = Assembly.GetEntryAssembly(); var titleAttributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), true); InitializeComponent(); if (titleAttributes.Length > 0) { AppName.Text = ((AssemblyTitleAttribute)titleAttributes[0]).Title; } var copyrightAttributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true); if (copyrightAttributes.Length > 0) { Copyright.Text = ((AssemblyCopyrightAttribute)copyrightAttributes[0]).Copyright; } var configPath = AppEnvironment.AppPath + @"\Resources\Images\SplashScreen\SplashScreenInfo.xml"; if (File.Exists(configPath)) { //product name var info = XElement.Load(configPath); var productName = info.Element("ProductName"); if (productName != null) { if (!productName.Elements().Any()) { AppName.Text = productName.Value; } else { var text = productName.Element("Text"); if (text != null) { AppName.Text = text.Value; } var fontFile = productName.Element("FontFileDir"); var font = productName.Element("FontFamily"); if (!String.IsNullOrEmpty(font?.Value)) { if (fontFile != null) { var fontFileUri = new Uri("file:///" + AppEnvironment.AppPath + "/" + fontFile.Value + "/"); AppName.FontFamily = new FontFamily(fontFileUri, "./#" + font.Value); } else { AppName.FontFamily = new FontFamily(font.Value.Trim()); } } var size = productName.Element("FontSize"); if (!String.IsNullOrEmpty(size?.Value)) { var myFontSizeConverter = new FontSizeConverter(); var convertFromString = myFontSizeConverter.ConvertFromString(size.Value.Trim()); if (convertFromString != null) { AppName.FontSize = (Double)convertFromString; } } var weight = productName.Element("FontWeight"); if (!String.IsNullOrEmpty(weight?.Value)) { var convertFromString = new FontWeightConverter().ConvertFromString(weight.Value); if (convertFromString != null) { AppName.FontWeight = (FontWeight)convertFromString; } } var style = productName.Element("FontStyle"); if (!String.IsNullOrEmpty(style?.Value)) { var convertFromString = new FontStyleConverter().ConvertFromString(style.Value); if (convertFromString != null) { AppName.FontStyle = (FontStyle)convertFromString; } } var color = productName.Element("Color"); if (!String.IsNullOrEmpty(color?.Value)) { var fromString = new BrushConverter().ConvertFromString(color.Value); if (fromString != null) { var convertFromString = (Brush)fromString; AppName.Foreground = convertFromString; } } var outLineColor = productName.Element("OutlineColor"); if (!String.IsNullOrEmpty(outLineColor?.Value)) { var fromString = ColorConverter.ConvertFromString(outLineColor.Value); if (fromString != null) { var convertFromString = (Color)fromString; AppNameOutline.Color = convertFromString; } } var margin = productName.Element("Margin"); if (!String.IsNullOrEmpty(margin?.Value)) { var fromString = new ThicknessConverter().ConvertFromString(margin.Value); if (fromString != null) { var convertFromString = (Thickness)fromString; AppName.Margin = convertFromString; } } var horizontalAlignment = productName.Element("HorizontalAlignment"); if (!String.IsNullOrEmpty(horizontalAlignment?.Value)) { HorizontalAlignment convertFromString; var r = Enum.TryParse(horizontalAlignment.Value, out convertFromString); if (r) { AppName.HorizontalAlignment = convertFromString; } } } } //sub title var subTitle = info.Element("SubTitle"); if (subTitle != null) { if (!subTitle.Elements().Any()) { SubTitle.Text = subTitle.Value; } else { var text = subTitle.Element("Text"); if (text != null) { SubTitle.Text = text.Value; } else { SubTitle.Height = 0; } var fontFile = subTitle.Element("FontFileDir"); var font = subTitle.Element("FontFamily"); if (!String.IsNullOrEmpty(font?.Value)) { if (fontFile != null) { var fontFileUri = new Uri("file:///" + AppEnvironment.AppPath + "/" + fontFile.Value + "/"); SubTitle.FontFamily = new FontFamily(fontFileUri, "./#" + font.Value); } else { SubTitle.FontFamily = new FontFamily(font.Value.Trim()); } } var size = subTitle.Element("FontSize"); if (!String.IsNullOrEmpty(size?.Value)) { var myFontSizeConverter = new FontSizeConverter(); var convertFromString = myFontSizeConverter.ConvertFromString(size.Value.Trim()); if (convertFromString != null) { SubTitle.FontSize = (Double)convertFromString; } } var weight = subTitle.Element("FontWeight"); if (!String.IsNullOrEmpty(weight?.Value)) { var convertFromString = new FontWeightConverter().ConvertFromString(weight.Value); if (convertFromString != null) { SubTitle.FontWeight = (FontWeight)convertFromString; } } var style = subTitle.Element("FontStyle"); if (!String.IsNullOrEmpty(style?.Value)) { var convertFromString = new FontStyleConverter().ConvertFromString(style.Value); if (convertFromString != null) { SubTitle.FontStyle = (FontStyle)convertFromString; } } var color = subTitle.Element("Color"); if (!String.IsNullOrEmpty(color.Value)) { var fromString = new BrushConverter().ConvertFromString(color.Value); if (fromString != null) { var convertFromString = (Brush)fromString; SubTitle.Foreground = convertFromString; } } var outLineColor = subTitle.Element("OutlineColor"); if (!String.IsNullOrEmpty(outLineColor?.Value)) { var fromString = (Color)ColorConverter.ConvertFromString(outLineColor.Value); if (fromString != null) { var convertFromString = fromString; SubTitleOutline.Color = convertFromString; } } var margin = subTitle.Element("Margin"); if (!String.IsNullOrEmpty(margin?.Value)) { var fromString = new ThicknessConverter().ConvertFromString(margin.Value); if (fromString != null) { var convertFromString = (Thickness)fromString; SubTitle.Margin = convertFromString; } } var horizontalAlignment = subTitle.Element("HorizontalAlignment"); if (!String.IsNullOrEmpty(horizontalAlignment?.Value)) { HorizontalAlignment convertFromString; var r = Enum.TryParse(horizontalAlignment.Value, out convertFromString); if (r) { SubTitle.HorizontalAlignment = convertFromString; } } } } else { SubTitle.Height = 0; } //copy right var copyright = info.Element("Copyright"); if (!string.IsNullOrEmpty(copyright?.Value)) { Copyright.Text = copyright.Value; } else { Copyright.Height = 0; } //info positon var infoPosition = info.Element("Margin"); if (!string.IsNullOrEmpty(infoPosition?.Value)) { var fromString = new ThicknessConverter().ConvertFromString(infoPosition.Value); if (fromString != null) { var convertFromString = (Thickness)fromString; statusPanel.Margin = convertFromString; } } var width = info.Element("Width"); if (!string.IsNullOrEmpty(width?.Value)) { double fromString; var r = double.TryParse(width.Value, out fromString); if (r) { statusPanel.Width = fromString; } } } CustomiseSplashScreen(); }