Ejemplo n.º 1
0
        /// <summary>
        ///  Создаёт экземпляр элемента управления, отображающего список директив
        /// </summary>
        /// <param name="adType"></param>
        public DefferedListScreen(Operator @operator, ADType adType = ADType.None) : this()
        {
            if (@operator == null)
            {
                throw new ArgumentNullException("@operator");
            }

            var primaryDirectiveType = DirectiveType.DeferredItems;


            CurrentOperator = @operator;
            StatusTitle     = @operator.Name + " " + primaryDirectiveType.CommonName;

            _currentPrimaryDirectiveType = primaryDirectiveType;
            _adType = adType;


            var directiveList = new DefferedListView();

            _filter  = new CommonFilterCollection(typeof(DeferredItem));
            _builder = new DeferredListReportBuilder();

            InitToolStripMenuItems();
            InitPrintToolStripMenuItems();
            InitListView(directiveList);
        }
Ejemplo n.º 2
0
        private void InitListView(DefferedListView directiveListView)
        {
            _directivesViewer                       = directiveListView;
            _directivesViewer.TabIndex              = 2;
            _directivesViewer.Location              = new Point(panel1.Left, panel1.Top);
            _directivesViewer.Dock                  = DockStyle.Fill;
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;
            Controls.Add(_directivesViewer);
            //события
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;

            _directivesViewer.AddMenuItems(_toolStripMenuItemOpen,
                                           _toolStripMenuItemShowADFile,
                                           _toolStripMenuItemShowSBFile,
                                           _toolStripMenuItemShowEOFile,
                                           new RadMenuSeparatorItem(),
                                           _toolStripMenuItemHighlight);

            _directivesViewer.MenuOpeningAction = () =>
            {
                if (_directivesViewer.SelectedItems.Count <= 0)
                {
                    _toolStripMenuItemOpen.Enabled       = false;
                    _toolStripMenuItemShowADFile.Enabled = false;
                    _toolStripMenuItemShowSBFile.Enabled = false;
                    _toolStripMenuItemShowEOFile.Enabled = false;
                    _toolStripMenuItemHighlight.Enabled  = false;
                }

                if (_directivesViewer.SelectedItems.Count == 1)
                {
                    _toolStripMenuItemOpen.Enabled = true;

                    BaseEntityObject  o = _directivesViewer.SelectedItems[0];
                    IBaseEntityObject parent;
                    if (o is NextPerformance)
                    {
                        parent = ((NextPerformance)o).Parent;
                    }
                    else if (o is AbstractPerformanceRecord)
                    {
                        parent = ((AbstractPerformanceRecord)o).Parent;
                    }
                    else
                    {
                        parent = o;
                    }

                    Directive dir = null;
                    if (parent is Directive)
                    {
                        dir = (Directive)parent;
                    }

                    if (dir != null)
                    {
                        _toolStripMenuItemShowEOFile.Enabled = dir.EngineeringOrderFile != null;
                        _toolStripMenuItemShowSBFile.Enabled = dir.ServiceBulletinFile != null;
                        _toolStripMenuItemShowADFile.Enabled = dir.ADNoFile != null;
                    }
                }

                if (_directivesViewer.SelectedItems.Count > 0)
                {
                    _toolStripMenuItemOpen.Enabled      = true;
                    _toolStripMenuItemHighlight.Enabled = true;
                }
            };

            panel1.Controls.Add(_directivesViewer);
        }