private void go(Class.ClassProducts.product p) { MainWindow w_product = this.Owner as MainWindow; Class.ClassGridProduct.elm el = new Class.ClassGridProduct.elm(); el.background = new SolidColorBrush(xColor.SelectedColor); el.Description = xDescription.Text; el.customerId = p.CustumerId; el.font = new SolidColorBrush(xFontColor.SelectedColor);; el.x = Convert.ToByte(x); el.y = Convert.ToByte(y); Button v = ((Button)w_product.FindName("_b_" + x + "x" + y)); if (v != null) { ((TextBlock)v.Content).Text = el.Description; v.ToolTip = "Products id=[" + p.CustumerId.ToString() + "]"; v.Background = new SolidColorBrush(xFontColor.SelectedColor); v.Foreground = new SolidColorBrush(xColor.SelectedColor); new Class.ClassGridProduct().save(el, w_product.I, w_product.J); this.Close(); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { /* W_product w_product = this.Owner as W_product; * * Class.ClassGridProduct.elm el = new Class.ClassGridProduct.elm(); * * el.background = new SolidColorBrush(xColor.SelectedColor); * * * el.Description = ""; * * el.customerId = Guid.Empty; * * // el.fontColor = new SolidColorBrush(xFontColor.SelectedColor); ; * * el.x = Convert.ToByte(x); * * el.y = Convert.ToByte(y); * * Button v = ((Button)w_product.FindName("b_" + x + "x" + y)); * * if (v != null) * { * ((TextBlock)v.Content).Text = el.Description; * * v.ToolTip = ""; * v.ClearValue(Button.BackgroundProperty);// new SolidColorBrush(Color.FromArgb(0,255,0,0)); * * // v.Foreground = new SolidColorBrush(xFontColor.SelectedColor); * new Class.ClassGridProduct().save(el, w_product.I, w_product.J); * * this.Close(); */ MainWindow w_product = this.Owner as MainWindow; Class.ClassGridProduct.elm el = new Class.ClassGridProduct.elm(); el.customerId = Guid.Empty; el.Description = ""; el.x = Convert.ToByte(x); el.y = Convert.ToByte(y); Button v = ((Button)w_product.FindName("_b_" + x + "x" + y)); if (v != null) { ((TextBlock)v.Content).Text = el.Description; v.ToolTip = ""; v.ClearValue(Button.BackgroundProperty); // v.Background = new SolidColorBrush(xColor.SelectedColor); // v.Foreground = new SolidColorBrush(xFontColor.SelectedColor); new Class.ClassGridProduct().save(el, w_product.I, w_product.J); this.Close(); } }