コード例 #1
0
 private void ButtonAdd_Click(object sender, RoutedEventArgs e)
 {
     var productPage = new ProductPage();
     productPage.Title = "Tilføj produkt";
     productPage.UpdateUI();
     productPage.ShowDialog();
     populateView();
 }
コード例 #2
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            ProductPage productPage = new ProductPage();

            DataRowView row = (DataRowView)products_ViewDataGrid.SelectedItems[0];

            productPage.Title = "Se produkt";
            productPage.UpdateUI();
            using (var storageContext = new StorageContext())
            {
                var product = storageContext.Products.Find(Convert.ToInt32(row["Product_Number"].ToString()));
                productPage.TextBoxName.Text = product.Name;
                productPage.TextBoxProductNumber.Text = product.ProductId.ToString();
                productPage.ComboBoxCategory.SelectedValue = product.Type.CategoryId;
                productPage.ComboBoxModel.SelectedValue = product.ModelId;
                productPage.ComboBoxType.SelectedValue = product.TypeId;
                productPage.TextBoxAmount.Text = product.Quantity.ToString();
                productPage.RichTextBoxComment.AppendText(product.Comment);
            }
            productPage.ShowDialog();
            populateView();
        }