public Element(ElementVar el, Neurohelper h) { InitializeComponent(); elvar = el; helper = h; DrawGrigSurface(elvar.Picture); }
private void ReadFromFile(string path) { ElementsList.Clear(); var f = File.ReadAllLines(path); for (int i = 5; i < f.Length; i++) { var m = new bool[64]; for (int j = 0; j < f[i].Length - 1 & j < 64; j++) { m[j] = f[i][j] == '1'; } var c = new ElementVar(m); c.Output = f[i][f[i].Length - 1]; ElementsList.Add(c); } }
private void ShowElement(ElementVar el, Grid test) { //general properties test.Background = Brushes.Gray; test.VerticalAlignment = VerticalAlignment.Top; test.HorizontalAlignment = HorizontalAlignment.Left; test.Margin = new Thickness(2); test.MouseLeftButtonDown += Father_MouseLeftButtonDown; test.Cursor = Cursors.Hand; //rectangles of the information for (int i = 0; i < 8; i++) { test.RowDefinitions.Add(new RowDefinition()); test.ColumnDefinitions.Add(new ColumnDefinition()); for (int j = 0; j < 8; j++) { var rect = new Rectangle(); rect.Height = 10; rect.Width = 10; if (el.Picture[i * 8 + j]) { rect.Fill = new SolidColorBrush(Colors.Orange); } else { rect.Fill = new SolidColorBrush(Colors.White); } rect.Margin = new Thickness(1); Grid.SetRow(rect, i); Grid.SetColumn(rect, j); test.Children.Add(rect); } } test.RowDefinitions.Add(new RowDefinition()); var n = new Grid(); Grid.SetColumnSpan(n, 8); Grid.SetRow(n, 8); for (int i = 0; i < 3; i++) { n.ColumnDefinitions.Add(new ColumnDefinition()); } test.Children.Add(n); //for delete icon var g = DeleteElementButton(); Grid.SetColumn(g, 1); n.Children.Add(g); //for left arrow icon var l = LeftArrowButton(); Grid.SetColumn(l, 0); n.Children.Add(l); //for right arrow icon var r = RightArrowButton(); Grid.SetColumn(r, 2); n.Children.Add(r); }