Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            var xlsxPath = Directory.GetCurrentDirectory() + "\\temp.xlsx"; //Laba2\Laba2\bin\Release\temp.xlsx
            var dataPath = Directory.GetCurrentDirectory() + "\\data.xml";  //Laba2\Laba2\bin\Release\data.xml

            if (File.Exists(dataPath))
            {
                db = NoteDB.DeSerializeObject <NoteDB>(dataPath);
            }
            else
            {
                DownloadFile(xlsxPath);
                db = new NoteDB();
                db.Parse(xlsxPath);
            }

            NoteDB.SerializeObject <NoteDB>(db, dataPath);

            this._cview = new PagingCollectionView(db.list
                                                   ,
                                                   20
                                                   );
            this.DataContext = this._cview;
        }
Ejemplo n.º 2
0
        //Обновление БД
        private void OnRenewClicked(object sender, RoutedEventArgs e)
        {
            //скачиваем файл и сверяем каждую строку в xlsx с каждой записью в БД
            var xlsxPath = Directory.GetCurrentDirectory() + "\\temp.xlsx"; //Laba2\Laba2\bin\Release\temp.xlsx
            var dataPath = Directory.GetCurrentDirectory() + "\\data.xml";  //Laba2\Laba2\bin\Release\data.xml

            DownloadFile(xlsxPath);
            db.AnotherParse(xlsxPath);
            NoteDB.SerializeObject <NoteDB>(db, dataPath);


            this._cview = new PagingCollectionView(db.list
                                                   ,
                                                   20
                                                   );
            this.DataContext = this._cview;
        }