コード例 #1
0
        private void ImportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var winApplication = (WinApplication)Application;
            var form           = ((WinWindow)winApplication.MainWindow).Form;
            var filePath       = string.Empty;

            using (var dialog = new OpenFileDialog
            {
                Multiselect = false,
                Title = "Импорт каталога",
                Filter = ExcelFilesFilter
            })
            {
                if (dialog.ShowDialog(form) != DialogResult.OK)
                {
                    return;
                }

                filePath = dialog.FileName;
            }

            Run(form, () =>
            {
                using (var manager = new ExchangeManager())
                {
                    manager.Import(filePath);
                }
            }, "Импорт каталога");
        }