コード例 #1
0
        public NewProductPage()
        {
            InitializeComponent();

            Thread getTypes = new Thread(delegate()
            {
                MANAGEMENT_STORE_Entities db = new MANAGEMENT_STORE_Entities();
                var TypeProduct = new ObservableCollection <string>(db.Type_product.Select(x => x.Type_Product1));
                var Supplier    = new ObservableCollection <string>(db.Supplier.Select(x => x.Name_Sup));

                Dispatcher.Invoke(() =>
                {
                    ProductId.Text = manage.Create_NewIdproduct_Auto();
                    comboProductTypes.ItemsSource = TypeProduct;
                    comboboxSupplier.ItemsSource  = Supplier;
                    BitmapImage image             = new BitmapImage();
                    image.BeginInit();
                    image.UriSource = new Uri("pack://application:,,/Images/Image.png");
                    image.EndInit();
                    imgProduct.Source = image;
                    imgProduct.Tag    = null;
                });
            });

            getTypes.Start();
        }