Пример #1
0
        public void UpdateDataPoolRow()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(UpdateDataPoolRow));
                return;
            }
            if (null == _methodFlow)
            {
                return;
            }
            int           mtdCount       = _methodFlow.Count;
            List <string> ExistOutputIDs = new List <string>();

            dgvDataPool.Rows.Clear();
            for (int i = 0; i < mtdCount; i++)
            {
                JFMethodFlow.MethodItem mi = _methodFlow.GetItem(i);
                ///获取各Method对象的实时界面
                IJFMethod mtd = mi.Value;
                ///更新数据池列表(内部)
                string[] outputNames = mi.Value.MethodOutputNames;
                if (null != outputNames)
                {
                    foreach (string outname in outputNames)
                    {
                        DataGridViewRow         row      = new DataGridViewRow();
                        DataGridViewTextBoxCell cellName = new DataGridViewTextBoxCell();
                        string outputID = mi.OutputID(outname);
                        cellName.Value = outputID;
                        ExistOutputIDs.Add(outputID);
                        row.Cells.Add(cellName);
                        DataGridViewTextBoxCell cellValue = new DataGridViewTextBoxCell();
                        row.Cells.Add(cellValue);
                        dgvDataPool.Rows.Add(row);
                    }
                }
            }
            dgvOutterDataPool.Rows.Clear();
            ///跟新外部数据池
            string[] OutterAvailedDataIDs = _methodFlow.OutterAvailedIDs;
            if (null != OutterAvailedDataIDs)
            {
                foreach (string dataID in OutterAvailedDataIDs)
                {
                    DataGridViewRow         row      = new DataGridViewRow();
                    DataGridViewTextBoxCell cellName = new DataGridViewTextBoxCell();
                    cellName.Value = dataID;
                    ExistOutputIDs.Add(dataID);
                    row.Cells.Add(cellName);
                    DataGridViewTextBoxCell cellValue = new DataGridViewTextBoxCell();
                    row.Cells.Add(cellValue);
                    dgvOutterDataPool.Rows.Add(row);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 更新动作流面板和数据池面板
        /// </summary>
        public void UpdateFlow2UI()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(UpdateFlow2UI));
                return;
            }
            pnFlow.Controls.Clear();
            dgvDataPool.Rows.Clear();
            dgvOutterDataPool.Rows.Clear();
            _lstBtDel.Clear();
            _lstBtAct.Clear();
            _lstRtUi.Clear();
            if (null == _methodFlow)
            {
                return;
            }
            int           mtdCount       = _methodFlow.Count;
            List <string> ExistOutputIDs = new List <string>();
            //for (int i = 0; i < mtdCount; i++)
            //    ExistOutputIDs.AddRange(_methodFlow.GetItem(i).OutputNameIDs.Values);

            int locX = 0, locY = 3;

            for (int i = 0; i < mtdCount; i++)
            {
                JFMethodFlow.MethodItem mi = _methodFlow.GetItem(i);
                ///获取各Method对象的实时界面
                IJFMethod mtd = mi.Value;
                if (mtd is IJFRealtimeUIProvider)
                {
                    _lstRtUi.Add((mtd as IJFRealtimeUIProvider).GetRealtimeUI());
                }
                else
                {
                    _lstRtUi.Add(null);
                }


                Label lbMiName = new Label(); //动作单元名称
                lbMiName.Text     = i + ":" + mi.Name;
                lbMiName.Location = new Point(locX, locY + 3);
                pnFlow.Controls.Add(lbMiName);
                Button btDel = new Button();

                Button btAct = new Button();
                btAct.Text     = "执行";
                btAct.Width    = 37;
                btAct.Location = new Point(270 - btAct.Width, locY);//270为UcMethodNode对象的宽度
                btAct.Click   += OnButtonClick_MethodItemAction;
                _lstBtAct.Add(btAct);
                pnFlow.Controls.Add(btAct);

                btDel.Text     = "删除";
                btDel.Width    = 37;
                btDel.Location = new Point(btAct.Left - btDel.Width - 10, locY);//270为UcMethodNode对象的宽度
                btDel.Click   += OnButtonClick_DelMethodItem;
                _lstBtDel.Add(btDel);
                pnFlow.Controls.Add(btDel);


                locY = btDel.Bottom + 2;
                UcMethodNode mn = new UcMethodNode();
                mn.SetMethodItem(mi);
                mn.EventShowInfo += ShowMethodItemInfo;
                mn.Location       = new Point(locX, locY);
                pnFlow.Controls.Add(mn);
                mn.UpdateAvailableIDs(_methodFlow.UnexportIDs);//(mi.AvailedInputIDs/*allOutputID.ToArray()*/);
                locY = mn.Bottom + 2;

                ///更新数据池列表(内部)
                string[] outputNames = mi.Value.MethodOutputNames;
                if (null != outputNames)
                {
                    foreach (string outname in outputNames)
                    {
                        DataGridViewRow         row      = new DataGridViewRow();
                        DataGridViewTextBoxCell cellName = new DataGridViewTextBoxCell();
                        string outputID = mi.OutputID(outname);
                        cellName.Value = outputID;
                        ExistOutputIDs.Add(outputID);
                        row.Cells.Add(cellName);
                        DataGridViewTextBoxCell cellValue = new DataGridViewTextBoxCell();
                        row.Cells.Add(cellValue);
                        dgvDataPool.Rows.Add(row);
                    }
                }
            }
            foreach (string key in _methodFlow.DataPool.Keys) //更新数据池中的其他变量(不是算子的输出)
            {
                if (!ExistOutputIDs.Contains(key))
                {
                    DataGridViewRow         row      = new DataGridViewRow();
                    DataGridViewTextBoxCell cellName = new DataGridViewTextBoxCell();

                    cellName.Value = key;
                    ExistOutputIDs.Add(key);
                    row.Cells.Add(cellName);
                    DataGridViewTextBoxCell cellValue = new DataGridViewTextBoxCell();
                    row.Cells.Add(cellValue);
                    dgvDataPool.Rows.Add(row);
                }
            }
            ///跟新外部数据池
            string[] OutterAvailedDataIDs = _methodFlow.OutterAvailedIDs;
            if (null != OutterAvailedDataIDs)
            {
                foreach (string dataID in OutterAvailedDataIDs)
                {
                    DataGridViewRow         row      = new DataGridViewRow();
                    DataGridViewTextBoxCell cellName = new DataGridViewTextBoxCell();
                    cellName.Value = dataID;
                    ExistOutputIDs.Add(dataID);
                    row.Cells.Add(cellName);
                    DataGridViewTextBoxCell cellValue = new DataGridViewTextBoxCell();
                    row.Cells.Add(cellValue);
                    dgvOutterDataPool.Rows.Add(row);
                }
            }


            UpdatePoolValues();
        }