Пример #1
0
        private void buttonKnow_Click(object sender, RoutedEventArgs e)
        {
            if (++count < words.Count)
            {
                BdTools.UpdateStateMyWord(words[count - 1], State.Know);

                InitDbContext(words[count]);
            }
            else
            {
                if (wordsTrenings.Count != 0)
                {
                    ObservableCollection <MyWord> total_50 = BdTools.ReadWord(App.dataVariable.CountSelectWord);
                    IEnumerable <MyWord>          resurse  = total_50.Except(wordsTrenings);
                    WindowBreyShtorm_2            wb2      = new WindowBreyShtorm_2(wordsTrenings.ToList(), resurse.ToList(), false);
                    wb2.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Нет новых слов");
                    this.Close();
                }
            }
        }
Пример #2
0
        private void buttonBack_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
            int           count = App.dataVariable.CountWordRepetition;
            List <MyWord> lists = BdTools.GetRandomListMyWord(count);

            WindowsManager.CreateWindowRepetition(lists);
        }
Пример #3
0
        private void buttonWordConstructor_Click(object sender, RoutedEventArgs e)
        {
            List <MyWord> lists = BdTools.GetRandomListMyWord(App.dataVariable.CountWordTrenings);

            if (lists != null)
            {
                WindowsManager.CreateWindowBreyShtorm_3(lists, true);
            }
        }
Пример #4
0
        private void buttonSprint_Click_1(object sender, RoutedEventArgs e)
        {
            List <MyWord> lists = BdTools.GetRandomListMyWord(App.dataVariable.CountWordSprint);

            if (lists != null)
            {
                WindowsManager.CreateWindowSprint(lists);
            }
        }
Пример #5
0
        private void buttonRepetition_Click(object sender, RoutedEventArgs e)
        {
            int           count = App.dataVariable.CountWordRepetition;
            List <MyWord> lists = BdTools.GetRandomListMyWord(count);

            if (lists != null)
            {
                WindowsManager.CreateWindowRepetition(lists);
            }
        }
Пример #6
0
        private void buttonState_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            Button         bt     = sender as Button;
            int            wordid = (int)bt.DataContext;
            MyWord         mw     = BdTools.FindMyWord(wordid);
            WindowWordEdit wwe    = new WindowWordEdit(mw, bt);

            if (wwe.ShowDialog() == true)
            {
            }
        }
Пример #7
0
 private void buttonSave_Click(object sender, RoutedEventArgs e)
 {
     BdTools.DeleteWord(MyWord.WordId);
     initNewWord();
     if (wordSample != null)
     {
         int id = BdTools.AddNewWords(wordSample);
         wordButton.DataContext = id;
     }
     this.DialogResult = true;
 }
Пример #8
0
 private void ReadDictionary()
 {
     try
     {
         collection = BdTools.ReadWord();
     }
     catch (Exception)
     {
         return;
     }
 }
Пример #9
0
 private void ReadDictionary()
 {
     try
     {
         collection = BdTools.ReadWord();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
 }
Пример #10
0
 private void UpdateState()
 {
     foreach (MyWord item in myWords)
     {
         State st = State.Learn;
         if (3 - item.TrueAnswer == 0)
         {
             st = State.Know;
         }
         BdTools.UpdateStateMyWord(item.WordId, (int)st);
     }
 }
Пример #11
0
        private void buttonWordTranslate_Click(object sender, RoutedEventArgs e)
        {
            List <MyWord> lists = BdTools.GetRandomListMyWord(App.dataVariable.CountWordTrenings);
            //ObservableCollection<MyWord> collec_5 = BdTools.ReadWord(3);
            ObservableCollection <MyWord> collectionTotal
                = BdTools.ReadWord();

            if (lists != null && collectionTotal != null)
            {
                IEnumerable <MyWord> enumerable = collectionTotal.Except(lists);
                WindowsManager.GreateWindowBreyShtorm_2(lists, enumerable.ToList(), true);
            }
        }
Пример #12
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     dispatcherTimerNext.Stop();
     dispatcherTimer.Stop();
     if (App.dataVariable.IsUpdateState == 1)
     {
         foreach (MyWord item in upDateState)
         {
             BdTools.UpdateStateMyWord(item, State.Learn);
         }
     }
     upDateState.Clear();
 }
Пример #13
0
        private void ClickButtonSave(object sender, RoutedEventArgs e)
        {
            if (GreateNewWord())
            {
                ChengeIconButtonSave(pathGreenTick, ColorIconButtonsave.Green);
                int ind = BdTools.AddNewWords(_wordsSample);
                _wordsSample = new WordSample();

                inerGrid.DataContext = null;
            }


            //imageButtonSave.Source = BitmapFrame.Create(new Uri(@"Picture\\tick_green.png", UriKind.Relative));
        }
Пример #14
0
        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            string translate = textboxTranslation.Text;
            IEnumerable <string> translates = translate.Split(new char[] { ',', '.', '\n', '\r', ';' }).Select(n => n.Trim()).Where(n => Regex.IsMatch(n, "\\S"));
            string example = textboxExample.Text;
            IEnumerable <string> examples = example.Split(new char[] { ';' }).Select(n => n.Trim());

            string word          = textboxWord.Text.ToLower().Trim();
            string audio         = textboxAudio.Text.ToLower().Trim();
            string transcription = textboxTranscrition.Text.ToLower().Trim();

            if (word == "" || audio == "" || translate == "" || audioFile == null)
            {
                MessageBox.Show("Заполните все поля!");
                return;
            }

            if (!File.Exists(FIleTools.NameDirectoryAudio + "/" + audioFile.Name))
            {
                FileInfo copy = FIleTools.CopyTo(audioFile, true);
                copy.IsReadOnly = false;
            }

            WordSample _wordsSample = new WordSample();

            _wordsSample.Word             = word;
            _wordsSample.Translate        = new ObservableCollection <string>(translates);
            _wordsSample.DateTimeInsert   = DateTime.Now;
            _wordsSample.DateTimeLastCall = DateTime.Now;
            _wordsSample.State            = (int)State.New;
            _wordsSample.SoundName        = audioFile.Name;
            _wordsSample.Transcription    = transcription;
            _wordsSample.Example          = new ObservableCollection <string>(examples);
            _wordsSample.PartOfSpeach     = "";

            int st = 0;

            try
            {
                st = BdTools.AddNewWords(_wordsSample);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Clear();
        }
Пример #15
0
 private void buttonNotKnow_Click(object sender, RoutedEventArgs e)
 {
     wordsTrenings.Add(words[count]);
     if (++count < words.Count && wordsTrenings.Count < App.dataVariable.CountWordLearning)
     {
         InitDbContext(words[count]);
     }
     else
     {
         ObservableCollection <MyWord> total_50 = BdTools.ReadWord(App.dataVariable.CountSelectWord);
         IEnumerable <MyWord>          resurse  = total_50.Except(wordsTrenings);
         //WindowBreyShtorm_2 wb2 = new WindowBreyShtorm_2(wordsTrenings.ToList(), resurse.ToList());
         //wb2.Show();
         WindowsManager.GreateWindowBreyShtorm_2(wordsTrenings.ToList(), resurse.ToList(), false);
         this.Close();
     }
 }
Пример #16
0
        private void buttonState_Click(object sender, RoutedEventArgs e)
        {
            Button but = sender as Button;
            int    id  = (int)but.DataContext;

            MyWord mw = collection.Where(n => n.WordId == id).First();


            WindowStateChose wsc = new WindowStateChose(this, mw.State);

            if (wsc.ShowDialog() == true)
            {
                Image im = but.Content as Image;
                im.Source = InitBitMap();
                mw.State  = StateWord;
                BdTools.UpdateStateMyWord(id, StateWord);
            }
        }
Пример #17
0
        private void buttonAudirovanie_Click(object sender, RoutedEventArgs e)
        {
            List <MyWord> lists = BdTools.GetRandomListMyWord(App.dataVariable.CountWordTrenings);

            if (lists != null)

            {
                try
                {
                    WindowsManager.CreateWindowBreyShtorm_4(lists, true);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
        }
Пример #18
0
        private void buttonDelete_Click(object sender, RoutedEventArgs e)
        {
            Button but   = sender as Button;
            int    index = (int)but.DataContext;

            MyWord   wordDel  = BdTools.DeleteWord(index);
            FileInfo fileInfo = FIleTools.SearchFile(wordDel.SoundName, FIleTools.NameDirectoryAudio);

            collection.Remove(wordDel);
            try
            {
                File.Delete(fileInfo.FullName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName);
                return;
            }
        }
Пример #19
0
        private void MenuItemтExcessAudio_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false);
            IEnumerable <string> soundFilesDB     = BdTools.GetAudio();
            IEnumerable <string> except           = soundFilesDirect.Except(soundFilesDB);

            if (except.Count() > 0)
            {
                string message = "";
                foreach (string item in except)
                {
                    message += item + "\n";
                }
                MessageBox.Show("В приложении есть аудиофайлу которых нет в БД:\n" + message, "Информация!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("В приложении  аудиофайлы соответствуют БД", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #20
0
        private void MenuItemControlAudio_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false);
            IEnumerable <string> soundFilesDB     = BdTools.GetAudio();
            IEnumerable <string> intersect        = soundFilesDB.Intersect(soundFilesDirect);
            IEnumerable <string> except           = soundFilesDB.Except(intersect);

            if (except.Count() > 0)
            {
                string message = "";
                foreach (string item in except)
                {
                    message += item + "\n";
                }
                MessageBox.Show("В приложении нет аудиофайлов:\n" + message, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                MessageBox.Show("В приложении  аудиофайлы соответствуют БД", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #21
0
        private void MenuItemтDeletAudio_Click(object sender, RoutedEventArgs e)
        {
            IEnumerable <string> soundFilesDirect = FTPSinchronisation.GetListDirectoryLocal(false);
            IEnumerable <string> soundFilesDB     = BdTools.GetAudio();
            IEnumerable <string> except           = soundFilesDirect.Except(soundFilesDB);

            if (except.Count() > 0)
            {
                string message = "";
                foreach (string item in except)
                {
                    FileInfo info = FIleTools.DeletFile(FIleTools.NameDirectoryAudio, item);
                    message += info.Name + "\n";
                }
                MessageBox.Show("Удалены лишнии файлы из папки:'SoundFiles':\n" + message, "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                MessageBox.Show("В приложении нет аудиофайлов для удаления", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Пример #22
0
        private void DeleteWord(int wordId)
        {
            BdTools.DeleteWord(wordId);
            //MyWord myWord = collection.Where(n => n.WordId == wordId).Single();
            MyWord myWord = null;

            foreach (MyWord item in collection)
            {
                if (item.WordId == wordId)
                {
                    myWord = item;
                }
            }
            if (myWord == null)
            {
                MessageBox.Show("Слово не найдено!", "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            collection.Remove(myWord);
            FileInfo fileInfo = FIleTools.SearchFile(myWord.SoundName, FIleTools.NameDirectoryAudio);

            if (fileInfo != null)
            {
                fileInfo.IsReadOnly = false;
                try
                {
                    File.Delete(fileInfo.FullName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + MethodBase.GetCurrentMethod().DeclaringType.FullName, "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Файл отсутствует в папке SoundFiles", "Внимание!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #23
0
 private void buttonAnswerFalse_Click(object sender, RoutedEventArgs e)
 {
     if (isFinish)
     {
         if (isCurrentBool == isBoolLeft)
         {
             isAnswerTrue = true;
             PlaySound(App.dataVariable.SoundYes);
             StartAnimationV();
         }
         else
         {
             isAnswerTrue = false;
             PlaySound(App.dataVariable.SoundNo);
             StartAnimationX();
         }
     }
     else
     {
         this.Close();
         List <MyWord> lists = BdTools.GetRandomListMyWord(10);
         WindowsManager.CreateWindowSprint(lists);
     }
 }