コード例 #1
0
        public StatisticsWordItem(Word word, bool showPercentage)
        {
            InitializeComponent();

            this.word = word;

            wordTextblock.Text = word.ToDetailString();

            if ((word.correctTranslation | word.wrongTranslation) == 0)
            {
                kanaGrid.Visibility = System.Windows.Visibility.Collapsed;
                kanaProgressBar.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                correct = 100 * word.correctTranslation / (word.correctTranslation + word.wrongTranslation);
                kanaProgressBar.Value = correct;

                if (showPercentage)
                {
                    correctKanaTextblock.Text = correct + "%";
                    wrongKanaTextblock.Text = 100 - correct + "%";
                }
                else
                {
                    correctKanaTextblock.Text = word.correctTranslation.ToString();
                    wrongKanaTextblock.Text = word.wrongTranslation.ToString();
                }
            }

            if ((word.correctJapanese | word.wrongJapanese) > 0)
            {
                correctKanji = 100 * word.correctJapanese / (word.correctJapanese + word.wrongJapanese);
                kanjiProgressBar.Value = correctKanji;

                if (showPercentage)
                {
                    correctKanjiTextblock.Text = correctKanji + "%";
                    wrongKanjiTextblock.Text = 100 - correctKanji + "%";
                }
                else
                {
                    correctKanjiTextblock.Text = word.correctJapanese.ToString();
                    wrongKanjiTextblock.Text = word.wrongJapanese.ToString();
                }
            }
            else
            {
                kanjiGrid.Visibility = System.Windows.Visibility.Collapsed;
                kanjiProgressBar.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
コード例 #2
0
        public DetailWordItem(Word word)
        {
            InitializeComponent();

            ++itemCounter;

            if(deselectedBrush == null)
            {
                deselectedBrush = wordTextblock.Foreground as SolidColorBrush;
                selectedBrush = new SolidColorBrush(Color.FromArgb(255, 100, 100, 255));
            }

            this.value = word;

            wordTextblock.Text = word.ToDetailString();
            descriptionTextblock.Text = word.ToDescriptionString();
        }
コード例 #3
0
        public void Update(Word word, bool showPercentage, bool showTranslation)
        {
            wordTextblock.Text = word.ToDetailString();

            if((word.CorrectWrongCountTranslation == 0 && !showTranslation) ||
               (word.CorrectWrongCountJapanese    == 0 &&  showTranslation))
            {
                HideProgressBar();
                return;
            }

            if(showTranslation)
            {
                correctWrongRelation = (int)(100.0f * word.CorrectWrongRelationTranslation);

                gerJapTextblock.Text = "Deutsch -> Japanisch";
                correctTextblock.Text = word.correctTranslation.ToString();
                wrongTextblock.Text = word.wrongTranslation.ToString();
            }
            else
            {
                correctWrongRelation = (int)(100.0f * word.CorrectWrongRelationJapanese);

                gerJapTextblock.Text = "Japanisch -> Deutsch";
                correctTextblock.Text = word.correctJapanese.ToString();
                wrongTextblock.Text = word.wrongJapanese.ToString();
            }

            progressBar.Value = correctWrongRelation;

            if (showPercentage)
            {
                correctTextblock.Text = correctWrongRelation + "%";
                wrongTextblock.Text   = 100 - correctWrongRelation + "%";
            }
        }
コード例 #4
0
 public void Update(Word word)
 {
     wordTextblock.Text = word.ToDetailString();
     descriptionTextblock.Text = word.ToDescriptionString();
 }