Exemplo n.º 1
0
        void AddToFavorite(object sender, EventArgs e)
        {
            var item       = (Button)sender;
            var stackpanel = (StackPanel)item.Content;

            foreach (var element in stackpanel.Children)
            {
                TextBlock textbox = element as TextBlock;
                if (textbox != null)
                {
                    var id = Int32.Parse(textbox.Text);
                    if (VmMain.full_list[id].isFavotite == false)
                    {
                        VmMain.full_list[id].LikeImageSource = "Images/Icon/heart-24-red.png";
                        VmMain.full_list[id].isFavotite      = true;
                    }
                    else
                    {
                        VmMain.full_list[id].LikeImageSource = "Images/Icon/heart-24.png";
                        VmMain.full_list[id].isFavotite      = false;
                    }
                }
                RecipeDAO.updateAllData(VmMain.full_list);
                break;
            }
        }
Exemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string filename = $"{root}File/recipe.json";
            var    arr      = RecipeDAO.getDataFromJson(filename);

            _list = RecipeDAO.GetAll(arr);
        }
Exemplo n.º 3
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            var    title       = InputTitle.Text;
            var    url         = InputUrl.Text;
            var    image       = FileInput.Text;
            var    description = InputDescription.Text;
            Recipe recipe      = new Recipe(title, url, image, description, steps);

            RecipeDAO.AddRecipe(recipe);
            MessageBox.Show("Success");
            this.Close();
        }
Exemplo n.º 4
0
 private void ReloadBtn_Click(object sender, RoutedEventArgs e)
 {
     VmMain.full_list = RecipeDAO.getDataFromJson("");
 }
Exemplo n.º 5
0
        private void SearchBtn_Click(object sender, RoutedEventArgs e)
        {
            var keyword = KeywordInput.Text;

            VmMain.full_list = RecipeDAO.filter(keyword);
        }
Exemplo n.º 6
0
 private void FavoriteBtn_Click(object sender, RoutedEventArgs e)
 {
     VmMain.full_list = RecipeDAO.getFavoriteList();
 }