コード例 #1
0
        public RecipeEditor(int bookId, IRecipe recipe)
        {
            InitializeComponent();
            _bookId = bookId;
            _recipe = recipe;

            IngredientContainer.Children.Clear();
            LoadContent();
            this.KeyDown += (sender, keyEvent) =>
            {
                if (keyEvent.Key == Key.Enter && !RecipeName.IsFocused)
                {
                    IngredientInput input = new IngredientInput();
                    IngredientContainer.Children.Add(input);
                    input.Select();
                }
            };
        }
コード例 #2
0
        public CreateRecipe(int bookID, RoutedEventHandler listener)
        {
            InitializeComponent();
            _bookId = bookID;

            IngredientContainer.Children.Clear();

            ingredientAdd.Click += IngredientAdd;
            IngredientContainer.Children.Add(new IngredientInput());

            createBtn.Click += createRecipe;
            createBtn.Click += listener;
            this.KeyDown    += (sender, keyEvent) => {
                if (keyEvent.Key == Key.Enter && !RecipeName.IsFocused)
                {
                    IngredientInput input = new IngredientInput();
                    IngredientContainer.Children.Add(input);
                    input.Select();
                }
            };
        }