Example #1
0
        private void DbSelector_FileOk(object sender, CancelEventArgs e)
        {
            var connectionString = _connectionStringProvider.GetConnectionStringFromPath("AnkiModel", dbSelector.FileName);

            _storageProvider = new AnkiProvider(connectionString);
            var verbs = _storageProvider.GetAllVerbs();

            foreach (var verb in verbs)
            {
                foreach (IProviderBase provider in _providers)
                {
                    string verbTable = string.Empty;
                    try
                    {
                        verbTable = TableFromVerb(provider.GetConjugation(verb.Front));
                    }
                    catch (Exception ex)
                    {
                        string temp = string.Empty;
                        foreach (var key in ex.Data.Keys)
                        {
                            temp += $"{key}:{ex.Data[key]} \r\n";
                        }

                        textBox2.Text += string.Format($"{ex.Message}=\r\n{ex.StackTrace}\r\n{temp}");
                        ////textBox2.Text += temp;
                    }

                    if (!string.IsNullOrEmpty(verbTable))
                    {
                        verb.Details = verbTable;
                        break;
                    }
                }

                _storageProvider.SaveNote(verb);
            }
        }