Exemple #1
0
        private void InitListView()
        {
            _directivesViewer = new LDNDListView
            {
                TabIndex = 2,
                Location = new Point(panel1.Left, panel1.Top),
                Dock     = DockStyle.Fill
            };
            //события
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;

            _directivesViewer.AddMenuItems(_toolStripMenuItemShowTaskCard,
                                           new RadMenuSeparatorItem(),
                                           _createWorkPakageToolStripMenuItem,
                                           _toolStripMenuItemsWorkPackages);

            panel1.Controls.Add(_directivesViewer);
        }
Exemple #2
0
        private void InitListView()
        {
            _directivesViewer = new LDNDListView
            {
                TabIndex = 2,
                Location = new Point(panel1.Left, panel1.Top),
                Dock     = DockStyle.Fill
            };
            //события
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;

            _directivesViewer.AddMenuItems(_toolStripMenuItemShowTaskCard,
                                           _toolStripMenuItemsWShowWP,
                                           new RadMenuSeparatorItem(),
                                           _createWorkPakageToolStripMenuItem,
                                           _toolStripMenuItemsWorkPackages);

            _directivesViewer.MenuOpeningAction = () =>
            {
                _toolStripMenuItemShowTaskCard.Enabled = false;
                _toolStripMenuItemsWShowWP.Enabled     = false;
                if (_directivesViewer.SelectedItems[0].Parent is MaintenanceDirective)
                {
                    if (_directivesViewer.SelectedItems.Count == 1)
                    {
                        var mpd = (MaintenanceDirective)_directivesViewer.SelectedItems[0].Parent;
                        _toolStripMenuItemShowTaskCard.Enabled = mpd?.TaskCardNumberFile != null;
                        if (mpd.NextPerformanceIsBlocked)
                        {
                            _toolStripMenuItemsWShowWP.Enabled = true;
                        }
                    }
                }

                if (_directivesViewer.SelectedItems[0].Parent is ComponentDirective)
                {
                    if (_directivesViewer.SelectedItems.Count == 1)
                    {
                        var mpd = (ComponentDirective)_directivesViewer.SelectedItems[0].Parent;
                        _toolStripMenuItemShowTaskCard.Enabled = mpd?.MaintenanceDirective?.TaskCardNumberFile != null;
                        if (mpd.NextPerformanceIsBlocked)
                        {
                            _toolStripMenuItemsWShowWP.Enabled = true;
                        }
                    }
                }

                if (_directivesViewer.SelectedItems[0].Parent is Directive)
                {
                    if (_directivesViewer.SelectedItems.Count == 1)
                    {
                        var directive = (Directive)_directivesViewer.SelectedItems[0].Parent;
                        if (directive.NextPerformanceIsBlocked)
                        {
                            _toolStripMenuItemsWShowWP.Enabled = true;
                        }
                        AttachedFile file;
                        //if (directive.DirectiveType == DirectiveType.SB)
                        //file = directive.ServiceBulletinFile;
                        //else if (directive.DirectiveType == DirectiveType.EngineeringOrders)
                        file = directive.EngineeringOrderFile;
                        //else file = directive.ADNoFile;

                        _toolStripMenuItemShowTaskCard.Enabled = file != null;
                    }
                }
            };


            panel1.Controls.Add(_directivesViewer);
        }