Пример #1
0
        public ReconfigForm(DynamicTopo dTopo, List <List <DynamicNode> > strategyList, List <Boolean>[] slotOnLineFlags)
        {
            //初始化成员变量
            _dTopo           = dTopo;
            _slotOnLineFlags = slotOnLineFlags;
            _strategyList    = strategyList;
            ChoosedIndex     = -1;

            InitializeComponent();
            InitBaseListViews();
            InitStrategyLv();
            this.StartPosition = FormStartPosition.CenterParent;


            //事件处理函数
            this._yesBtn.Click    += new EventHandler(On_yesBtnClick);
            this._cancelBtn.Click += new EventHandler((o, e) => { this.DialogResult = DialogResult.Cancel; });
            this._strategyLv.SelectedIndexChanged += new EventHandler(On_strategyLvSelectedIndexChanged);
        }
Пример #2
0
        public const int ViewMargin = 100;//边距100

        public ShowViewPanel(TreeNode node)
        {
            //初始化成员变量
            this.DoubleBuffered = true;//重绘双缓冲开启,防止界面闪烁
            base.AutoScroll     = true;
            _treeNode           = node;
            NodeInfo info = (NodeInfo)node.Tag;

            FormType    = info._formType;
            ZoomFactor  = 1;
            _viewOffset = new PointF();

            switch (FormType)
            {
            case Princeple.FormType.PPC:
                PPC ppc = ModelFactory <PPC> .CreateByName(node.Text);

                ShowView = new PPCViewModel(ppc);
                break;

            case Princeple.FormType.FPGA:
                FPGA fpga = ModelFactory <FPGA> .CreateByName(node.Text);

                ShowView = new FPGAViewModel(fpga);
                break;

            case Princeple.FormType.ZYNQ:
                ZYNQ zynq = ModelFactory <ZYNQ> .CreateByName(node.Text);

                ShowView = new ZYNQViewModel(zynq);
                break;

            case Princeple.FormType.BOARD:
                Board board = ModelFactory <Board> .CreateByName(node.Text);

                ShowView = new BoardViewModel(board);
                break;

            case Princeple.FormType.BACKPLANE:
                BackPlane bp = ModelFactory <BackPlane> .CreateByName(node.Text);

                ShowView = new BackPlaneViewModel(bp);
                break;

            case Princeple.FormType.CONTIANER:
                Container ctn = ModelFactory <Container> .CreateByName(node.Text);

                ShowView = new ContainerViewModel(ctn);
                break;

            case Princeple.FormType.COMPONENT:
                Component cmp = ModelFactory <Component> .CreateByName(node.Text);

                ShowView = new ComponentViewModel(cmp);
                break;

            case Princeple.FormType.SYSTEM:
                SystemStru sys = ModelFactory <SystemStru> .CreateByName(node.Text);

                ShowView = new SystemStruViewModel(sys);
                break;

            case Princeple.FormType.TOPO:
                var        sysName = node.Text.Substring(node.Text.IndexOf(':') + 1);
                SystemStru sys2    = ModelFactory <SystemStru> .CreateByName(sysName);

                ShowView = new StaticTopo(sys2);
                break;

            case Princeple.FormType.APP:
                var        sysNode  = node.Parent.Nodes[0];
                var        sysSName = sysNode.Text.Substring(sysNode.Text.IndexOf(':') + 1);
                SystemStru sys3     = ModelFactory <SystemStru> .CreateByName(sysSName);

                var sysStatic = new StaticTopo(sys3);

                ShowView = new DynamicTopo(sysStatic);
                ((DynamicTopo)ShowView).Components = (GetNodeCmps(node));
                break;

            case Princeple.FormType.STATUS:
                ShowView = new Status();
                break;

            default:    //无对应界面类型退出
                return;
            }
            SetViewSize();

            //绑定界面点击事件的处理
            if (ShowView as IDrawerChoosed != null)
            {
                this.MouseClick += new MouseEventHandler(((IDrawerChoosed)ShowView).MouseEventHandler);
            }
            if (ShowView as IDrawerNotify != null)
            {
                info.NodeInfoChanged += new Action <TargetNode>(((IDrawerNotify)ShowView).OnNodeInfoChanged);
            }
            ShowView.RedrawRequst += new Action(OnShowViewRedrawRequst);
            this.Scroll           += new ScrollEventHandler(ShowViewPanel_Scroll);
            this.MouseWheel       += new MouseEventHandler(ShowViewPanel_MouseWheel);
        }