void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\..\MatrixControl.xaml" ((AdaptiveTester.MatrixControl)(target)).SizeChanged += new System.Windows.SizeChangedEventHandler(this.UserControl_SizeChanged); #line default #line hidden return; case 2: this.border1 = ((System.Windows.Controls.Border)(target)); return; case 3: this.mainGrid = ((System.Windows.Controls.Grid)(target)); return; case 4: this.labelBlank = ((System.Windows.Controls.Label)(target)); return; case 5: this.singleItemBox1 = ((AdaptiveTester.SingleItemBox)(target)); return; } this._contentLoaded = true; }
internal void SetMatrix(AdaptiveSelector.CpeMatrix cpeMatrix) { labelBlank.Visibility = System.Windows.Visibility.Collapsed; int cols = cpeMatrix.GetColumnCount(); int rows = cpeMatrix.GetRowCount(); double colWidth = this.Width / (cols - 1); double rowHeight = this.Height / (rows - 1); ColumnDefinition cd; RowDefinition rd; for (int x = 0; x < cols; x++) { cd = new ColumnDefinition(); cd.Width = new GridLength(colWidth, GridUnitType.Star); mainGrid.ColumnDefinitions.Add(cd); } for (int x = 0; x < rows; x++) { rd = new RowDefinition(); rd.Height = new GridLength(rowHeight, GridUnitType.Star); mainGrid.RowDefinitions.Add(rd); } SingleItemBox box; CellRange c; for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { c = cpeMatrix.GetCellByIndex(y, x); Console.WriteLine(String.Format("Making item '{0}' at x={1};y={2};", c.CellNumber, x, y)); box = new SingleItemBox(c); box.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; box.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; box.Name = "box_" + c.CellNumber; Grid.SetColumn(box, x); Grid.SetRow(box, y); _workaround[c.CellNumber] = box; mainGrid.Children.Add(box); } } }
internal void SetCurrentAndNextColors(int currentId, int nextId) { SingleItemBox p = _workaround[1]; bool continuing = p != null; int x = 1; while (_workaround.ContainsKey(x)) { p = _workaround[x]; p.SetSelected(0); x++; } p = _workaround[currentId]; p.SetSelected(1); p = _workaround[nextId]; p.SetSelected(2); }
internal void SetMatrix(AdaptiveSelector.CpeMatrix cpeMatrix) { labelBlank.Visibility = System.Windows.Visibility.Collapsed; int cols = cpeMatrix.GetColumnCount(); int rows = cpeMatrix.GetRowCount(); double colWidth = this.Width / (cols - 1); double rowHeight = this.Height / (rows - 1); ColumnDefinition cd; RowDefinition rd; for (int x = 0; x < cols; x++) { cd = new ColumnDefinition(); cd.Width = new GridLength(colWidth, GridUnitType.Star); mainGrid.ColumnDefinitions.Add(cd); } for (int x = 0; x < rows; x++) { rd = new RowDefinition(); rd.Height = new GridLength(rowHeight, GridUnitType.Star); mainGrid.RowDefinitions.Add(rd); } SingleItemBox box; CellRange c; for (int y = 0; y < rows; y++) { for (int x = 0; x < cols; x++) { c = cpeMatrix.GetCellByIndex(y, x); Console.WriteLine(String.Format("Making item '{0}' at x={1};y={2};", c.CellNumber,x,y)); box = new SingleItemBox(c); box.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; box.VerticalAlignment = System.Windows.VerticalAlignment.Stretch; box.Name = "box_" + c.CellNumber; Grid.SetColumn(box, x); Grid.SetRow(box, y); _workaround[c.CellNumber] = box; mainGrid.Children.Add(box); } } }