Beispiel #1
0
 private void iconButtonSimplePractice_Click(object sender, EventArgs e)
 {
     withoutType4 = true;
     dt           = formPractice.Memorization_();
     if (dt != null)
     {
         if (dt.Rows.Count > 0)
         {
             openChildForm(new FormSimplePractice(dt));
             iconButtonSimplePractice.Visible   = false;
             iconButtonAdvancedPractice.Visible = false;
             iconButtonMemorization.Visible     = false;
         }
         else
         {
             textMessage  = "אין מילים לתרגול , רק מילים עם צבע אפשר לתרגל";
             myMessageBox = new MyMessageBox(textMessage);
             myMessageBox.ShowDialog();
         }
     }
     else
     {
         if (formPractice.messagBoxCheak != true)
         {
             textMessage  = "בעיה לא מוכרת בטעינת המילים";
             myMessageBox = new MyMessageBox(textMessage);
             myMessageBox.ShowDialog();
         }
     }
     //iconButtonSimplePractice.Enabled = false;
     //iconButtonAdvancedPractice.Enabled = false;
     //iconButtonMemorization.Enabled = false;
     //withoutType4 = true;
 }
        public DataTable Memorization_()
        {
            messagBoxCheak  = false;
            cheakSelectUnit = false;
            cheakSelectAB   = false;

            //ListViewItem liUnit = new ListViewItem();
            //listViewSelectUnit.Items.Add(liUnit);
            for (int i = 0; i <= 9; i++)
            {
                //listViewSelectUnit.Items[i].BackColor = Color.Red;
                if (listViewSelectUnit.Items[i].BackColor == Color.LightBlue)
                {
                    UnitsG[i]       = true;
                    cheakSelectUnit = true;
                }
                //listViewSelectUnit.Items[i].BackColor = Color.Red;
            }

            for (int k = 0; k <= listViewSelectAB.Items.Count - 1; k++)
            {
                if (listViewSelectAB.Items[k].BackColor == Color.LightBlue)
                {
                    Type_AB[k]    = true;
                    cheakSelectAB = true;
                }
            }

            if (cheakSelectUnit == true && cheakSelectAB == true)
            {
                if (Form1.withoutType4 == true)
                {
                    Table1             = dsq.dataSourceAccByGroupingWordsWithoutSizeAndWithoutType4(UnitsG, Type_AB);
                    Form1.withoutType4 = false;
                    return(Table1);
                }
                else
                {
                    Table1 = dsq.dataSourceAccByGroupingWordsWithoutSize(UnitsG, Type_AB);
                    return(Table1);
                }
            }
            else
            {
                string text = "בחר לפחות יחידה אחת ורמת קושי אחת";
                myMessageBox = new MyMessageBox(text);
                myMessageBox.ShowDialog();
                messagBoxCheak = true;
                //MessageBox.Show("בחר לפחות יחידה אחת ורמת קושי אחת");
                return(null);
            }
            //Form1.withoutType4 = false;
        }
Beispiel #3
0
        private void iconButtonpreviousPage_Click(object sender, EventArgs e)
        {
            if (pageNum > 1) //
            {
                pageNum = pageNum - 1;
                labelTitleCurrentPage.Text = pageNum.ToString();
                tbFilter = dvFilter.ToTable().Rows.Cast <System.Data.DataRow>().Skip((pageNum - 1) * pageSize).Take(pageSize).CopyToDataTable();
                dataGridView1.DataSource = tbFilter;


                dtWordInfo.Clear();
                Word       = tbFilter.Rows[0].ItemArray[voicetext].ToString();
                idWord     = int.Parse(tbFilter.Rows[0].ItemArray[3].ToString());
                dtWordInfo = dsq.dataSourceWordRow(idWord);

                labelWordInEnglish.Text = dtWordInfo.Rows[0].ItemArray[2].ToString();

                ss2Speed.Rate   = -1;
                ss2Speed.Volume = 100;
                ss2Speed.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult);
                //ss.SelectVoice("Microsoft Zira Desktop");

                PromptBuilder builder = new PromptBuilder();
                builder.AppendText(labelWordInEnglish.Text.ToString());
                ss2Speed.SpeakAsync(builder);

                labelWordInHebrew.Text = dtWordInfo.Rows[0].ItemArray[1].ToString();

                if (dtWordInfo.Rows[0].ItemArray[5].ToString() != "")
                {
                    labelExampleSentences.Text = dtWordInfo.Rows[0].ItemArray[5].ToString();
                }

                if (dtWordInfo.Rows[0].ItemArray[4].ToString() != "")
                {
                    labelExampleWords.Text = dtWordInfo.Rows[0].ItemArray[4].ToString(); //
                }
                if (dtWordInfo.Rows[0].ItemArray[8].ToString() != "")                    //note
                {
                    labelNote.Text   = dtWordInfo.Rows[0].ItemArray[8].ToString();
                    textBoxNote.Text = dtWordInfo.Rows[0].ItemArray[8].ToString();
                    textBoxNote.SelectAll();
                    textBoxNote.Focus();
                }
            }
            else
            {
                textForMeesageBox = "אתה במקבץ הראשון";
                myMessageBox      = new MyMessageBox(textForMeesageBox);
                myMessageBox.ShowDialog();
            }
        }
        private void buttonUnfilter_Click(object sender, EventArgs e)
        {
            if (buttonNextWord.Visible == false)
            {
                dtRunTime = dtOrginal;

                labelTheWord.Text = dtRunTime.Rows[0].ItemArray[0].ToString().Replace("  ", string.Empty);
                labelWordHebrew.Text = dtRunTime.Rows[0].ItemArray[1].ToString().Replace("  ", string.Empty);
                colorID = int.Parse(dtRunTime.Rows[0].ItemArray[2].ToString());
                idWord = int.Parse(dtRunTime.Rows[0].ItemArray[3].ToString());
                labelWordsLeft.Text = dtRunTime.Rows.Count.ToString();


                ss.SpeakAsync(labelTheWord.Text.ToString());

                iconButtonKnowing.FlatAppearance.BorderSize = 0;
                iconButtonHalfKnowing.FlatAppearance.BorderSize = 0;
                iconButtonNoKnowing.FlatAppearance.BorderSize = 0;

                switch (colorID)
                {
                    case 1:
                        iconButtonKnowing.FlatAppearance.BorderSize = 2;
                        iconButtonKnowing.FlatAppearance.BorderColor = Color.Red;
                        break;
                    case 2:
                        iconButtonHalfKnowing.FlatAppearance.BorderSize = 2;
                        iconButtonHalfKnowing.FlatAppearance.BorderColor = Color.Red;
                        break;
                    case 3:
                        iconButtonNoKnowing.FlatAppearance.BorderSize = 2;
                        iconButtonNoKnowing.FlatAppearance.BorderColor = Color.Red;
                        break;
                }
                buttonFilter.Enabled = true;
                buttonUnfilter.Enabled = false;
                listViewFilterType.Enabled = true;
                for (int i = 0; i < listViewFilterType.Items.Count; i++)
                {
                    listViewFilterType.Items[i].Checked = true;
                }
            }
            else
            {
                textForMeesageBox = "לחץ קודם על המילה הבאה ";
                myMessageBox = new MyMessageBox(textForMeesageBox);
                myMessageBox.ShowDialog();
            }
        }
Beispiel #5
0
        //open memorization mode
        private void iconButtonMemorization_Click(object sender, EventArgs e)
        {
            //ListView lst = new ListView();
            //formPractice.Memorization_();

            //FormPractice formPractice = new FormPractice();
            //formPractice = FormPractice(currentChildForm);
            //formPractice = currentChildForm;
            ////currentChildForm.
            ////FormPractice formPractice = currentChildForm;

            dt = formPractice.Memorization_();
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    this.iconButtonMemorization.Visible = false;
                    iconButtonSimplePractice.Visible    = false;
                    iconButtonAdvancedPractice.Visible  = false;
                    openChildForm(new FormPracticeMemorization(dt));
                    timer1.Interval = 1;  // need update****
                                          //this.iconButtonMemorization.Enabled = false;
                }
                else
                {
                    textMessage  = "אין מילים ביחידה זו";
                    myMessageBox = new MyMessageBox(textMessage);
                    myMessageBox.ShowDialog();
                }
            }
            else
            {
                if (formPractice.messagBoxCheak != true)
                {
                    textMessage  = "בעיה לא מוכרת בטעינת המילים";
                    myMessageBox = new MyMessageBox(textMessage);
                    myMessageBox.ShowDialog();
                }
                //string =
                //MyMessageBox myMessageBox = new MyMessageBox()
            }
        }
        //PromptBuilder builder = new PromptBuilder();


        private void buttonKnow_Click(object sender, EventArgs e)
        {
            int k = 0;
            userKnowsTheWord = true;
            buttonKnow.Enabled = false;
            buttonDontKnow.Enabled = false;
            //buttonNextWord.Visible = true;
            panelTranslating.Visible = true;

            drDeleteOrginal = dtOrginal.Rows[k];
            drDelete = dtRunTime.Rows[0];
            //int k = 0;
            while(int.Parse(drDelete.ItemArray[3].ToString()) != int.Parse(drDeleteOrginal.ItemArray[3].ToString()))
            {
                k = k + 1;
                drDeleteOrginal = dtOrginal.Rows[k];
            }
            drDeleteOrginal.Delete();
            drDelete.Delete();
            dtRunTime.AcceptChanges();
            dtOrginal.AcceptChanges();

            labelWordsLeft.Text = dtRunTime.Rows.Count.ToString();

            if (dtRunTime.Rows.Count > 0)
            {
                buttonNextWord.Visible = true;
            }
            else
            {
                textForMeesageBox = "סיימת את התרגול ";
                myMessageBox = new MyMessageBox(textForMeesageBox);
                myMessageBox.ShowDialog();
            }
            //dtRunTime.Rows[0].Delete();
            //labelTheWord.Text = dtRunTime.Rows[0].ItemArray[0].ToString().Replace(" ", string.Empty);
            //labelWordHebrew.Text = dtRunTime.Rows[0].ItemArray[1].ToString().Replace(" ", string.Empty);
        }
        private void buttonFilter_Click(object sender, EventArgs e)
        {
            if (buttonNextWord.Visible == false)
            {
                FilterText = "";
                buttonUnfilter.Enabled = true;
                checkSelectedType = CheckSelectedType(listViewFilterType);
                if (checkSelectedType == true) // at least one color is selected for filtering
                {
                    for (int i = 0; i < listViewFilterType.Items.Count; i++)
                    {
                        if (listViewFilterType.Items[i].Checked == true)
                        {
                            FilterText += "WordsType = " + (i + 1).ToString();
                            //TypeGroup[i] = true;
                            FilterText += " OR ";
                        }
                    }
                    FilterText = FilterText.Remove(FilterText.Length - 3, 3);
                    //dtOrginal = dtRunTime;
                    dtRunTime = dtRunTime.Select("" + FilterText).CopyToDataTable();
                    //need to update to first word
                    if (dtRunTime != null && dtRunTime.Rows.Count > 0)
                    {
                        labelTheWord.Text = dtRunTime.Rows[0].ItemArray[0].ToString().Replace("  ", string.Empty);
                        labelWordHebrew.Text = dtRunTime.Rows[0].ItemArray[1].ToString().Replace("  ", string.Empty);
                        colorID = int.Parse(dtRunTime.Rows[0].ItemArray[2].ToString());
                        idWord = int.Parse(dtRunTime.Rows[0].ItemArray[3].ToString());
                        labelWordsLeft.Text = dtRunTime.Rows.Count.ToString();


                        ss.SpeakAsync(labelTheWord.Text.ToString());

                        iconButtonKnowing.FlatAppearance.BorderSize = 0;
                        iconButtonHalfKnowing.FlatAppearance.BorderSize = 0;
                        iconButtonNoKnowing.FlatAppearance.BorderSize = 0;


                        switch (colorID)
                        {
                            case 1:
                                iconButtonKnowing.FlatAppearance.BorderSize = 2;
                                iconButtonKnowing.FlatAppearance.BorderColor = Color.Red;
                                break;
                            case 2:
                                iconButtonHalfKnowing.FlatAppearance.BorderSize = 2;
                                iconButtonHalfKnowing.FlatAppearance.BorderColor = Color.Red;
                                break;
                            case 3:
                                iconButtonNoKnowing.FlatAppearance.BorderSize = 2;
                                iconButtonNoKnowing.FlatAppearance.BorderColor = Color.Red;
                                break;
                        }
                    }
                    else
                    {
                        textForMeesageBox = "אין מילים לתרגול בסינון זה , בחר אחר";
                        myMessageBox = new MyMessageBox(textForMeesageBox);
                        myMessageBox.ShowDialog();
                    }


                }
                else
                {
                    textForMeesageBox = "חובה לבחור לפחות צבע אחד לסינון";
                    myMessageBox = new MyMessageBox(textForMeesageBox);
                    myMessageBox.ShowDialog();
                }
                listViewFilterType.Enabled = false;
                buttonFilter.Enabled = false;
            }
            else
            {
                textForMeesageBox = "לחץ קודם על המילה הבאה ";
                myMessageBox = new MyMessageBox(textForMeesageBox);
                myMessageBox.ShowDialog();
            }
        }
Beispiel #8
0
        private void buttonFilter_Click(object sender, EventArgs e)
        {
            helpBoolForgroup  = false;
            checkSelectedType = CheckSelectedType(listViewFilterType);
            if (checkSelectedType == true) // at least one color is selected for filtering
            {
                FilterText = "";

                for (int i = 0; i < listViewFilterType.Items.Count; i++)
                {
                    if (listViewFilterType.Items[i].Checked == true)
                    {
                        FilterText += "WordsType = " + (i + 1).ToString();
                        //TypeGroup[i] = true;
                        FilterText += " OR ";
                    }
                }
                FilterText = FilterText.Remove(FilterText.Length - 3, 3);

                dvFilter           = new DataView(tb);
                dvFilter.RowFilter = FilterText;

                if (checkBoxTitleSizeGruop.Checked == false) //without group size
                {
                    timer1.Start();
                    //dvFilter = new DataView(tb);
                    //dvFilter.RowFilter = FilterText;
                    dataGridView1.DataSource = dvFilter;
                    panelPage.Visible        = false;
                    helpBoolForgroup         = false;
                }
                else //with group size
                {
                    //dataGridView1.Columns[1].Visible = false; //test
                    //dataGridView1.Columns[2].Visible = false; //word in hebrew
                    //dataGridView1.Columns[0].Visible = false; // speaker button
                    //panelWord.Width = 800;
                    //this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 16);
                    if (labelSizeGrop.Visible == true)
                    {
                        panelPage.Visible          = true;
                        helpBoolForgroup           = true;
                        pageNum                    = 1;
                        labelTitleCurrentPage.Text = pageNum.ToString();
                        timer1.Start();
                        pageSize = int.Parse(labelSizeGrop.Text.ToString());
                        tbFilter = dvFilter.ToTable().Rows.Cast <System.Data.DataRow>().Skip((pageNum - 1) * pageSize).Take(pageSize).CopyToDataTable();
                        //DataTable dtPage = dt.Rows.Cast<System.Data.DataRow>().Skip((pageNum - 1) * pageSize).Take(pageSize).CopyToDataTable();
                        dataGridView1.DataSource = tbFilter;

                        allPageNumber = dvFilter.Count / pageSize;
                        if (dvFilter.Count % pageSize != 0)
                        {
                            allPageNumber = allPageNumber + 1;
                        }
                        labelAllPages.Text = allPageNumber.ToString();

                        dataGridView1.RowTemplate.Height         = 42;
                        this.dataGridView1.DefaultCellStyle.Font = new Font("Tahoma", 20);
                    }
                    else
                    {
                        textForMeesageBox = "להצגת מקבץ חובה לבחור גודל מקבץ";
                        myMessageBox      = new MyMessageBox(textForMeesageBox);
                        myMessageBox.ShowDialog();
                    }
                }
            }
            else
            {
                textForMeesageBox = "בחר לפחות צבע אחד לסינון";
                myMessageBox      = new MyMessageBox(textForMeesageBox);
                myMessageBox.ShowDialog();
            }

            //timer1.Start();
        }
Beispiel #9
0
 //open advanced practice mode
 private void iconButtonAdvancedPractice_Click(object sender, EventArgs e)
 {
     textMessage  = "אין תרגול מתקדם בשלב זה";
     myMessageBox = new MyMessageBox(textMessage);
     myMessageBox.ShowDialog();
 }