예제 #1
0
        public void init()
        {
            MinWidth  = MaxWidth = Width;
            MinHeight = MaxHeight = Height;
            //combobox的选项
            categoryList.Add(new CategoryInfo {
                Name = "按照日期查询", Value = 2
            });
            categoryList.Add(new CategoryInfo {
                Name = "按照记录序号查询", Value = 1
            });
            categoryList.Add(new CategoryInfo {
                Name = "显示所有记录", Value = 0
            });
            categoryList.Add(new CategoryInfo {
                Name = "显示成功的记录", Value = 3
            });
            categoryList.Add(new CategoryInfo {
                Name = "按照低于某金币数查询", Value = 4
            });
            selectComboBox.ItemsSource        = categoryList;
            selectComboBox.DisplayMemberPath  = "Name";
            selectComboBox.SelectedValuePath  = "Value";
            this.selectComboBox.SelectedIndex = 2;
            //数据初始化
            string      path = @"..\..\bin\Debug\";//指定目录
            NewFileInfo nf   = NewFileInfo.GetLastFile(path, ".xml");

            if (nf == null)//如果没有xml文件,先生成一个空的xml
            {
                String fileName = LearningRecordService.ExportDocumentName();
                LearningRecordService.Export(fileName);
                NewFileInfo nf2     = NewFileInfo.GetLastFile(path, ".xml");
                string      newPath = nf2.FileName;
                recordList = LearningRecordService.Import(newPath);
            }
            else//如果已有则直接导入
            {
                string newPath = nf.FileName;
                recordList = LearningRecordService.Import(newPath);
            }
            //添加图片
            ImageBrush b = new ImageBrush();

            b.ImageSource   = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + @"\Picture\learningrecordbg.png"));
            b.Stretch       = Stretch.Fill;
            this.Background = b;
        }
예제 #2
0
        public void init()
        {
            //combobox的选项
            categoryList.Add(new CategoryInfo {
                Name = "按照学习日期查询", Value = 2
            });
            categoryList.Add(new CategoryInfo {
                Name = "按照学习记录序号查询", Value = 1
            });
            categoryList.Add(new CategoryInfo {
                Name = "显示所有学习记录", Value = 0
            });
            categoryList.Add(new CategoryInfo {
                Name = "显示学习成功的记录", Value = 3
            });
            selectComboBox.ItemsSource       = categoryList;
            selectComboBox.DisplayMemberPath = "Name";
            selectComboBox.SelectedValuePath = "Value";
            //数据初始化
            string      path = @"..\..\bin\Debug\";//指定目录
            NewFileInfo nf   = NewFileInfo.GetLastFile(path, ".xml");

            if (nf == null)//如果没有xml文件,先生成一个空的xml
            {
                String fileName = LearningRecordService.ExportDocumentName();
                LearningRecordService.Export(fileName);
                NewFileInfo nf2     = NewFileInfo.GetLastFile(path, ".xml");
                string      newPath = nf2.FileName;
                recordList = LearningRecordService.Import(newPath);
            }
            else//如果已有则直接导入
            {
                string newPath = nf.FileName;
                recordList = LearningRecordService.Import(newPath);
            }
        }