59 lines
1.4 KiB
C#
59 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using Przepisy.ViewModels;
|
|
|
|
namespace Przepisy.Views
|
|
{
|
|
/// <summary>
|
|
/// Logika interakcji dla klasy RecipeView.xaml
|
|
/// </summary>
|
|
public partial class RecipeView : UserControl
|
|
{
|
|
public RecipesVM vm { get { return DataContext as RecipesVM; } }
|
|
|
|
|
|
public RecipeView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void ButtonAddRecipe_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (InputName.Text == null || InputDescription.Text == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
vm.AddRecipe(InputName.Text, InputDescription.Text);
|
|
InputName.Text = "";
|
|
InputDescription.Text = "";
|
|
|
|
|
|
}
|
|
|
|
private async void SaveFile_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
await vm.SaveToFileAsync();
|
|
}
|
|
|
|
private async void ReadFile_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
await vm.ReadFileAsync();
|
|
}
|
|
|
|
|
|
}
|
|
}
|