private void BuildProgressBar() { ProgressBar progressBar = this.FindControl <ProgressBar>("progressBar"); progressBar.Background = ColorBrushFactory.Theme(); progressBar.Foreground = ColorBrushFactory.ThemeAccent(); }
private TextBlock BuildMessageArea() { TextBlock tbMessageArea = new TextBlock(); tbMessageArea.Text = message; tbMessageArea.TextWrapping = Avalonia.Media.TextWrapping.Wrap; tbMessageArea.Height = HEIGHT - 56; tbMessageArea.Margin = new Thickness(10, 10, 10, 10); tbMessageArea.Foreground = ColorBrushFactory.White(); return(tbMessageArea); }
private StackPanel BuildDialog() { StackPanel dialog = new StackPanel(); dialog.Orientation = Avalonia.Layout.Orientation.Horizontal; dialog.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch; dialog.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Stretch; dialog.Width = WIDTH; dialog.Height = HEIGHT; dialog.Background = ColorBrushFactory.Black(); return(dialog); }
private void SetBackground() { UserControl pnlDone = this.FindControl <UserControl>("pnlDone"); pnlDone.Background = ColorBrushFactory.Black(); }
public List <ColoredCode> GetColoredBlocks(string code, string extension) { Dictionary <int, List <ColorScheme> > layers = codeSchemeProvider.GetLayers(extension); List <ColoredCode> codeBlock = new List <ColoredCode>(); var current = ""; var activeSchemes = layers .Select(x => new KeyValuePair <int, ColorScheme>(x.Key, null)) .ToDictionary(x => x.Key, x => x.Value); var lines = 0; var shift = 0; var newShift = 0; var newLines = 0; foreach (var c in code) { if (c == '\n') { newLines++; newShift = 0; } else if (c == '\t') { newShift += 4; } else { newShift++; } current += c; foreach (var layer in layers) { if (activeSchemes[layer.Key] != null) { if (current.EndsWith(activeSchemes[layer.Key].Closer)) { if (shift - activeSchemes[layer.Key].Closer.Length > 0) { shift -= activeSchemes[layer.Key].Closer.Length; } else { shift = 0; } var word = "".PadRight(shift, ' ') + current; codeBlock.Add(new ColoredCode { ColorBrush = ColorBrushFactory.GetBrush(activeSchemes[layer.Key].ColorContent), Word = word, Line = lines, Shift = shift }); current = ""; activeSchemes[layer.Key] = null; if (newLines > 0) { shift = 0; } shift += newShift; lines += newLines; newShift = 0; newLines = 0; } break; } else { var broken = false; foreach (var scheme in layer.Value) { if (current.EndsWith(scheme.Opener)) { current = new string(current.Take(current.Length - scheme.Opener.Length).ToArray()); if (!string.IsNullOrEmpty(current)) { var word = "".PadRight(shift, ' ') + current; var a = activeSchemes.FirstOrDefault(x => x.Key == layer.Key + 1); var color = a.Value != null ? a.Value.ColorContent : Color.Black; codeBlock.Add(new ColoredCode { ColorBrush = ColorBrushFactory.GetBrush(color), Word = word, Line = lines, Shift = shift }); lines += newLines; if (newLines > 0) { shift = 0; } shift += newShift; newShift = 0; newLines = 0; } current = scheme.Opener; newShift += scheme.Opener.Length; activeSchemes[layer.Key] = scheme; broken = true; break; } if (broken) { break; } } } } } if (!string.IsNullOrEmpty(current)) { if (shift - activeSchemes.First(x => x.Value != null).Value.Closer.Length > 0) { shift -= activeSchemes.First(x => x.Value != null).Value.Closer.Length; } else { shift = 0; } var word = "".PadRight(shift, ' ') + current; codeBlock.Add(new ColoredCode { ColorBrush = activeSchemes.First(x => x.Value != null).Value != null ? ColorBrushFactory.GetBrush(activeSchemes.First(x => x.Value != null).Value.ColorContent) : ColorBrushFactory.GetBrush(Color.Black), Word = word, Line = lines, Shift = shift }); } return(codeBlock); }