Esempio n. 1
0
        private void 全部最小值ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            backgroundWorker2.RunWorkerAsync(new FunctionBag {
                Items = version.Pages[PageIndex].Items, Value = "min"
            });

            WaitBox.Wait();//对话框中断等待
        }
Esempio n. 2
0
        private void 刷新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            backgroundWorker1.RunWorkerAsync(new FunctionBag {
                Items = version.Pages[PageIndex].Items, IsReload = true
            });

            WaitBox.Wait();//对话框中断等待
        }
Esempio n. 3
0
 private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     //异步写完内存读取行
     WFlag = WFlag_Busy;
     LoadItems((List <DataGridViewRow>)e.Result);
     WFlag = WFlag_Free;
     //关闭读取框
     WaitBox.Close();
 }
Esempio n. 4
0
        private void 全部设定值ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string value = Microsoft.VisualBasic.Interaction.InputBox("输入设定值");

            if (value != "")
            {
                backgroundWorker2.RunWorkerAsync(new FunctionBag {
                    Items = version.Pages[PageIndex].Items, Value = value
                });

                WaitBox.Wait();//对话框中断等待
            }
        }
Esempio n. 5
0
        private void tabControl_Selected(object sender, TabControlEventArgs e)
        {
            if (e.TabPageIndex > 0)
            {
                tabControl.SelectedTab.Controls.Add(gridView);

                WFlag = WFlag_Busy;
                backgroundWorker1.RunWorkerAsync(new FunctionBag {
                    Items = version.Pages[PageIndex].Items, IsReload = false
                });

                WaitBox.Wait();//对话框中断等待
                WFlag = WFlag_Free;
            }
        }
Esempio n. 6
0
        private void gridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (WFlag == WFlag_Free)
            {
                int rowIndex    = e.RowIndex;
                int columnIndex = e.ColumnIndex;

                if (rowIndex >= 0 && columnIndex == 1)
                {
                    FunctionItem    item       = version.Pages[PageIndex].Items[rowIndex];
                    DataGridViewRow currentRow = gridView.Rows[rowIndex];
                    string          errorText  = "";


                    WFlag = WFlag_Busy;
                    if (item.FormStyle == "文本框")
                    {
                        string value = "0";
                        if (currentRow.Cells["value"].Value != null)
                        {
                            value = currentRow.Cells["value"].Value.ToString();
                        }

                        item.Write(value);
                        errorText = item.GetErrorText();
                    }
                    else if (item.FormStyle == "下拉列表")
                    {
                        string str = currentRow.Cells["value"].Value.ToString();
                        int    key = item.ValueStringMap.GetKey(str);

                        if (key != -1)
                        {
                            item.Write(key.ToString());
                        }

                        errorText = item.GetErrorText();
                    }
                    else if (item.FormStyle == "单选框")
                    {
                        string value = currentRow.Cells["value"].Value.ToString();
                        if (value.ToLower() == "true")
                        {
                            item.Write("1");
                        }
                        else if (value.ToLower() == "false")
                        {
                            item.Write("0");
                        }
                        errorText = item.GetErrorText();
                    }

                    //每次修改数据就刷新列表
                    backgroundWorker1.RunWorkerAsync(new FunctionBag {
                        Items = version.Pages[PageIndex].Items, IsReload = true
                    });

                    WaitBox.Wait();//对话框中断等待
                    WFlag = WFlag_Free;

                    gridView.Rows[rowIndex].Cells[2].Value = errorText;
                }
            }
        }