public void replaceWord(TrainWord word) { string wor = ""; foreach (ListViewItem item in listView1.Items) { if (item.SubItems[0].Text == word.Index.ToString()) { wor = item.SubItems[1].Text; item.SubItems[1].Text = word.Word; item.SubItems[2].Text = word.Transcription; item.SubItems[3].Text = word.Translete; item.SubItems[4].Text = word.PerCent.ToString(); item.SubItems[5].Text = word.Url; ErrorWord er = new ErrorWord(); er.id = word.Index; er.path = word.path; er.word = word.Word; if (item.BackColor == Color.Red) { ErrorWord.remove(er); item.BackColor = Color.LightSteelBlue; return; } } } }
public MainForm() { InitializeComponent(); workDirrectory = Directory.CreateDirectory("Content").ToString(); var doubleBufferPropertyInfo = WordslistView.GetType().GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); doubleBufferPropertyInfo.SetValue(WordslistView, true, null); selectedPath = ConfigurationManager.AppSettings["patch"]; MenuItem mitem = new MenuItem("Delete"); mitem.Click += Mitem_Click; MenuItem mitem2 = new MenuItem("Replace Percent"); mitem2.Click += Mitem2_Click; MenuItem mitem3 = new MenuItem("Error Words"); mitem3.Click += Mitem3_Click; menu.MenuItems.Add(mitem); menu.MenuItems.Add(mitem2); menu.MenuItems.Add(mitem3); ErrorWord.addevent(new ReloadErrorList(loadtoErrorList)); }
private void playsound() { TrainWord w = Transletors.getTrainerWord(); try { if (File.Exists(w.Url)) { Player.URL = w.Url; Player.controls.play(); } else { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } catch { if (!File.Exists(w.Url)) { ErrorWord.add(new ErrorWord() { id = w.Index, path = w.path, word = w.Word }); } } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (toolStripComboBox1.SelectedIndex != -1) { Transletors.saveToFile(); } ErrorWord.close(); }
public ErrorFix(MainForm.Mydel2 del, ErrorWord word) { InitializeComponent(); replace += del; textBox1.Text = word.id.ToString(); textBox2.Text = word.word; textBox3.Text = word.path; this.word = word; }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { flag = false; Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath); config.AppSettings.Settings["patch"].Value = FilelistBox.SelectedItem.ToString(); config.Save(); translators.closing(); ErrorWord.close(); TrainingWords.SaveBadKmow(); }
public static void remove(ErrorWord er) { for (int i = 0; i < ErrorWords.Count; i++) { if (er.word == ErrorWords[i].word) { ErrorWords.RemoveAt(i); Reload(er, true); return; } } }
public static void add(ErrorWord er) { foreach (var item in ErrorWords) { if (item.word == er.word) { return; } } ErrorWords.Add(er); Reload(er); }
public void LoadErrorList() { StreamReader stream = new StreamReader(workDirrectory + "\\" + "ErrorLoader.txt"); while (!stream.EndOfStream) { string wordError = stream.ReadLine(); ErrorWord word = new ErrorWord(wordError); ErrorWord.add(word); } stream.Close(); }
public int findErrorWords() { int i = 0; foreach (var item in BufferWords) { if (!File.Exists(item.Url)) { i++; ErrorWord.add(new ErrorWord() { id = item.Index, path = item.path, word = item.Word }); } } return(i); }
public void ReplaceWord(ErrorWord word, string url) { try { if (word.word == BufferWords[word.id - 1].Word1) { BufferWords[word.id - 1].Audio(1, url); } if (word.word == BufferWords[word.id - 1].Word2) { BufferWords[word.id - 1].Audio(2, url); } if (word.word == BufferWords[word.id - 1].Word3) { BufferWords[word.id - 1].Audio(3, url); } } catch { } }
public void loadtoErrorList(ErrorWord word, bool remove) { if (remove) { for (int i = 0; i < ErrorlistView.Items.Count; i++) { if (ErrorlistView.Items[i].Text == word.word) { ErrorlistView.Invoke(new Action(() => ErrorlistView.Items.RemoveAt(i))); return; } } } else { ListViewItem item = new ListViewItem(word.word); item.Tag = word.path; ErrorlistView.Invoke(new Action(() => ErrorlistView.Items.Add(item))); } }
public void Audio() { string Url = string.Format("https://myefe.ru/data/sw/words/us/{0}/{1}__us_1.mp3", this.Word[0], this.Word); string filename = MainForm.workDirrectory + "\\" + this.Word + ".mp3"; if (File.Exists(filename) == false) { try { client.DownloadFile(Url, filename); ErrorWord er = new ErrorWord() { id = this.Index, word = this.Word, path = this.path }; ErrorWord.remove(er); } catch { AddAudio4(); if (Url == "") { AddAudio2(); if (Url == "") { AddAudio3(); if (Url == "") { ErrorWord er = new ErrorWord() { id = this.Index, word = this.Word, path = this.path }; ErrorWord.add(er); this.Url = ""; return; } } } } } this.Url = filename; }
public string AddAudio(string word) { string Url = string.Format("https://myefe.ru/data/sw/words/us/{0}/{1}__us_1.mp3", word[0], word); string filename = MainForm.workDirrectory + "\\sound\\" + word + ".mp3"; if (File.Exists(filename) == false) { try { client.DownloadFile(Url, filename); } catch { ErrorWord.add(new ErrorWord() { id = this.Index, word = word, path = this.path }); return(""); } } return(filename); }
public void Audio(string url) { if (File.Exists(url)) { this.Url = url; } else if (url.Contains("myefe")) { string filename = MainForm.workDirrectory + "\\" + "sound\\" + this.Word + ".mp3"; try { client.DownloadFile(url, filename); this.Url = filename; ErrorWord er = new ErrorWord() { id = this.Index, word = this.Word, path = path }; ErrorWord.remove(er); } catch { } } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { ErrorFix er = new ErrorFix(new MainForm.Mydel2(Translator.ReplaceWord), ErrorWord.get(listBox1.SelectedItem.ToString(), path)); if (er.ShowDialog() == DialogResult.OK) { listBox1.Items.RemoveAt(listBox1.SelectedIndex); } if (listBox1.Items.Count == 0) { this.Close(); } } }
public void Audio(int urlid, string url) { switch (urlid) { case 1: if (File.Exists(url)) { this.Url1 = url; } else if (url.Contains("myefe")) { string filename = MainForm.workDirrectory + "\\sound\\" + this.Word1 + ".mp3"; try { client.DownloadFile(url, filename); this.Url1 = filename; ErrorWord er = new ErrorWord(); er.id = this.Index; er.word = this.Word1; ErrorWord.remove(er); } catch { } } break; case 2: if (File.Exists(url)) { this.Url2 = url; } else if (url.Contains("myefe")) { string filename = MainForm.workDirrectory + "\\sound\\" + this.Word2 + ".mp3"; try { client.DownloadFile(url, filename); this.Url2 = filename; ErrorWord er = new ErrorWord(); er.id = this.Index; er.word = this.Word2; ErrorWord.remove(er); } catch { } } break; case 3: if (File.Exists(url)) { this.Url3 = url; } else if (url.Contains("myefe")) { string filename = MainForm.workDirrectory + "\\sound\\" + this.Word3 + ".mp3"; try { client.DownloadFile(url, filename); this.Url3 = filename; ErrorWord er = new ErrorWord(); er.id = this.Index; er.word = this.Word3; ErrorWord.remove(er); } catch { } } break; default: break; } }
public void ReplaceWord(ErrorWord word, string url) { BufferWords[word.id - 1].Audio(url); }
private void button2_Click(object sender, EventArgs e) { if (ErrorlistView.SelectedItems.Count > 0) { String word = ErrorlistView.SelectedItems[0].Tag as string; if (word.Contains("IrregularVerbs")) { ErrorFix er = new ErrorFix(new Mydel2(translators.getIRTranslator(word).ReplaceWord), ErrorWord.get(ErrorlistView.SelectedItems[0].SubItems[0].Text, word)); er.Show(); } else { ErrorFix er = new ErrorFix(new Mydel2(translators.getTTranslator(word).ReplaceWord), ErrorWord.get(ErrorlistView.SelectedItems[0].SubItems[0].Text, word)); er.Show(); } } }