예제 #1
0
        void Search(string text)
        {
            int tempindex = 0;
            int i         = 0;

            for (i = 0; i < advTree1.Nodes.Count; i++)
            {
                DevComponents.AdvTree.Node item = advTree1.Nodes[i];
                string temp = item.Cells[1].Text + item.Cells[4].TagString + item.Cells[5].Text;
                temp = temp + string.Join("", WinFormAppUtil.Common.PinYinConverterHelp.GetTotalPingYin(temp).FirstPingYin);
                if (temp.Contains(text))
                {
                    if (tempindex >= index && item.Visible)
                    {
                        item.SetSelectedCell(item.Cells[0], DevComponents.AdvTree.eTreeAction.Mouse);
                        index++;
                        break;
                    }
                    else
                    {
                        tempindex++;
                    }
                }
            }
            if (i == advTree1.Nodes.Count)
            {
                index = 0;
            }
        }
예제 #2
0
        private void BatchWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            picLoadingAdvTreeMakeUpBatch.Visible = false;

            // 解凍 畫面 控制項
            ResumeAllLayout();

            // 清除舊項目
            advTreeMakeUpBatch.Nodes.Clear();

            // 清除舊項目
            dataGridViewX1.Rows.Clear();

            string semesterNodeString = _schoolYear + "學年度第" + _semester + "學期";

            DevComponents.AdvTree.Node semesterNode = new DevComponents.AdvTree.Node(semesterNodeString);

            // 父 Node 不可選,也不可拖曳
            semesterNode.Selectable      = false;
            semesterNode.DragDropEnabled = false;


            // 將 補考梯次 子 node 批次 加入  學年度學期父 node
            foreach (UDT_MakeUpBatch batchRecord in _batchList)
            {
                // 封存不出現
                if (!string.IsNullOrWhiteSpace(batchRecord.is_archive))
                {
                    continue;
                }

                string batchNodeString = batchRecord.MakeUp_Batch;

                DevComponents.AdvTree.Node batchNode = new DevComponents.AdvTree.Node(batchNodeString);

                // 補考梯次 子 node 可以選,但也不可拖曳
                batchNode.DragDropEnabled = false;

                // Node 的 Tag 為 補考梯次的系統編號
                batchNode.Tag = batchRecord.UID;

                batchNode.NodeMouseDown += new System.Windows.Forms.MouseEventHandler(NodeMouseDown);

                semesterNode.Nodes.Add(batchNode);
            }

            //  預設將node 展開
            semesterNode.ExpandAll();

            advTreeMakeUpBatch.Nodes.Add(semesterNode);

            FISCA.Presentation.MotherForm.SetStatusBarMessage("取得補考梯次完成");

            //  假如有補考梯次,主動觸發 滑鼠點擊 第一個項目 , 帶出 補考群組
            if (advTreeMakeUpBatch.Nodes.Count > 0)
            {
                if (advTreeMakeUpBatch.Nodes[0].Nodes.Count > 0)
                {
                    DevComponents.AdvTree.Node defaultNode = advTreeMakeUpBatch.Nodes[0].Nodes[0];

                    defaultNode.SetSelectedCell(defaultNode.Cells[0], DevComponents.AdvTree.eTreeAction.Mouse);

                    NodeMouseDown(defaultNode, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                }
            }
        }