Esempio n. 1
0
        private void DisplayNewVerb()
        {
            if (VerbenToCheck.Count > 0)
            {
                myVerb = VerbenToCheck[r.Next(VerbenToCheck.Count)];
                VerbenToCheck.Remove(myVerb);

                tbPraesens.Text    = myVerb.Praesens;
                tbHilfsverb.Text   = myVerb.Hilfsverb;
                lbTranslation.Text = myVerb.Translation;
                linkTip.Text       = "Show me a tip";

                lbVerbsLeft.Text = ((Convert.ToInt32(lbVerbsLeft.Text)) - 1).ToString();

                tbPraeteritum.BackColor = Color.White;
                tbPerfekt.BackColor     = Color.White;
                tbPraeteritum.Text      = "";
                tbPerfekt.Text          = "";

                tbPraeteritum.Focus();
            }
            else
            {
                myLoader.WriteStatistics(Scores);

                Chart ChartWindow = new Chart(myLoader);
                ChartWindow.Owner = this;
                ChartWindow.ShowDialog();

                DialogResult UserAnswer =
                    MessageBox.Show(String.Format("You have scored {0} points out of 1000 possible.\r\nWould you like to train again?", Scores), "", MessageBoxButtons.YesNo);

                if (UserAnswer == DialogResult.Yes)
                {
                    Restart();
                }
                else
                {
                    this.Close();
                }
            }
        }
Esempio n. 2
0
        public void ReadVerbs(string p_fileName)
        {
            try
            {
                using (SpreadsheetDocument spreadsheetDocument =
                           SpreadsheetDocument.Open(p_fileName, false))
                {
                    WorkbookPart  workbookPart  = spreadsheetDocument.WorkbookPart;
                    WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
                    SheetData     sheetData     = worksheetPart.Worksheet.Elements <SheetData>().First();

                    VerbenList = new List <KonjugiertesVerb>();

                    foreach (Row r in sheetData.Elements <Row>())
                    {
                        List <Cell> curr_row = r.Elements <Cell>().ToList();

                        string praesens    = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[0].CellValue.Text));
                        string praeteritum = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[1].CellValue.Text));
                        string hilfsverb   = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[2].CellValue.Text));
                        string perfekt     = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[3].CellValue.Text));
                        string translation = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[4].CellValue.Text));
                        string tip         = GetSharedStringItemById(workbookPart, Convert.ToInt32(curr_row[5].CellValue.Text));

                        KonjugiertesVerb Verb = new KonjugiertesVerb(praesens, praeteritum, perfekt, hilfsverb, translation, tip);

                        VerbenList.Add(Verb);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("The source file is lost or not available. Please try to close the Excel file and restart the application");

                throw;
            }
        }