Ejemplo n.º 1
0
        async public void GetData()
        {
            try
            {
                btnDown.Enabled = btnLogin.Enabled = btnUp.Enabled = btnAcout.Enabled = false;
                ParseQuery <ParseObject> query = ParseObject.GetQuery("History");
                query = query.Limit(1000);

                //query = query.Skip();
                //query.WhereEqualTo("User", "tri");
                query = query.WhereEqualTo("User", ParseUser.CurrentUser.Username);
                IEnumerable <ParseObject> result = await query.FindAsync();

                Form1.dataGridView1.Rows.Clear();
                string PhienAm = "♥";
                bool   Check   = false;
                for (int i = 0; i <= result.Count <ParseObject>(); i++)
                {
                    string Voca = result.ElementAt <ParseObject>(i).Get <string>("Voca");
                    string Mean = result.ElementAt <ParseObject>(i).Get <string>("Mean");
                    try {
                        PhienAm = result.ElementAt <ParseObject>(i).Get <string>("DauNhan");
                    }
                    catch
                    {
                    }
                    try {
                        Check = result.ElementAt <ParseObject>(i).Get <bool>("Check");
                    }
                    catch
                    {
                    }
                    int Stt = result.ElementAt <ParseObject>(i).Get <int>("STT");
                    data.Write(ref Form1.dataGridView1, Voca, Mean, PhienAm, Check, Stt);
                }
                int a = result.Count <ParseObject>();
            }
            catch
            {
            }
            btnDown.Enabled = btnLogin.Enabled = btnUp.Enabled = btnAcout.Enabled = true;
            Form1.dataGridView1.Sort(Form1.dataGridView1.Columns[0], ListSortDirection.Descending);
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     // bool checkTrung = false;
     Data.Write(ref dataGridView1, textBox1.Text.Replace("\t", "").Replace("\r\n", "").Replace("\n", ""), textBox1.Text.Replace("\t", "").Replace("\r\n", "").Replace("\n", ""));
     dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Descending);
 }
Ejemplo n.º 3
0
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            this.textBox1.Focus();
            if (m_Voca == "" || m_Mean == "No data or error")
            {
                return;
            }
            // Lọc ra dòng cuối cùng để nạp vào lịch sử tra từ
            string adHisMean = m_Mean;
            int    checkMean = m_Mean.IndexOf(m_Voca.ToLower().Trim());

            if (NganhGi != "Thông Dụng" || checkMean == 0)
            {
                int isBING = m_Mean.IndexOf("\r\n");
                if (isBING != -1)
                {
                    string istempCut = adHisMean;
                    adHisMean = (m_Mean.Substring(isBING + 2));

                    if (adHisMean == "")
                    {
                        adHisMean = istempCut;
                    }
                    else
                    {
                        try
                        {
                            istempCut = adHisMean;
                            if (adHisMean.IndexOf("\r\n") != -1)
                            {
                                adHisMean = adHisMean.Substring(adHisMean.IndexOf("\r\n") + 2);
                                if (adHisMean == "")
                                {
                                    adHisMean = istempCut;
                                }
                                if (adHisMean.IndexOf("\r\n") != -1)
                                {
                                    adHisMean = adHisMean.Substring(0, adHisMean.IndexOf("\r\n") + 2);
                                }
                            }
                            else
                            {
                                adHisMean = istempCut;
                            }
                        }
                        catch
                        {
                            adHisMean = istempCut;
                        }
                    }
                }
                adHisMean = adHisMean.Replace("\r\n", "");
                Data.Write(ref Form1.dataGridView1, m_Voca, adHisMean.Replace("\t", "").Replace("\r\n", "").Replace("\n", ""));
                textBox1.Text = "";
                this.textBox1.Focus();
            }
            else if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() && NganhGi == "Thông Dụng")
            {
                m_Mean = m_Mean.Replace("Danh từ\r\n", "[n] ");
                m_Mean = m_Mean.Replace("Trạng từ\r\n", "[adv] ");
                m_Mean = m_Mean.Replace("Tính từ\r\n", "[adj] ");
                m_Mean = m_Mean.Replace("Động từ\r\n", "[v] ");
                m_Mean = m_Mean.Replace("\r\n", " ");
                Data.Write(ref Form1.dataGridView1, m_Voca, m_Mean.Replace('\t', ' '));
                textBox1.Text = "";
                this.textBox1.Focus();
            }
            else
            {
                int isBING = m_Mean.IndexOf("\r\n");
                if (isBING != -1)
                {
                    string istempCut = adHisMean;
                    adHisMean = (m_Mean.Substring(isBING + 2));

                    if (adHisMean == "")
                    {
                        adHisMean = istempCut;
                    }
                    else
                    {
                        try
                        {
                            istempCut = adHisMean;
                            if (adHisMean.IndexOf("\r\n") != -1)
                            {
                                adHisMean = adHisMean.Substring(adHisMean.IndexOf("\r\n") + 2);
                                if (adHisMean == "")
                                {
                                    adHisMean = istempCut;
                                }
                                if (adHisMean.IndexOf("\r\n") != -1)
                                {
                                    adHisMean = adHisMean.Substring(0, adHisMean.IndexOf("\r\n") + 2);
                                }
                            }
                            else
                            {
                                adHisMean = istempCut;
                            }
                        }
                        catch
                        {
                            adHisMean = istempCut;
                        }
                    }
                }
                adHisMean = adHisMean.Replace("\r\n", "");
                Data.Write(ref Form1.dataGridView1, m_Voca.Replace("\t", ""), adHisMean.Replace("\t", ""));
                textBox1.Text = "";
                this.textBox1.Focus();
            }
            this.textBox1.Focus();
        }