private void progressBackgroundWorker_DoWork(
            object sender,
            DoWorkEventArgs e)
        {
            Host.ApplyLanguageSettingsToCurrentThread();

            var ei = (ExcelImportInformation)e.Argument;
            var cp = new ExcelImportController();

            cp.Prepare(ei);
            _bwResult = cp.Process((BackgroundWorker)sender);
        }
        private void parseLanguageCode()
        {
            var languageCodes =
                ExcelImportController.DetectLanguagesFromExcelFile(
                    sourceFileTextEdit.Text.Trim());

            languagesToImportCheckListBox.Items.Clear();

            if (languageCodes != null)
            {
                foreach (var languageCode in languageCodes)
                {
                    if (!string.IsNullOrEmpty(languageCode) &&
                        LanguageCodeDetection.IsValidCultureName(languageCode))
                    {
                        var index = languagesToImportCheckListBox.Items.Add(
                            new MyTuple <string, string>(
                                string.Format(
                                    @"{0} ({1})",
                                    LanguageCodeDetection.MakeValidCulture(languageCode).DisplayName,
                                    languageCode),
                                languageCode));

                        languagesToImportCheckListBox.SetItemChecked(index, true);
                    }
                }

                if (languageCodes.Length == 1)
                {
                    // Select one, if only one present.
                    selectAllLanguagesToExportButton_Click(null, null);
                }
            }

            // --
            // Try to restore.

            DevExpressExtensionMethods.RestoreSettings(
                languagesToImportCheckListBox,
                _project.DynamicSettingsGlobalHierarchical,
                @"receiveFileFromTranslator.languagesToImportCheckListBox");
        }
示例#3
0
        private void ExcelImport_ClickHandler(object sender, RoutedEventArgs e)
        {
            try
            {
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName = FileController.DEFAULT_FILENAME;
                dlg.Filter   = FileController.EXCEL_FILEDIALOG_EXTENSION;

                Nullable <bool> result = dlg.ShowDialog();

                if (result == true)
                {
                    ExcelImportController.Import(dlg.FileName, ExcelImportController.IMPORT_TYPE_CUSTOMER);
                    ShowMessageOnSuccessImport(dlg.FileName);
                    NavigateToCustomersGrid();
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Не удалось выполнить импорт.\nТекст ошибки: " + ex.Message, "Ошибка");
            }
        }
        private void parseFileGroups()
        {
            var fileGroups =
                ExcelImportController.DetectFileGroupsFromExcelFile(
                    _project,
                    sourceFileTextEdit.Text.Trim());

            fileGroupsListBox.Items.Clear();

            if (fileGroups != null)
            {
                foreach (var group in fileGroups)
                {
                    if (isMatchingFileGroup(group))
                    {
                        var index = fileGroupsListBox.Items.Add(
                            new MyTuple <string, FileGroup>(
                                group.GetNameIntelligent(_project),
                                group));

                        fileGroupsListBox.SetItemChecked(index, true);
                    }
                }

                if (fileGroups.Length == 1)
                {
                    // Select one, if only one present.
                    selectAllFileGroupsButton_Click(null, null);
                }

                // --
                // Try to restore.

                DevExpressExtensionMethods.RestoreSettings(
                    fileGroupsListBox,
                    _project.DynamicSettingsGlobalHierarchical,
                    @"receiveFileFromTranslator.fileGroupsListBox");
            }
        }
        private void progressBackgroundWorker_DoWork(
            object sender,
            DoWorkEventArgs e)
        {
            Host.ApplyLanguageSettingsToCurrentThread();

            var ei = (ExcelImportInformation)e.Argument;
            var cp = new ExcelImportController();

            cp.Prepare(ei);
            _bwResult = cp.Process((BackgroundWorker)sender);
        }
        public void SetUp()
        {
            var excelImporter = Substitute.For <IExcelImportService>();

            controller = new ExcelImportController(excelImporter);
        }