/// <summary>Testing buttons with dimension greater 1.</summary> private static Keyboard CreateDevKeyboard2() { logger.Trace("CreateTestKeyboard2()..."); Keyboard kb = new Keyboard(); kb.Name = "DevKB2"; kb.ScanParams = CreateScanParams(null, false); Grid g1 = CreateEmptyGrid("g1", 3, 1); Button b1 = new Button("b1"); b1.SetPosition(0, 0, 2, 1); b1.SetText("big"); g1.AddButton(b1); Button b2 = new Button("b2"); b2.SetPosition(2, 0); b2.SetText("normal"); g1.AddButton(b2); kb.AddGrid(g1); kb.DefaultGridId = g1.Id; return(kb); }
private static void FillFeaturedGrid(Grid g, Action <Button, int, int> features) { for (int x = 0; x < g.Cols; x++) { for (int y = 0; y < g.Rows; y++) { g.AddButton(CreateFeaturedButton(x, y, features)); } } }
private Grid ReadGrid() { logger.Trace("ReadGrid() called..."); string id = reader.GetAttribute(Tags.Grid.GridIdAttr); Grid grid = new Grid(id); grid.Default = XmlUtil.ReadAttributeAsOptionalBool(reader, Tags.Grid.GridDefaultAttr); while (reader.Read()) { logger.Trace(ElemLogMessage()); if (IsElemNamed(Tags.Button.ButtonElem)) { Button b = buttonParser.ParseButton(reader); grid.AddButton(b); } else if (IsElemNamed(Tags.Grid.DimensionElem)) { int cols = int.Parse(reader.GetAttribute(Tags.Grid.DimensionColsAttr)); int rows = int.Parse(reader.GetAttribute(Tags.Grid.DimensionRowsAttr)); grid.SetDimension(cols, rows); } else if (IsElemNamed(Tags.Scanner.ScannerElem)) { grid.ScanParams = ReadScanner(); } else if (IsElemNamed(Tags.Style.StyleElem)) { grid.Style = styleParser.ParseStyle(reader); } else if (IsEndElemNamed(Tags.Grid.GridElem)) { logger.Trace("ReadGrid() ends..."); break; } else { logger.Warn(ElemLogMessage()); } } return(grid); }
/// <summary>Testing non full grids (grids with empty or NOP buttons).</summary> private static Keyboard CreateDevKeyboard5() { logger.Trace("CreateTestKeyboard5()..."); Keyboard kb = new Keyboard(); kb.Name = "DevKB5"; kb.ScanParams = CreateScanParams("linear", true); Grid g1 = CreateEmptyGrid("g1", 5, 5); for (int x = 0; x < g1.Cols; x = x + 2) { for (int y = 0; y < g1.Rows; y = y + 2) { g1.AddButton(CreateBasicButton(x, y)); } } kb.AddGrid(g1); kb.DefaultGridId = g1.Id; return(kb); }
private static Grid BuildControls(SrcmbrModel model) { Grid gridMain = new Grid(); gridMain.ColumnDefinitions.AddStarColumn(); gridMain.RowDefinitions.AddAutoRow(); gridMain.RowDefinitions.AddAutoRow(); gridMain.RowDefinitions.AddStarRow(); gridMain.RowDefinitions.AddAutoRow(); var sp = gridMain_AddSrcmbrNameRow(gridMain, model); gridMain.AddUIElement(sp, 0, 0); var but = gridMain.AddButton("butOk", "OK", 3, 0); but.Click += But_Click; but.HorizontalAlignment = HorizontalAlignment.Left; but.Margin = new Thickness(5); but.Padding = new Thickness(5, 0, 5, 0); var listBox1 = gridMain.AddListBox(null, 2, 0); listBox1.FontFamily = new System.Windows.Media.FontFamily("Lucida console"); listBox1.FontSize = 12; listBox1.Padding = new Thickness(3); var binding = new Binding(); binding.Source = model; binding.Path = new PropertyPath("Lines"); binding.Mode = BindingMode.OneWay; BindingOperations.SetBinding(listBox1, ListBox.ItemsSourceProperty, binding); return(gridMain); }