Exemplo n.º 1
0
 void DeleteWord_Click(object sender, EventArgs e)
 {
     if (DeleteWord.Text == "Удалить перевод")
     {
         if (Translation.Items.Count == 1)
         {
             MessageBox.Show("Последнее слово!");
         }
         if (Word.Text.Length > 0 && Translation.SelectedItem != null)
         {
             string word        = Word.Text.Trim().ToLower();
             string translation = Translation.SelectedItem.ToString().ToLower();
             Translation.Items.Clear();
             DBHilper.Delete(table.fromTable, table.toTable, table.midTable, word, translation);
             FindWord_Click(null, null);
         }
     }
     else
     {
         string word = Word.Text.Trim().ToLower();
         Translation.Items.Clear();
         DBHilper.Delete(table.fromTable, table.toTable, table.midTable, word);
         Word.Text = "";
         AddTranslationText.Text = "";
         FindWord_Click(null, null);
     }
 }
Exemplo n.º 2
0
      void FindWord_Click(object sender, EventArgs e)
      {
          if (Word.Text.Length < 1)
          {
              return;
          }

          ListWords = DBHilper.GetListTranslaters(table.fromTable, table.toTable,
                                                  table.midTable, Word.Text.Trim());
          if (ListWords.Count == 0)
          {
              MessageBox.Show("Пусто");
              Translation.Items.Clear();
              return;
          }
          else
          {
              Translation.Items.Clear();
              Translation.BeginUpdate();

              foreach (var item in ListWords)
              {
                  Translation.Items.Add(UppercaseFirst(item));
              }
              Translation.EndUpdate();
          }
      }
Exemplo n.º 3
0
 public TranslationWindow(int id)
 {
     openFD = new FolderBrowserDialog();
     table  = DBHilper.GetTable(id);
     Init();
     Word.Select();
 }
Exemplo n.º 4
0
        private void GetListOfDictionary()
        {
            MapOfDictionary = DBHilper.GetDictionary();
            ListOdDictionary.Items.Clear();
            ListOdDictionary.BeginUpdate();

            foreach (var item in MapOfDictionary)
            {
                ListOdDictionary.Items.Add(item.Key);
            }
            ListOdDictionary.EndUpdate();
        }
Exemplo n.º 5
0
      void AddWord_Click(object sender, EventArgs e)
      {
          if (AddTranslationText.Text.Length > 0 && Word.Text.Length > 0)
          {
              string word        = Word.Text.Trim().ToLower();
              string translation = AddTranslationText.Text.Trim().ToLower();
              if (Translation.Items.Count == 0)   // если слова нет то сначала записать слово, а потом перевод
              {
                  DBHilper.InsertInFROMTable(table.fromTable, word);
              }
              DBHilper.Insert(table.fromTable, table.toTable, table.midTable, word, translation);
          }


          FindWord_Click(null, null);
      }
Exemplo n.º 6
0
        private void CreateDictionry_Click(object sender, EventArgs e)
        {
            if (FromTextBox.Text.Length > 0 && ToTextBox.Text.Length > 0)
            {
                string fromName    = FromTextBox.Text.Trim().ToLower();
                string toName      = ToTextBox.Text.Trim().ToLower();
                var    fromNameDig = FromTextBox.Text.Trim().ToLower().Select(c => ((int)c).ToString()).ToArray();
                var    toNameDig   = ToTextBox.Text.Trim().ToLower().Select(c => ((int)c).ToString()).ToArray();
                string fromTable   = "from" + string.Join("", fromNameDig);
                string toTable     = "to" + string.Join("", toNameDig);
                string midTable    = "mid" + fromTable + toTable;

                DBHilper.CreateNewDictionary(fromName, toName, fromTable, toTable, midTable);
                GetListOfDictionary();
            }
        }