private void BtDelet_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult mrt = MessageBox.Show("将清空所有本地数据!确定吗?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information);

            if (mrt == MessageBoxResult.OK)
            {
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\app.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassOne.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassTwo.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassThree.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassFour.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassFive.xml");
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\ClassSix.xml");
                LbTime.Content = Judge.TotalHours();
                TbKemu.Focus();
            }
            if (mrt == MessageBoxResult.Cancel)
            {
                TbKemu.Focus();
                return;
            }
        }
        private void BtPlugin_Click(object sender, RoutedEventArgs e)
        {
            //输入数据前对格式是否正确的检测
            if (TbKemu.Text == "" || TbHours.Text == "")
            {
                MessageBox.Show("请输入内容!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (TbKemu.Text == " ")
            {
                MessageBox.Show("请将输入法调为半角模式!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                TbKemu.Clear();
                TbKemu.Focus();
                return;
            }
            if (TbKemu.Text.IndexOf(" ") != -1)
            {
                if (TbKemu.Text.Length > 1)
                {
                    MessageBox.Show("课表输入格式错误,不能在科目中加空格!或者如果你想只输入空格,请只输入一个!", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                    TbKemu.Clear();
                    TbKemu.Focus();
                    return;
                }
            }
            int  number;
            bool result = int.TryParse(TbHours.Text, out number);

            if (result)
            {
                if (number <= 0 || number > 15)
                {
                    MessageBox.Show("你输入的课时错误", "错误", MessageBoxButton.OK, MessageBoxImage.Error); TbHours.Focus(); return;
                }
            }
            else
            {
                MessageBox.Show("课时格式输入错误", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                TbHours.Focus();
                return;
            }
            if (File.Exists(System.Windows.Forms.Application.StartupPath + "\\app.xml"))//检测添加科目是否与本地存在的科目重名
            {
                for (int alct = 0; alct < Judge.LocalKemu().Count; alct++)
                {
                    if (TbKemu.Text == Judge.LocalKemu()[alct])
                    {
                        MessageBoxResult mbr = MessageBox.Show("发现该科目已经存在,是否仍然添加?(适用于同一门课不同老师的情况)", "提示", MessageBoxButton.YesNo, MessageBoxImage.Information);
                        if (mbr == MessageBoxResult.Yes)
                        {
                        }
                        if (mbr == MessageBoxResult.No)
                        {
                            TbHours.Text = ""; TbKemu.Text = ""; TbKemu.Focus(); return;
                        }
                    }
                }
            }
            //通过格式检测,开始写入本地文件
            try
            {
                int totalhours = Judge.TotalHours();

                if (totalhours == 0 || totalhours < 45)//如果本地存储文件不存在或者总课时小于45
                {
                    if (totalhours + Convert.ToInt32(TbHours.Text) > 45)
                    {
                        MessageBox.Show("不能添加此科目,否则总课时将超出", "添加失败!", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                    Judge.DateRecord((bool)CbSimily.IsChecked, Cbcount.Text, TbKemu.Text, TbHours.Text, true);
                    MessageBox.Show("添加成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                    LbNumber.Content = Judge.LocalKemu().Count;
                    LbTime.Content   = Judge.TotalHours();
                    TbHours.Text     = "";
                    TbKemu.Text      = "";
                    TbKemu.Focus();
                    CbSimily.IsChecked = false;
                    //显示本地存储的科目及课时信息数据到ComBox上
                    Cbshow.ItemsSource   = Judge.ReaderLoaclKemuAndHoursData();
                    Cbshow.SelectedIndex = 0;
                    return;
                }
                if (totalhours >= 45)//如果本地文件存在则判断其中课时是否超出总课时
                {
                    MessageBoxResult mbr = MessageBox.Show("所添加的课时已满或者已经超过45!,是否重新配置?", "错误!", MessageBoxButton.YesNo, MessageBoxImage.Error);
                    if (mbr == MessageBoxResult.Yes)
                    {
                        Judge.DateRecord((bool)CbSimily.IsChecked, Cbcount.Text, TbKemu.Text, TbHours.Text, false);
                        MessageBox.Show("添加成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                        LbNumber.Content = Judge.LocalKemu().Count;
                        LbTime.Content   = Judge.TotalHours();
                        TbHours.Text     = "";
                        TbKemu.Text      = "";
                        TbKemu.Focus();
                        CbSimily.IsChecked = false;
                        //显示本地存储的科目及课时信息数据到ComBox上
                        Cbshow.ItemsSource   = Judge.ReaderLoaclKemuAndHoursData();
                        Cbshow.SelectedIndex = 0;
                    }
                    if (mbr == MessageBoxResult.No)
                    {
                        TbHours.Clear();
                        TbKemu.Clear();
                        return;
                    }
                }
            }
            catch
            {
                MessageBox.Show("存储文件发生错误,将进行删除!", "未知错误!", MessageBoxButton.OK, MessageBoxImage.Error);
                File.Delete(System.Windows.Forms.Application.StartupPath + "\\app.xml");
            }
        }