コード例 #1
0
        public bool Init(InitCondition Condition)
        {
            CurrentFace = Faces.QuestionFace;
            bool is_ok = CheckCardsFolder();

            if (is_ok == false)
            {
                MessageBox.Show("Initialization failed");
            }

            switch (Condition)
            {
            case InitCondition.AllCards:
                this.Cards = Globals.GetListOfCards(Globals.GetPathOfEachCard());
                break;

            case InitCondition.PendingCards:
                this.Cards = Globals.GetListOfCards(Globals.GetPathOfEachPendingCard());
                break;

            case InitCondition.MissedCards:
                this.Cards = Globals.GetListOfCards(Globals.GetPathOfEachMissedCard());
                break;

            case InitCondition.SingleSpecifiedCard:
                this.Cards = Globals.GetListOfCards(new string[] { this.SingleSpecifiedCardFolder });
                break;
            }
            this.CurrentCardIndex = 0;
            Present();
            return(is_ok);
        }
コード例 #2
0
        void PresentPendingCards(string CardGroupPath)
        {
            string[] paths = null;
            if (CardGroupPath == "[ALL]")
            {
                paths = Globals.GetPathOfEachPendingCard();
            }
            else
            {
                paths = Globals.GetPathOfEachPendingCard(CardGroupPath);
            }

            var             cards = Globals.GetListOfCards(paths);
            CtrlCardBrowser cb    = new CtrlCardBrowser();

            cb.Init(cards);
            wndMainWindow.PresentContent(cb);
        }
コード例 #3
0
        private static string GetButtonsForMissedCards(string CardGroup)
        {
            string buttons = "";

            string[] missed_cards = Globals.GetPathOfEachMissedCard(CardGroup);
            if (missed_cards == null)
            {
                return("");
            }
            var cards = Globals.GetListOfCards(missed_cards);

            foreach (Card card in cards)
            {
                string btn_text = Globals.GetLastPartOfDir(card.CardAbsPath);
                string href     = string.Format("{0}/Q.html", btn_text);
                buttons += GetButton(btn_text, 200, 30, href);
                buttons += "<br />";
                buttons += "\r\n";
            }
            return(buttons);
        }
コード例 #4
0
        private List <Card> FindMatch(string TextToSearch)
        {
            List <Card> matched_cards = new List <Card>();

            string[] card_paths = null;
            if (cmbCardGroups.SelectedIndex == 0)
            {
                card_paths = Globals.GetPathOfEachCard();
            }
            else
            {
                card_paths = Globals.GetPathOfEachCard(CardGroupPaths[cmbCardGroups.SelectedIndex - 1]);
            }

            var cards = Globals.GetListOfCards(card_paths);

            foreach (Card card in cards)
            {
                List <string> text_file_list = new List <string>();

                string[] question_text_files = Globals.GetListOfTextFiles(card.QuestionAbsPath);
                string[] answer_text_files   = Globals.GetListOfTextFiles(card.AnswerAbsPath);
                string[] reminder_text_files = Globals.GetListOfTextFiles(card.ReminderAbsPath);

                text_file_list.AddRange(question_text_files);
                text_file_list.AddRange(answer_text_files);
                text_file_list.AddRange(reminder_text_files);

                foreach (string file in text_file_list)
                {
                    string file_text = File.ReadAllText(file);
                    if (file_text.IndexOf(TextToSearch) >= 0)
                    {
                        matched_cards.Add(card);
                        break;
                    }
                }
            }
            return(matched_cards);
        }
コード例 #5
0
        void grdCards_Drop(object sender, DragEventArgs drg_event)
        {
            drg_event.Handled = true;


            // Check that the data being dragged is a set of folders
            if (drg_event.Data.GetDataPresent(DataFormats.FileDrop))
            {
                // Get an array with the filenames of the files being dragged
                string[]    paths = (string[])drg_event.Data.GetData(DataFormats.FileDrop);
                List <Card> cards = Globals.GetListOfCards(paths);

                CtrlCardBrowser cb = new CtrlCardBrowser();
                cb.Init(cards);

                wndMainWindow.PresentContent(cb);

                drg_event.Effects = DragDropEffects.Copy;
            }
            else
            {
                drg_event.Effects = DragDropEffects.None;
            }
        }