예제 #1
0
        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 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 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
         {
         }
     }
 }
        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;
            }
        }