Example #1
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            int runFlag = 1;

            if (SearchBox.Text == "")
            {
                ClassBackEnd.Book.Clear();
                nPage = 1;
                DataSheetLoad(1);
                return;
            }
            NoResultTextBox.Hide();
            AddBookButton.Hide();
            ResultDataSheet.Rows.Clear();
            lastState  = ButtonState;
            lastString = SearchBox.Text;
            LoadGIFBox.Show();
            if (SearchWorker.IsBusy)
            {
                runFlag = 0;
                SearchWorker.CancelAsync();
            }
            if (runFlag != 0)
            {
                SearchWorker.RunWorkerAsync();
            }
        }
        private void DataSheetLoad(int page)
        {
            ResultDataSheet.Rows.Clear();
            ResultDataSheet.Hide();
            int start = (nPage - 1) * 10;
            int end   = nPage * 10;

            if (nPage == maxPage)
            {
                end = ClassBackEnd.Book.Count;
            }

            for (int i = start; i < end; i++)
            {
                var             c     = ClassBackEnd.Book[i];
                DataGridViewRow row   = (DataGridViewRow)ResultDataSheet.RowTemplate.Clone();
                int             index = ResultDataSheet.Rows.Add(row);
                ResultDataSheet.Rows[index].Cells[0].Value = c.Bookisbn;
                ResultDataSheet.Rows[index].Cells[1].Value = c.Bookname;
                ResultDataSheet.Rows[index].Cells[2].Value = c.Author;
                ResultDataSheet.Rows[index].Cells[3].Value = c.Publisher;
                ResultDataSheet.Rows[index].Cells[4].Value = "详情";
            }
            LoadGIFBox.Hide();
            ResultDataSheet.Show();
            ResultDataSheet.ClearSelection();
            ResultDataSheet.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
        }
Example #3
0
        private void DataSheetLoad(int page)
        {
            ResultDataSheet.Rows.Clear();
            ResultDataSheet.Hide();
            if (ClassBackEnd.Book.Count == 0)
            {
                LoadGIFBox.Hide();
                NoResultTextBox.Show();
                AddBookButton.Show();
                NextPbutton.Hide();
                LastPButton.Hide();
                JumpPTextBox.Hide();
                PageTextBox.Hide();
                DividePicture.Hide();
                return;
            }
            else
            {
                NoResultTextBox.Hide();
                AddBookButton.Hide();
                NextPbutton.Show();
                LastPButton.Show();
                JumpPTextBox.Show();
                PageTextBox.Show();
                DividePicture.Show();
            }
            int start = (nPage - 1) * 10;
            int end   = nPage * 10;

            if (nPage == maxPage)
            {
                end = ClassBackEnd.Book.Count;
            }

            for (int i = start; i < end; i++)
            {
                var             c     = ClassBackEnd.Book[i];
                DataGridViewRow row   = (DataGridViewRow)ResultDataSheet.RowTemplate.Clone();
                int             index = ResultDataSheet.Rows.Add(row);
                ResultDataSheet.Rows[index].Cells[0].Value = c.Bookisbn;
                ResultDataSheet.Rows[index].Cells[1].Value = c.Bookname;
                ResultDataSheet.Rows[index].Cells[2].Value = c.Author;
                ResultDataSheet.Rows[index].Cells[3].Value = c.Publisher;
                ResultDataSheet.Rows[index].Cells[4].Value = "详情";
            }
            LoadGIFBox.Hide();
            ResultDataSheet.Show();
            ResultDataSheet.ClearSelection();
            ResultDataSheet.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            JumpPTextBox.Text = nPage.ToString();
            PageTextBox.Text  = maxPage.ToString();
        }
        private void SearchButton_Click(object sender, EventArgs e)
        {
            int runFlag = 1;

            ResultDataSheet.Rows.Clear();
            lastState  = ButtonState;
            lastString = SearchBox.Text;
            LoadGIFBox.Show();
            if (SearchWorker.IsBusy)
            {
                runFlag = 0;
                SearchWorker.CancelAsync();
            }
            if (runFlag != 0)
            {
                SearchWorker.RunWorkerAsync();
            }
        }