private void Grid_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { string BaseName = System.Text.RegularExpressions.Regex.Replace((sender as System.Windows.Controls.Grid).Name, @"Grid", string.Empty, System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Windows.Shapes.Rectangle LeavedRectangle = FindName("Rectangle" + BaseName) as System.Windows.Shapes.Rectangle; int Index = Rectangles.IndexOf(LeavedRectangle); if (LeavedRectangle.Style != FindResource("RectangleStyleToday")) { if (previousIndex == Index) { LeavedRectangle.Style = (System.Windows.Style)FindResource("RectangleStyleEventedDay"); previousIndex = -1; return; } } System.Windows.Controls.TextBlock LeavedTextBlock = TextBlocks.ElementAt(Index); if ((LeavedRectangle.Style == FindResource("RectangleStyleNone") && LeavedTextBlock.Style == FindResource("TextBlockStyleForOtherMonths")) || LeavedRectangle.Style == FindResource("RectangleStyleToday") || LeavedRectangle.Style == FindResource("RectangleStyleEventedDay")) { return; } LeavedRectangle.Style = (System.Windows.Style)FindResource("RectangleStyleNone"); }
/// <summary> /// This method is used to create Textblock /// </summary> /// <param name="textblock"></param> /// <returns></returns> public string CreateTextBlockAndVerify(TextBlocks textblock, out string status) { status = "Text Block : " + textblock.Name + " created successfully"; try { if (!VerifyTextBlockExists(textblock.Name)) { EnterValuesForTextBlock(textblock); if (VerifyTextBlockExists(textblock.Name)) { return(status); } else { status = "Failed to create new TextBlock"; return(status); } } else { return("Text Block : " + textblock.Name + " already exist"); } } catch (Exception e) { throw new Exception("Failed to create TextBlock refer screenshot for more info", e); } }
public void AddTextBlock() { var ret = new TextBlockDefinitionItemModel(TextBlocks); TextBlocks.Add(ret); Selection = ret; }
private void AddItemToLastTextBlock(ITextBlockItem item) { if (!TextBlocks.Any()) { TextBlocks.Add(new TextBlock()); } TextBlocks.Last().Items.Add(item); }
public HelpWindow() : base(0, 0, 77, 30, '%') { List <string> creditData = new List <string>(); creditData.Add(creditInfo); _helpTextBlock = new TextBlocks(30, 3, 0, creditData); _backButton = new Button(29, 21, 18, 5, "Back"); _backButton.IsActive = true; }
private void ChangeProperties(int which, string persianDate, string rectangleResourceName, string persianTextBlockResourceName) { Rectangles.ElementAt(which) .Style = (System.Windows.Style)FindResource(rectangleResourceName); TextBlocks.ElementAt(which) .Text = persianDate; TextBlocks.ElementAt(which) .Style = (System.Windows.Style)FindResource(persianTextBlockResourceName); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("OcrResult"); TextBlocks.ForEach(x => sb.Append(x)); sb.AppendLine($"├─DbNetTime({DbNetTime}ms)"); sb.AppendLine($"├─DetectTime({DetectTime}ms)"); sb.AppendLine($"└─StrRes({StrRes})"); return(sb.ToString()); }
public AreYouSureWindow() : base(0, 0, 77, 30, '%') { _yesNoTextBlock = new TextBlocks(32, 10, 0, new List <string> { "Are you sure?" }); _yesNoButtons.Add(new Button(15, 15, 18, 5, "YES")); _yesNoButtons.Add(new Button(44, 15, 18, 5, "NO")); _activeButtonNr = 0; }
/// <summary> /// This method is used to enter values for Textblock /// </summary> /// <param name="textblocks"></param> public void EnterValuesForTextBlock(TextBlocks textblock) { Click_OnButton(Button_CreateTextBlock); Driver.GetElement(TextBox_Name).SendText(textblock.Name); Select MultiLanguageList = new Select(Driver.GetElement(Select_MultiLanguage)); MultiLanguageList.SelectByText(textblock.Language); Driver.SwitchTo().Frame(0); Driver.GetElement(TextBox_Text).SendText(textblock.Text); Driver.SwitchTo().DefaultContent(); Click_OnButton(Button_Save); }
public MenuWindow() : base(0, 0, 77, 30, '%') { _titleTextBlock = new TextBlocks(12, 1, 0, new List <string> { flappyBird }); _menuButtons.Add(new Button(15, 15, 18, 5, "Play")); _menuButtons.Add(new Button(15, 22, 18, 5, "Help")); _menuButtons.Add(new Button(44, 15, 18, 5, "Credits")); _menuButtons.Add(new Button(44, 22, 18, 5, "Exit")); _activeButtonNr = 0; }
public virtual void ReadChildData(BinaryReader reader) { int x = 0; _arrowsBitmap.ReadString(reader); for (x = 0; (x < _itemAnimations.Count); x = (x + 1)) { ItemAnimations.Add(new SingleAnimationReferenceBlockBlock()); ItemAnimations[x].Read(reader); } for (x = 0; (x < _itemAnimations.Count); x = (x + 1)) { ItemAnimations[x].ReadChildData(reader); } for (x = 0; (x < _textBlocks.Count); x = (x + 1)) { TextBlocks.Add(new TextBlockReferenceBlockBlock()); TextBlocks[x].Read(reader); } for (x = 0; (x < _textBlocks.Count); x = (x + 1)) { TextBlocks[x].ReadChildData(reader); } for (x = 0; (x < _bitmapBlocks.Count); x = (x + 1)) { BitmapBlocks.Add(new BitmapBlockReferenceBlockBlock()); BitmapBlocks[x].Read(reader); } for (x = 0; (x < _bitmapBlocks.Count); x = (x + 1)) { BitmapBlocks[x].ReadChildData(reader); } for (x = 0; (x < _hudBlocks.Count); x = (x + 1)) { HudBlocks.Add(new HudBlockReferenceBlockBlock()); HudBlocks[x].Read(reader); } for (x = 0; (x < _hudBlocks.Count); x = (x + 1)) { HudBlocks[x].ReadChildData(reader); } for (x = 0; (x < _playerBlocks.Count); x = (x + 1)) { PlayerBlocks.Add(new PlayerBlockReferenceBlockBlock()); PlayerBlocks[x].Read(reader); } for (x = 0; (x < _playerBlocks.Count); x = (x + 1)) { PlayerBlocks[x].ReadChildData(reader); } }
internal void Compose(IContainer container) { TextBlocks.ToList().ForEach(x => x.Alignment = Alignment); container.DefaultTextStyle(DefaultStyle).Column(column => { column.Spacing(Spacing); foreach (var textBlock in TextBlocks) { column.Item().Element(textBlock); } }); }
public void Grid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { int todayIndex; foreach (System.Windows.Shapes.Rectangle item in Rectangles) { item.Style = (System.Windows.Style)FindResource("RectangleStyleNone"); if (item.Style == (System.Windows.Style)FindResource("RectangleStyleToday")) { todayIndex = Rectangles.IndexOf(item); } } SelectedRectangleBaseName = System.Text.RegularExpressions.Regex.Replace((sender as System.Windows.Controls.Grid).Name, @"Grid", string.Empty, System.Text.RegularExpressions.RegexOptions.IgnoreCase); System.Windows.Shapes.Rectangle SelectedRectangle = FindName("Rectangle" + SelectedRectangleBaseName) as System.Windows.Shapes.Rectangle; int Index = Rectangles.IndexOf(SelectedRectangle); System.Windows.Controls.TextBlock SelectedTextBlock = TextBlocks.ElementAt(Index); if ((SelectedRectangle.Style == FindResource("RectangleStyleNone") && SelectedTextBlock.Style == FindResource("TextBlockStyleForOtherMonths"))) { return; } SelectedRectangle.Style = (System.Windows.Style)FindResource("RectangleStyleToday"); PreviousRectangle = SelectedRectangle; ////بدست آوردن اطلاعات امروز this.yearPersian = this.yearForNavigating; this.monthPersian = this.monthForNavigating; this.dayPersian = (FindName("TextBlock" + SelectedRectangleBaseName) as System.Windows.Controls.TextBlock).Text.ConvertToInteger(); SelectedDateTime = new AAk.Utils.PersianDate(yearPersian, monthPersian, dayPersian); RaiseSelectedDateTimeChangedEvent(); if (e.ClickCount == 2) { RaiseMouseDoubleClickEvent(); } }
public HandGestureControlKeyAddWindow() { InitializeComponent(); for (int i = 1; i <= 20; i++) { var slider = this.FindName("ValueSlider" + i.ToString("00")) as Slider; var textblock = this.FindName("ValueTextBlock" + i.ToString("00")) as TextBlock; slider.ValueChanged += Slider_ValueChanged; slider.Tag = i; Sliders.Add(slider); TextBlocks.Add(textblock); handAngles.Add((int)slider.Value); } AngleLimitCheckBox_Checked(null, null); if (Directory.Exists(Globals.GetCurrentAppDir() + PresetDirectory) == false) { Directory.CreateDirectory(Globals.GetCurrentAppDir() + PresetDirectory); } PresetComboBox.ItemsSource = Directory.EnumerateFiles(Globals.GetCurrentAppDir() + PresetDirectory, "*.json").Select(d => System.IO.Path.GetFileNameWithoutExtension(d)); }
/// <summary> /// This method is used to delete TextBlock /// </summary> /// <param name="textblock"></param> /// <returns></returns> public string DeleteTextBlockAndVerify(TextBlocks textblock) { string status = "TextBlock " + textblock.Name + " Deleted successfully"; try { if (VerifyTextBlockExists(textblock.Name)) { Driver.GetElement(ActionButton_OfTextBlock(textblock.Name, "Delete")).ClickElement(); Driver.SwitchTo().Alert().Accept(); return(status); } else { throw new Exception("Failed to Delete TextBlock " + textblock.Name + " refer screenshot for more info"); } } catch { throw new Exception("Failed to Delete TextBlock refer screenshot for more info"); } }
public void GoToTimedNode(TimedNode node) { TextBlock textblock = null; foreach (TimedNode timedNode in node.GetParentChainIncludingThis().OfType <TimedNode>().Reverse()) { if (TextBlocks.TryGetValue(timedNode, out textblock)) { HighlightTextBlock(textblock, scrollToElement: true); break; } } if (textblock == null && activeTextBlock != null) { if (highlight.Parent is Panel parent) { parent.Children.Remove(highlight); } scrollViewer.ScrollToVerticalOffset(0); scrollViewer.ScrollToHorizontalOffset(0); } }
public Po Convert(SCRIPT source) { int block = 0; int dialog = 1; int blocklength = 0; string text = ""; bool textdump = false; bool textdumpalt = false; for (int i = 0; i < source.Blocks.Count; i++) { if (TextBlocks.Contains(i)) { for (int e = 0; e < source.Blocks[i].Length; e++) { if (!SpecialTextBlocks.Contains(i)) { if (source.Blocks[i][e] == 0x32 && source.Blocks[i][e - 1] == 0xBE && !textdump) { textdump = true; } } else { if (source.Blocks[i][e] == 0x32 && source.Blocks[i][e - 1] == 0 && !textdump) { textdumpalt = true; } } if (textdump || textdumpalt) { byte size = source.Blocks[i][e + 1]; byte[] arraysjis = new byte[size]; Buffer.BlockCopy(source.Blocks[i], (e + 2), arraysjis, 0, size); e = e + 1 + size; blocklength += size + 2; text += GetText(arraysjis) + "\n"; } if (textdumpalt || (textdump && (source.Blocks[i][e + 1] == 0x07 && source.Blocks[i][e + 2] == 0x0E || source.Blocks[i][e + 1] == 0x83 && source.Blocks[i][e + 2] == 0x03 || (source.Blocks[i][e + 1] == 0x01 && (source.Blocks[i][e + 2] == 0x01 || source.Blocks[i][e + 2] == 0x02))))) { PoEntry entry = new PoEntry(); //Generate the entry on the po file entry.Original = text.Remove(text.Length - 1); var type = (textdump) ? "0" : "1"; entry.Context = "Block: " + block.ToString() + " Dialog: " + dialog; entry.Reference = blocklength.ToString() + "|" + type; po.Add(entry); text = ""; dialog++; blocklength = 0; textdump = false; textdumpalt = false; } } block++; dialog = 1; } } return(po); }
private void FlipCurrentTextBlock() { if (_currentTextBlock == TextBlocks.One) { _currentTextBlock = TextBlocks.Two; } else { _currentTextBlock = TextBlocks.One; } }
private TextBlock GetTextBlock(TextBlocks whichTextblock) { if (whichTextblock == TextBlocks.One) return _textBlock1; else return _textBlock2; }
private void Add(object obj) { TextBlocks.Add(new TextBlock { Text = (TextBlocks.Count + 1).ToString() }); }
private void Remove(object obj) { var itm = TextBlocks.LastOrDefault(); TextBlocks.Remove(itm); }
private void Clear(object obj) { TextBlocks.Clear(); }
public GameOverWindow() : base(19, 5, 40, 7, '%') { _gameOverTextBlocks = new TextBlocks(19, 5, 10, new List <string> { gameOverText }); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _textBlock1 = GetTemplateChild("TextBlock1") as TextBlock; _textBlock2 = GetTemplateChild("TextBlock2") as TextBlock; _mainCanvas = GetTemplateChild("MainCanvas") as Canvas; if (!IsSurfaceBound()) return; Canvas.SetLeft(_textBlock1, 0); Canvas.SetTop(_textBlock1, 0); Canvas.SetLeft(_textBlock2, 0); Canvas.SetTop(_textBlock2, 0); _textBlock1.Text = this.Text; _textBlock2.Visibility = Windows.UI.Xaml.Visibility.Collapsed; _currentTextBlock = TextBlocks.One; }
private Panel CreatePanelForLane(KeyValuePair <int, Lane> laneAndId) { var lane = laneAndId.Value; var blocks = lane.Blocks; if (blocks.Count == 0) { return(null); } var canvas = new Canvas(); canvas.VerticalAlignment = VerticalAlignment.Top; var endpoints = new List <BlockEndpoint>(); foreach (var block in blocks) { block.StartPoint = new BlockEndpoint() { Block = block, Timestamp = block.StartTime.Ticks, IsStart = true }; block.EndPoint = new BlockEndpoint() { Block = block, Timestamp = block.EndTime.Ticks }; endpoints.Add(block.StartPoint); endpoints.Add(block.EndPoint); } endpoints.Sort((l, r) => l.Timestamp.CompareTo(r.Timestamp)); int level = 0; foreach (var endpoint in endpoints) { if (endpoint.IsStart) { level++; endpoint.Block.Indent = level; } else { level--; } } blocks.Sort((l, r) => { var startDifference = l.StartTime.Ticks.CompareTo(r.StartTime.Ticks); if (startDifference != 0) { return(startDifference); } return(l.Length.CompareTo(r.Length)); }); DateTime minDateTime = blocks[0].StartTime; DateTime maxDateTime = blocks[blocks.Count - 1].StartTime; foreach (var block in blocks) { block.Start = block.StartTime.Ticks; block.End = block.EndTime.Ticks; } double start = minDateTime.Ticks; double end = maxDateTime.Ticks; double totalDuration = end - start; if (totalDuration == 0) { totalDuration = 1; } double width = 0; var sample = new TextBlock(); sample.Text = "W"; sample.Measure(new Size(10000, 10000)); var textHeight = sample.DesiredSize.Height; double preferredTotalHeight = textHeight * blocks.Count(b => b.Length > totalDuration / 2000); double currentHeight = 0; double totalHeight = 0; foreach (var block in blocks) { //if (block.Length > minimumDurationToInclude) { var content = new ContentControl(); var textBlock = new TextBlock(); textBlock.Text = $"{block.Text} ({TextUtilities.DisplayDuration(block.Duration)})"; textBlock.Background = ChooseBackground(block); double left = 24 * block.Indent; double top = (block.Start - start) / totalDuration * preferredTotalHeight; double height = (block.End - block.Start) / totalDuration * preferredTotalHeight; if (height < textHeight) { height = textHeight; continue; } textBlock.Measure(new Size(10000, 10000)); double currentTotalWidth = left + textBlock.DesiredSize.Width; if (currentTotalWidth > width) { width = currentTotalWidth; } double minimumTop = currentHeight; if (minimumTop > top) { double adjustment = minimumTop - top; if (height > adjustment + textHeight) { height = height - adjustment; top = minimumTop; } else { continue; } } textBlock.Height = height; textBlock.ToolTip = block.GetTooltip(); textBlock.MouseUp += TextBlock_MouseUp; textBlock.Tag = block; TextBlocks.Add(block.Node, textBlock); currentHeight = top + textHeight; if (totalHeight < top + height) { totalHeight = top + height; } Canvas.SetLeft(content, left); Canvas.SetTop(content, top); content.Content = textBlock; content.MouseDoubleClick += Content_MouseDoubleClick; canvas.Children.Add(content); } } canvas.Height = totalHeight; canvas.Width = width; return(canvas); }