Beispiel #1
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();
        }
        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 #3
0
 //open advanced practice mode
 private void iconButtonAdvancedPractice_Click(object sender, EventArgs e)
 {
     textMessage  = "אין תרגול מתקדם בשלב זה";
     myMessageBox = new MyMessageBox(textMessage);
     myMessageBox.ShowDialog();
 }