Ejemplo n.º 1
0
    public IngredientWindow(Recipe recipe, IngredientPattern ingredient)
    {
        InitializeComponent();

        _recipe     = recipe;
        _ingredient = ingredient;

        RefreshWindowControls();
    }
Ejemplo n.º 2
0
    private void CreateDynamicValueButton_Click(object sender, RoutedEventArgs e)
    {
        var newIngredient = new IngredientPattern();

        _ingredients.Add(newIngredient);

        var tempButton = new Button
        {
            Tag = newIngredient
        };

        EditDynamicValue_Click(tempButton, null);
    }
Ejemplo n.º 3
0
    private Grid CreateDynamicValueGrid(IngredientPattern ingredient)
    {
        var grid = new Grid();

        var idBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin    = new Thickness(10, 0, 0, 0),
            FontStyle = FontStyles.Italic,
            Text      = $"[{ingredient.MaterialId}]"
        };

        var nameBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(80, 0, 0, 0),
            Text   = GameAssets.Materials.FirstOrDefault(x => x.Id == ingredient.MaterialId).Name
        };

        var quantityBlock = new TextBlock
        {
            FontSize            = 18,
            VerticalAlignment   = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Left,
            Margin = new Thickness(480, 0, 0, 0),
            Text   = ingredient.Quantity.ToString()
        };

        var editButton = new Button
        {
            Width               = 30,
            Height              = 30,
            Margin              = new Thickness(5, 0, 90, 0),
            Padding             = new Thickness(0),
            HorizontalAlignment = HorizontalAlignment.Right,
            Tag = ingredient
        };

        var editIcon = new PackIcon
        {
            Width      = 20,
            Height     = 20,
            Kind       = PackIconKind.Edit,
            Foreground = (SolidColorBrush)FindResource("BrushGray2")
        };

        editButton.Content = editIcon;

        editButton.Click += EditDynamicValue_Click;

        var deleteButton = new Button
        {
            Width               = 30,
            Height              = 30,
            Margin              = new Thickness(5, 0, 50, 0),
            Tag                 = ingredient,
            Padding             = new Thickness(0),
            HorizontalAlignment = HorizontalAlignment.Right
        };

        var deleteIcon = new PackIcon
        {
            Width      = 20,
            Height     = 20,
            Kind       = PackIconKind.DeleteForever,
            Foreground = (SolidColorBrush)FindResource("BrushGray2")
        };

        deleteButton.Content = deleteIcon;

        deleteButton.Click += DeleteDynamicValue_Click;

        grid.Children.Add(idBlock);
        grid.Children.Add(nameBlock);
        grid.Children.Add(quantityBlock);
        grid.Children.Add(editButton);
        grid.Children.Add(deleteButton);

        return(grid);
    }