//读取 按钮按读取键时,把数据加载进去
        private void btnRead_Click(object sender, RoutedEventArgs e)
        {
            if (CheckBoxSureAdd.Visibility == Visibility.Visible)
            {
                TaskDialog task = new TaskDialog("提示");
                task.MainContent = "请单击复选框确定保存当前修改的内容!!!";
                task.Show();
            }

            else
            {
                //弹出读取路径窗口,加载路径
                OpenFileDialog openDia = new OpenFileDialog();
                openDia.Filter = "XML文件|*.xml";
                if (openDia.ShowDialog() == true)
                {
                    //清除原来窗口内加载数据
                    cbxDate.Items.Clear();
                    txtMajor.SelectedIndex = -1;
                    txtNum.Items.Clear();
                    txtUnit.Clear();
                    txtChangeCost.Clear();
                    txtChangeDate.Clear();
                    txtChangeContent.Clear();
                    txtMainSelectEles.Clear();
                    xmlData xmldata = new xmlData();

                    loadDocPath = openDia.FileName;
                    xmldata.xmlLoad(loadDocPath);
                    loadDoc = xmldata;

                    //加载日期combobox
                    List <DateItem> DateItemList = new List <DateItem>();
                    for (int i = 0; i < loadDoc.DCDates.Count; i++)
                    {
                        DateItemList.Add(new DateItem {
                            ID = i, date = loadDoc.DCDates.Item(i).Name
                        });
                    }

                    cbxDate.ItemsSource       = DateItemList;
                    cbxDate.DisplayMemberPath = "date";
                    cbxDate.SelectedValuePath = "ID";

                    cbxDate.IsEnabled = true;

                    //读取文档的标志位置为1
                    isLoadXmlDoc = 1;
                }
            }
        }
        //新建日期项 按钮
        private void btnCreateItem_Click(object sender, RoutedEventArgs e)
        {
            if (CheckBoxSureAdd.Visibility == Visibility.Visible)
            {
                TaskDialog task = new TaskDialog("提示");
                task.MainContent = "请单击复选框确定保存当前修改的内容!!!";
                task.Show();
            }

            else
            {
                cbxDate.IsEnabled        = true;
                cbxDate.IsEditable       = true;
                pickDateCreate.IsEnabled = true;

                //若没有读取文档
                if (isLoadXmlDoc == 0)
                {
                    List <DateItem> dateItems = new List <DateItem>();
                    List <NumItem>  numItems  = new List <NumItem>();

                    loadDoc      = new xmlData();
                    isLoadXmlDoc = 1;
                }

                //若读取了文档
                else
                {
                    cbxDate.SelectedIndex  = -1;
                    txtMajor.SelectedIndex = -1;
                    txtNum.SelectedIndex   = -1;
                    txtUnit.Clear();
                    txtChangeCost.Clear();
                    txtChangeDate.Clear();
                    txtChangeContent.Clear();
                    txtMainSelectEles.Clear();

                    TaskDialog task = new TaskDialog("新建日期");
                    task.Show();
                }

                isNeedNodeDate = 1;
                forCbxUpdate   = 0;
            }
        }