예제 #1
0
        public bool AddKanjiToRow(ScrapedKanji kanji)
        {
            bool result = true;

            //check if kanji is already in the list
            if(_myColumns == null)
            {
                _myColumns = new List<ScrapedKanji>();
            }

            //columns may not exceed the maximum number
            if(MaxColumnCount == _myColumns.Count)
            {
                return false;
            }

            foreach(ScrapedKanji listKanji in _myColumns)
            {
                if(listKanji.Word.Equals(kanji.Word,StringComparison.InvariantCultureIgnoreCase))
                {
                    result = false;
                    break;
                }
            }

            if(result)
            {
                _myColumns.Add(kanji);
            }

            return result;
        }
예제 #2
0
        public bool AddKanjiToRow(ScrapedKanji kanji)
        {
            bool result = true;

            //check if kanji is already in the list
            if (_myColumns == null)
            {
                _myColumns = new List <ScrapedKanji>();
            }

            //columns may not exceed the maximum number
            if (MaxColumnCount == _myColumns.Count)
            {
                return(false);
            }

            foreach (ScrapedKanji listKanji in _myColumns)
            {
                if (listKanji.Word.Equals(kanji.Word, StringComparison.InvariantCultureIgnoreCase))
                {
                    result = false;
                    break;
                }
            }

            if (result)
            {
                _myColumns.Add(kanji);
            }

            return(result);
        }
예제 #3
0
        private KanjiListRow AddToListRow(ScrapedKanji kanji, KanjiListRow currentRow, KanjiSortedList kanjiEndList)
        {
            KanjiListRow currCopy = currentRow;
            if (!currCopy.AddKanjiToRow(kanji))
            {
                kanjiEndList.MyContent.Add(currCopy);
                currCopy = new KanjiListRow();
                currCopy.MaxColumnCount = 6;
                currCopy.AddKanjiToRow(kanji);
            }

            return currCopy;
        }
예제 #4
0
        private void btnSaveToJson_Click(object sender, EventArgs e)
        {
            List<ScrapedKanji> kanjiScrapes = new List<ScrapedKanji>();
            foreach(ListViewItem itm in lvwData.Items)
            {
                ScrapedKanji kanji = new ScrapedKanji();

                kanji = (ScrapedKanji)itm.Tag;
                kanji.Selected = itm.Checked;

                kanjiScrapes.Add(kanji);
            }

            if(kanjiScrapes.Count > 0)
            {
                saveKanjiDialog.Filter = "Json file|*.json";
                saveKanjiDialog.Title = "Save data to Json file";

                DialogResult res = saveKanjiDialog.ShowDialog();
                string filename = saveKanjiDialog.FileName;
                if(res != DialogResult.Cancel && res != DialogResult.Abort && filename != "")
                {
                    SaveKanjiJsonToDisk(kanjiScrapes, filename);
                }
            }
        }