コード例 #1
0
        public void FillControl(Word word)
        {
            //if(word.original == null)
            //{
            //    this.word = word;
            //}
            //else
            //{
            //    this.word = word.original;
            //}

            this.word = word;

            kanaTextbox.Text = word.kana;
            kanjiTextbox.Text = word.kanji == null ? "" : word.kanji;
            translationTextbox.Text = word.translation;
            descriptionTextbox.Text = word.description == null ? "" : word.description;
            showFlagListbox.SelectedIndex = word.showFlags;

            if (word.type == -1)
            {
                typeListbox.SelectedIndex = (int)Word.EType.other;
            }
            else
            {
                typeListbox.SelectedIndex = word.type;
            }
        }
コード例 #2
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;
            }
        }
コード例 #3
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();
        }
コード例 #4
0
        public void FillControl(Word word)
        {
            //this.word = word;

            //kanaTextbox       .Text = word.kana;
            //kanjiTextbox      .Text = word.kanji == null ? "" : word.kanji;
            //translationTextbox.Text = word.translation;
            //descriptionTextbox.Text = word.description == null ? "" : word.description;
            //showFlagListbox.SelectedIndex = word.showFlags;

            //if (word.type == -1)
            //{
            //    typeListbox.SelectedIndex = (int)Word.EType.other;
            //}
            //else
            //{
            //    typeListbox.SelectedIndex = word.type;
            //}
        }
コード例 #5
0
ファイル: Word.cs プロジェクト: deadkitty/Mobile-Computing
        public Word(Word source)
        {
            id                  = source.id;

            kana                = source.kana;
            kanji               = source.kanji;
            translation         = source.translation;
            description         = source.description;

            correctTranslation  = source.correctTranslation;
            wrongTranslation    = source.wrongTranslation;
            correctJapanese     = source.correctJapanese;
            wrongJapanese       = source.wrongJapanese;

            type                = source.type;
            showFlags           = source.showFlags;
            timeStampJapanese   = source.timeStampJapanese;
            timeStampTransl     = source.timeStampTransl;
            lessonID            = source.lessonID;
        }
コード例 #6
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 + "%";
            }
        }
コード例 #7
0
        private static String GetTargetWord(String sourceWord, Word.EType sourceWordType, ConjugationData.ETargetForm targetForm)
        {
            //before i conjugate the wort into the target form i first bring the word from the masu into the ru form
            //the thing is, normaly the word whould already be in ru form but i saved all verbs in masu form
            //so i just convert them at the begining, later i will convert all verbs into the ru form before so
            //i don't have do convert it here
            sourceWord = GetRuVerb(sourceWord, sourceWordType);

            switch (targetForm)
            {
                case ConjugationData.ETargetForm.ruForm              : return GetRuVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.naiForm             : return GetNaiVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.naiPastForm         : return GetNaiVerbPast(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.masuForm            : return GetMasuVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.masuNegativeForm    : return GetMasuVerbNegative(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.masuPastForm        : return GetMasuVerbPast(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.masuPastNegativeForm: return GetMasuVerbPastNegative(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.teForm              : return GetTeVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.taForm              : return GetTaVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.imperativeForm      : return GetImperativeVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.prohibitiveForm     : return GetProhibitiveVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.volitionalForm      : return GetVolitionalVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.conditionalForm     : return GetConditionalVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.tai                 : return GetTaiVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.sugi                : return GetSugiVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.yasui               : return GetYasuiVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.nikui               : return GetNikuiVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.potentialVerb       : return GetPotentialVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.passiveVerb         : return GetPassiveVerb(sourceWord, sourceWordType);
                case ConjugationData.ETargetForm.causativeVerb       : return GetCausativeVerb(sourceWord, sourceWordType);
            }

            return "";
        }
コード例 #8
0
 private static String GetProhibitiveVerb(String sourceWord, Word.EType sourceWordType)
 {
     return sourceWord + "な";
 }
コード例 #9
0
        private static String GetNaiVerbPast(String sourceWord, Word.EType sourceWordType)
        {
            String naiForm = GetNaiVerb(sourceWord, sourceWordType);

            return naiForm.Substring(0, naiForm.Length - 1) + "かった";
        }
コード例 #10
0
        private static String GetMasuVerbPastNegative(String sourceWord, Word.EType sourceWordType)
        {
            String masuForm = GetMasuVerb(sourceWord, sourceWordType);

            return masuForm.Substring(0, masuForm.Length - 1) + "せんでした";
        }
コード例 #11
0
        public StatisticsItem(Word word, bool showPercentage, bool showTranslation)
        {
            InitializeComponent();

            Update(word, showPercentage, showTranslation);
        }
コード例 #12
0
 public static void LoadWords(Lesson[] lessons, Word.EType[] types)
 {
     AppData.Words = context.GetWords(lessons, types);
 }
コード例 #13
0
        public Word[] GetWords(Lesson[] lessons, Word.EType[] types)
        {
            int[] ids = ExtractIDs(lessons);

            return (from c in words where ids.Contains(c.lessonID) && types.Contains((Word.EType)c.type) select c).ToArray();
        }
コード例 #14
0
        private static String AddWords(AppStreamReader sr, int itemCount)
        {
            Dictionary<int, int> lessonsDict = new Dictionary<int, int>();

            for (int i = 0; i < itemCount; ++i)
            {
                String line = sr.ReadLine();
                String[] parts = line.Split('|');

                int lessonID = Convert.ToInt32(parts[0]);

                if (lessonsDict.ContainsKey(lessonID))
                {
                    lessonsDict[lessonID] += 1;
                }
                else
                {
                    lessonsDict.Add(lessonID, 1);
                }

                Word w = new Word(line, lessonID);
                context.words.InsertOnSubmit(w);
            }

            foreach (KeyValuePair<int, int> pair in lessonsDict)
            {
                Lesson l = context.GetLesson(pair.Key);
                l.size += pair.Value;
            }

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Wörter zu bestehenden Lektionen hinzugefügt: " + itemCount);
            return sb.ToString();
        }
コード例 #15
0
        private static String GetVolitionalVerb(String sourceWord, Word.EType sourceWordType)
        {
            switch (sourceWordType)
            {
                case Word.EType.verb1: return GetVolitionalVerb1(sourceWord);
                case Word.EType.verb2: return GetVolitionalVerb2(sourceWord);
                case Word.EType.verb3: return GetVolitionalVerb3(sourceWord);
            }

            return "";
        }
コード例 #16
0
 public int CompareTranslationDeccending(Word x, Word y)
 {
     return (int)((x.CorrectWrongRelationTranslation * 100) - (y.CorrectWrongRelationTranslation * 100));
 }
コード例 #17
0
 public int CompareJapaneseDeccending(Word x, Word y)
 {
     return (int)((x.CorrectWrongRelationJapanese * 100) - (y.CorrectWrongRelationJapanese * 100));
 }
コード例 #18
0
        private static void ResetWord(Word w)
        {
            w.correctTranslation = 0;
            w.wrongTranslation = 0;

            w.correctJapanese = 0;
            w.wrongJapanese = 0;
        }
コード例 #19
0
        private static int ReadVocabLesson(AppStreamReader sr, Lesson lesson)
        {
            Word[] words = new Word[lesson.size];

            for (int i = 0; i < words.Length; ++i)
            {
                String line = sr.ReadLine();

                words[i] = new Word(line, lesson.id);

                AppSettings.TimeStamp = Math.Max(AppSettings.TimeStamp, words[i].TimeStampTransl);
                AppSettings.TimeStamp = Math.Max(AppSettings.TimeStamp, words[i].TimeStampJapanese);
            }

            context.words.InsertAllOnSubmit(words);

            return words.Length;
        }
コード例 #20
0
        private static String GetYasuiVerb(String sourceWord, Word.EType sourceWordType)
        {
            String masuVerb = GetMasuVerb(sourceWord, sourceWordType);

            return masuVerb.Substring(0, masuVerb.Length - 2) + "やすい";
        }
コード例 #21
0
 public void Update(Word word)
 {
     wordTextblock.Text = word.ToDetailString();
     descriptionTextblock.Text = word.ToDescriptionString();
 }