using SlnMesnac.WPF.ViewModel;
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;

namespace SlnMesnac.WPF.Page
{
    /// <summary>
    /// BaseConfigInfoPage.xaml 的交互逻辑
    /// </summary>
    public partial class BaseConfigInfoPage : UserControl
    {
        private BaseConfigInfoViewModel ViewModel;
        public BaseConfigInfoPage()
        {
            InitializeComponent();
            ViewModel = new BaseConfigInfoViewModel();
            this.DataContext = ViewModel;
        }

        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            string configKey = ConfigKey.Text;
            string configName = ConfigName.Text;
            string configValue = ConfigValue.Text;

            // 调用 ViewModel 中的方法并传递参数
            ViewModel.Save(configKey, configName, configValue);
        }

        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            string configId = ConfigId.Text;
            string configKey = ConfigKey.Text;
            string configName = ConfigName.Text;
            string configValue = ConfigValue.Text;

            // 调用 ViewModel 中的方法并传递参数
            ViewModel.Edit(configId,configKey, configName, configValue);
        }
    }
}
