using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Shapes;

namespace Flyad7_WPF
{
    /// <summary>
    /// Window_setAccess.xaml 的交互逻辑
    /// </summary>
    public partial class Window_setAccess : Window
    {
        FlyADBase.IFlyAD mflyad;
        public Window_setAccess()
        {
            InitializeComponent();
        }
        public void Init(FlyADBase.IFlyAD flyad) 
        {
            this.mflyad = flyad;
        }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            BytesConverter bytesconv = new BytesConverter();
            byte[] bs = (byte[])bytesconv.ConvertBack(textBox1.Text, typeof(byte[]), null, null);

            if (bs.Length != 8)
            {
                MessageBox.Show("长度不对,需要 8位 byte");
                return;
            }
            mflyad.SetAccess(bs);
            this.Close();
        }
    }
}