public LearnNewWords() { InitializeComponent(); List <Words> prepareToCollection = new List <Words>(); List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); prepareToCollection = cardServices.GetCards(currentColod.Id); foreach (var item in prepareToCollection) { Words addElem = new Words(); addElem.Word = item.Word; addElem.Translate = item.Translate; addElem.Progress = item.Progress; cardsCollection.Add(addElem); } TextBlockWord.Text = cardsCollection[index].Word; TextBlockTranslate.Text = cardsCollection[index].Translate; }
public ConformityTranslate() { InitializeComponent(); List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); Cards = cardServices.GetCards(currentColod.Id); TextBlockTranslate.Text = Cards[0].Word; variant = random.Next(4); variantsMassive[variant] = Cards[variant].Translate; for (int i = 0; i < variantsMassive.Length; i++) { if (i != variant) { variantsMassive[i] = Cards[i].Translate; } } Shuffle(variantsMassive); BtnVar1.Content = variantsMassive[0]; BtnVar2.Content = variantsMassive[1]; BtnVar3.Content = variantsMassive[2]; BtnVar4.Content = variantsMassive[3]; }
public void OnTraningBtn(object sender, RoutedEventArgs e) { if (Colods.SelectedIndex >= 0) { Colod currrentColod = new Colod(); currrentColod = Colods.SelectedItem as Colod; colodServices.ChandeStatus(currrentColod.Id, true); } MainWindow mainWindow = new MainWindow(); mainWindow.Closed += (object s, EventArgs args) => { Colod changeStatusColod = new Colod(); List <Colod> requestColods = colodServices.GetColod(); changeStatusColod = requestColods .Where(x => x.IsChecked == true) .FirstOrDefault(); colodServices.ChandeStatus(changeStatusColod.Id, false); Colods.ItemsSource = requestColods; }; mainWindow.Show(); this.Close(); }
public TranslateWord() { List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); InitializeComponent(); Cards = cardServices.GetCards(currentColod.Id); TextBlockTranslate.Text = Cards[index].Translate; }
public void DeleteColodBtn(object sender, RoutedEventArgs e) { if (Colods.SelectedIndex >= 0) { Colod deleteColod = new Colod(); deleteColod = Colods.SelectedItem as Colod; colodServices.DeleteColod(deleteColod.Id); colodServices = new ColodServices(); List <Colod> requestColods = colodServices.GetColod(); Colods.ItemsSource = requestColods; } }
public MainWindow() { InitializeComponent(); List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); List <Words> requestCards = cardServices.GetCards(currentColod.Id); AllWords.ItemsSource = requestCards; this.DataContext = this; }
private void AddWord(object sender, RoutedEventArgs e) { AddWord addWord = new AddWord(); addWord.Owner = this; addWord.Closed += (object s, EventArgs args) => { List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); List <Words> requestCards = cardServices.GetCards(currentColod.Id); AllWords.ItemsSource = requestCards; }; addWord.Show(); }
public void DeleteWordClick(object sender, RoutedEventArgs e) { if (AllWords.SelectedIndex >= 0) { Words deleteWord = new Words(); deleteWord = AllWords.SelectedItem as Words; cardServices.DeleteCard(deleteWord.Id); List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); cardServices = new CardServices(); List <Words> requestCards = cardServices.GetCards(currentColod.Id); AllWords.ItemsSource = requestCards; colodServices.DeleteWordCount(currentColod.Id); } }
public void ConformityTranslateClick(object sender, RoutedEventArgs e) { List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); List <Words> requestCards = cardServices.GetCards(currentColod.Id); if (requestCards.Count > 4) { ConformityTranslate conformityTranslate = new ConformityTranslate(); conformityTranslate.Show(); } else { MessageBox.Show("Упражнение доступно, когда в словаре больше 4-х слов"); } }
public void AddWordInDictionary(object sender, RoutedEventArgs e) { Colod currentColod = new Colod(); colods = colodServices.GetColod(); currentColod = colods .Where(x => x.IsChecked == true) .FirstOrDefault(); if (currentColod.IsChecked == true) { if (wordBox.Text != "" && translateBox.Text != "") { if (wordBox.Text != "cлово" && translateBox.Text != "перевод") { //(слово, перевод, прогресс, к какой колоде относится слово, isChecked) cardServices.AddCard(wordBox.Text, translateBox.Text, 0, currentColod.Id, false); if (MessageBox.Show("Добавлено слово для изучения", "в словарь", MessageBoxButton.OK) == MessageBoxResult.OK) { wordBox.Clear(); translateBox.Clear(); } ; colodServices.AddWordCount(currentColod.Id); } else { btnCancel.IsEnabled = true; } } else { btnCancel.IsEnabled = true; } } else { MessageBox.Show("Колода не выбрана"); } }
public AccelerationWindow() { InitializeComponent(); timer = new DispatcherTimer() { Interval = new TimeSpan(0, 0, 1) }; // 1 секунда timer.Tick += Timer_Tick; timer.Start(); List <Colod> allColods = colodServices.GetColod(); Colod currentColod = new Colod(); currentColod = allColods .Where(x => x.IsChecked == true) .FirstOrDefault(); listWords = cardServices.GetCards(currentColod.Id); SetMassive(next); TranslateBlock.Text = arrayRandomTranslate[random.Next(arrayRandomTranslate.Length - 1)]; WordBlock.Text = listWords[next].Word; }