예제 #1
0
        public void Init()
        {
            if (_tmrUpdateList != null)
            {
                _tmrUpdateList.Elapsed -= TmrUpdateLayoutElapsed;
                _tmrUpdateList.Stop();
                _tmrUpdateList.Dispose();
                _tmrUpdateList = null;
            }

            _maxItems = 36;

            Text      = Cg.name;
            _controls = new List <GridViewConfig>();
            switch (Cg.ModeIndex)
            {
            case 0:

                _cols = Cg.Columns;
                _rows = Cg.Rows;

                _maxItems = _cols * _rows;
                ClearControls();
                AddItems();
                break;

            case 1:
            case 2:
                _cols = _rows = 1;

                if (!string.IsNullOrEmpty(Cg.ModeConfig))
                {
                    //add default camera
                    string[] cfg = Cg.ModeConfig.Split(',');
                    if (cfg.Length > 1)
                    {
                        if (cfg[1] != "")
                        {
                            var gvi = new GridViewItem("", Convert.ToInt32(cfg[1]), 2, this);
                            _controls[0] =
                                new GridViewConfig(
                                    new List <GridViewItem> {
                                gvi
                            }, 1000)
                            {
                                Hold = true
                            };
                        }
                        if (cfg.Length > 2)
                        {
                            _maxItems = Convert.ToInt32(cfg[2]);
                        }
                    }
                }
                ClearControls();
                _tmrUpdateList          = new Timer(1000);
                _tmrUpdateList.Elapsed += TmrUpdateLayoutElapsed;
                _tmrUpdateList.Start();
                break;
            }
        }
예제 #2
0
        public void Init()
        {
            if (_tmrUpdateList != null)
            {
                _tmrUpdateList.Elapsed -= TmrUpdateLayoutElapsed;
                _tmrUpdateList.Stop();
                _tmrUpdateList.Dispose();
                _tmrUpdateList = null;
            }

            _maxItems = 36;

            Text = Cg.name;
            _controls = new List<GridViewConfig>();
            switch (Cg.ModeIndex)
            {
                case 0:

                    _cols = Cg.Columns;
                    _rows = Cg.Rows;

                    _maxItems = _cols*_rows;
                    ClearControls();
                    AddItems();
                    break;
                case 1:
                case 2:
                    _cols = _rows = 1;

                    if (!String.IsNullOrEmpty(Cg.ModeConfig))
                    {
                        //add default camera
                        string[] cfg = Cg.ModeConfig.Split(',');
                        if (cfg.Length > 1)
                        {
                            if (cfg[1] != "")
                            {
                                var gvi = new GridViewItem("", Convert.ToInt32(cfg[1]), 2, this);
                                _controls[0] =
                                    new GridViewConfig(
                                        new List<GridViewItem> { gvi  }, 1000) {Hold = true};
                            }
                            if (cfg.Length > 2)
                            {
                                _maxItems = Convert.ToInt32(cfg[2]);
                            }
                        }

                    }
                    ClearControls();
                    _tmrUpdateList = new Timer(1000);
                    _tmrUpdateList.Elapsed += TmrUpdateLayoutElapsed;
                    _tmrUpdateList.Start();
                    break;
            }

            Program.AppIdle.ApplicationLoopDoWork += HandlerApplicationLoopDoWork;
        }