Пример #1
0
        private void UploadFileButton_Click(object sender, RoutedEventArgs e)
        {
            var fileDialog = new OpenFileDialog()
            {
                InitialDirectory = System.IO.Path.GetFullPath("ExcelSamples"),
            };

            fileDialog.ShowDialog();

            if (fileDialog.FileName.EndsWith(".xlsx"))
            {
                LoadingAnimation.Visibility = Visibility.Visible;

                var excelParser = new ExcelExportManager(fileDialog.FileName);
                excelParser.ParsingComplete += ExcelExportManager_ParsingComplete;
                excelParser.ParseFileAsync();
            }
        }
Пример #2
0
        private void ExcelExportManager_ParsingComplete(ExcelExportManager exportManager, IEnumerable <ValuesBunch> items)
        {
            var readItems = items;

            var itemsAmount = items.Count();

            Dispatcher.Invoke(() =>
            {
                if (itemsAmount == 0)
                {
                    MessageBox.Show("File is empty and bla-bla-bla... so, read info!");
                }
                else
                {
                    DiagramsSwitchStackPanel.Visibility = items.Count() > 1 ? Visibility.Hidden : Visibility.Visible;
                }
            }
                              );

            InitializeScopes(items, itemsAmount);

            InitDiagram(DiagramSwitchButton.ButtonState);
        }