Example #1
0
 private void tsmiOpenFile_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog(this) != DialogResult.OK)
     {
         return;
     }
     Cursor = Cursors.WaitCursor;
     try
     {
         HideLastPropertyEditor();
         tbDescriptor.Clear();
         UpdateStatus("Загрузка файла...");
         var fromFile = XElement.Load(openFileDialog1.FileName);
         UpdateStatus("Извлечение предложений товаров...");
         _allOffers.Load(fromFile.Element("shop").Element("offers"));
         UpdateStatus("Извлечение категорий товаров...");
         _offerCategories.Load(fromFile.Element("shop").Element("categories"));
         UpdateStatus("Привязка товаров к категориям...");
         _offerCategories.LinkOffers(_allOffers);
         UpdateStatus("Подготовка иерархического списка...");
         BuildCategoriesTree(_offerCategories);
         UpdateStatus("Сортировка...");
         tvCategories.Sort();
         UpdateStatus("Готово.");
         UpdateInterface();
         tsbExportToExcel.Enabled = true;
     }
     finally
     {
         Cursor = Cursors.Default;
     }
 }