public Kanji(string literal, string meaning, string onYomi, string kunYomi, JLPT jLptLevel, int strokeCount)
 {
     Literal = literal;
     Meaning = meaning;
     OnYomi = onYomi;
     KunYomi = kunYomi;
     JLPTLevel = jLptLevel;
     StrokeCount = strokeCount;
 }
 private void SaveSettings()
 {
     JLPT jlptLevels = new JLPT();
     if (Jlpt1CheckBox.IsChecked.Value) jlptLevels |= JLPT.Level1;
     if (Jlpt2CheckBox.IsChecked.Value) jlptLevels |= JLPT.Level2;
     if (Jlpt3CheckBox.IsChecked.Value) jlptLevels |= JLPT.Level3;
     if (Jlpt4CheckBox.IsChecked.Value) jlptLevels |= JLPT.Level4;
     if (OtherCheckBox.IsChecked.Value) jlptLevels |= JLPT.Other;
     App.AppSettings.SetJLPTLevels(jlptLevels);
     App.AppSettings.IsRandomFlashcards = RandomizeFlashcardsCheckBox.IsChecked.Value;
     App.AppSettings.IsRandomReviewList = RandomizeReviewListCheckBox.IsChecked.Value;
     (this.ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = false;
     (this.ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = false;
 }
        public void LoadFromDatabase(JLPT jlptLevels)
        {
            kanjiDictionary = new Dictionary<string, Kanji>();

            using (KanjiDataContext context = new KanjiDataContext(connectionString)) {

                var data = from k in context.Kanji where k.JLPTLevel == (jlptLevels & k.JLPTLevel) select k;

                data.ToList().ForEach(k => kanjiDictionary.Add(k.Literal, k));

                if (App.AppSettings.IsRandomFlashcards)
                    GenerateRandomSequence();
                else
                    GenerateSequence();
            }
                
        }
        private string GetJlptString(JLPT jlptLevels)
        {
            var result = new StringBuilder();

            if ((jlptLevels & JLPT.Level1) == JLPT.Level1)
                result.Append("'Level1',");

            if ((jlptLevels & JLPT.Level2) == JLPT.Level2)
                result.Append("'Level2',");

            if ((jlptLevels & JLPT.Level3) == JLPT.Level3)
                result.Append("'Level3',");

            if ((jlptLevels & JLPT.Level4) == JLPT.Level4)
                result.Append("'Level4',");

            if ((jlptLevels & JLPT.Other) == JLPT.Other)
                result.Append("'Other',");

            if (result.Length == 0)
                return "''";
            else
                return result.Remove(result.Length - 1, 1).ToString();
        }
 public void SetJLPTLevels(JLPT value)
 {
     JLPTLevels = (int)value;
 }