///<summary>
        /// —оздаетс¤ элемент отображени¤ добавлени¤ агрегата
        ///</summary>
        /// <param name="parentDetail">Ѕазовый агрегат дл¤ которго добавл¤етс¤ агрегат</param>
        public DetailAddingScreen(IDetailContainer parentDetail)
        {
            if (parentDetail == null)
            {
                throw new ArgumentNullException("parentDetail");
            }
            if (parentDetail is BaseDetail)
            {
                parentBaseDetail = (BaseDetail)parentDetail;
            }
            else if (parentDetail is Aircraft)
            {
                parentBaseDetail = ((Aircraft)parentDetail).AircraftFrame;
            }
            else
            {
                parentBaseDetail = ((Store)parentDetail).AircraftFrame;
            }
            if (parentDetail is Aircraft)
            {
                isStore = ((Aircraft)parentDetail).Type == AircraftType.Store;
            }

            headerControl  = new HeaderControl();
            aircraftHeader = new AircraftHeaderControl();
            if (parentDetail is Aircraft)
            {
                aircraftHeader.Aircraft = parentDetail as Aircraft;
            }
            if (parentDetail is BaseDetail)
            {
                aircraftHeader.Aircraft = (parentDetail as BaseDetail).ParentAircraft;
            }
            aircraftHeader.AircraftClickable = true;
            aircraftHeader.OperatorClickable = true;
            footerControl = new FooterControl();
            mainPanel     = new Panel();
//            panelFooterMenu = new Panel();

            addnewcomponentControl           = new AddNewComponentControl(parentBaseDetail);
            generalInformationControl        = new DetailAddingGeneralInformationControl(parentBaseDetail.ParentAircraft);
            compliancePerformanceListControl = new DetailCompliancePerformanceListControl(parentBaseDetail.ParentAircraft);
            warrantyControl = new DetailWarrantyControl();
            if (isStore)
            {
                storeControl = new DetailStoreControl((Aircraft)parentDetail);
            }

            addNewComponentContainer       = new ExtendableRichContainer();
            generalInformationContainer    = new ExtendableRichContainer();
            compliancePerformanceContainer = new ExtendableRichContainer();
            warrantyContainer = new ExtendableRichContainer();
            storeContainer    = new ExtendableRichContainer();
            //
            // headerControl
            //
            headerControl.Controls.Add(aircraftHeader);
            headerControl.TabIndex                       = 0;
            headerControl.ButtonReload.Icon              = icons.SaveAndAdd;
            headerControl.ButtonReload.IconNotEnabled    = icons.SaveAndAddGray;
            headerControl.ButtonReload.IconLayout        = ImageLayout.Center;
            headerControl.ButtonReload.TextMain          = "Save and";
            headerControl.ButtonReload.TextSecondary     = "add another";
            headerControl.ButtonReload.Click            += buttonSaveAndAdd_Click;
            headerControl.ButtonEdit.Icon                = icons.Save;
            headerControl.ButtonEdit.IconNotEnabled      = icons.SaveGray;
            headerControl.ButtonEdit.IconLayout          = ImageLayout.Center;
            headerControl.ButtonEdit.ReflectionType      = ReflectionTypes.DisplayInCurrent;
            headerControl.ButtonEdit.TextMain            = "Save";
            headerControl.ButtonEdit.TextSecondary       = "and Edit";
            headerControl.ButtonEdit.DisplayerRequested += buttonSaveAndEdit_DisplayerRequested;

            aircraftHeader.AircraftClickable = true;
            footerControl.TabIndex           = 2;
            //
            // mainPanel
            //
            mainPanel.Dock       = DockStyle.Fill;
            mainPanel.AutoScroll = true;
            mainPanel.TabIndex   = 1;
            //
            // addNewComponentContainer
            //
            addNewComponentContainer.labelCaption.Margin   = new Padding(3, 20, 3, 3);
            addNewComponentContainer.PictureBoxIcon.Margin = new Padding(3, 20, 3, 3);
            addNewComponentContainer.Dock          = DockStyle.Top;
            addNewComponentContainer.UpperLeftIcon = icons.GrayArrow;
            addNewComponentContainer.Caption       = "Base component";
            addNewComponentContainer.MainControl   = addnewcomponentControl;
            addNewComponentContainer.TabIndex      = 0;
            addnewcomponentControl.BaseDetailAddTo = parentBaseDetail;
            //
            // generalInformationContainer
            //
            generalInformationContainer.Dock          = DockStyle.Top;
            generalInformationContainer.UpperLeftIcon = icons.GrayArrow;
            generalInformationContainer.Caption       = "Component general information";
            generalInformationContainer.MainControl   = generalInformationControl;
            generalInformationContainer.TabIndex      = 1;
            //
            // compliancePerformanceContainer
            //
            compliancePerformanceContainer.Dock          = DockStyle.Top;
            compliancePerformanceContainer.UpperLeftIcon = icons.GrayArrow;
            compliancePerformanceContainer.Caption       = "Compliance/Performance";
            compliancePerformanceContainer.MainControl   = compliancePerformanceListControl;
            //compliancePerformanceContainer.Extended = false;
            compliancePerformanceContainer.TabIndex = 2;
            //
            // warrantyContainer
            //
            warrantyContainer.Dock          = DockStyle.Top;
            warrantyContainer.UpperLeftIcon = icons.GrayArrow;
            warrantyContainer.Caption       = "Warranty";
            warrantyContainer.MainControl   = warrantyControl;
            warrantyContainer.TabIndex      = 3;
            //
            // storeContainer
            //
            storeContainer.Dock          = DockStyle.Top;
            storeContainer.UpperLeftIcon = icons.GrayArrow;
            storeContainer.Caption       = "Store";
            storeContainer.MainControl   = storeControl;
            //storeContainer.Extended = false;
            storeContainer.TabIndex = 5;

/*            //
 *          // panelFooterMenu
 *          //
 *          panelFooterMenu.AutoSize = true;
 *          panelFooterMenu.AutoSizeMode = AutoSizeMode.GrowAndShrink;
 *          panelFooterMenu.Dock = DockStyle.Bottom;*/

            BackColor = Css.CommonAppearance.Colors.BackColor;
            //mainPanel.Controls.Add(panelFooterMenu);
            if (isStore)
            {
                mainPanel.Controls.Add(storeContainer);
            }
            mainPanel.Controls.Add(warrantyContainer);
            if (!isStore)
            {
                mainPanel.Controls.Add(compliancePerformanceContainer);
            }
            mainPanel.Controls.Add(generalInformationContainer);
            if (!isStore)
            {
                mainPanel.Controls.Add(addNewComponentContainer);
            }
            Controls.Add(mainPanel);
            Controls.Add(footerControl);
            Controls.Add(headerControl);

            ClearFields();
            addNewComponentContainer.Focus();
        }
Exemple #2
0
        //private readonly string easaFileName = "EASA Form 8330.pdf";

        #endregion

        #region Constructor

        /// <summary>
        /// Создает элемент управления для отображения отдельного агрегата
        /// </summary>
        /// <param name="detail"></param>
        public DetailScreen(AbstractDetail detail)
        {
            if (detail == null)
            {
                throw new ArgumentNullException("detail", "Argument cannot be null");
            }

            currentDetail                = detail;
            BackColor                    = Css.CommonAppearance.Colors.BackColor;
            Dock                         = DockStyle.Fill;
            footerControl                = new FooterControl();
            headerControl                = new HeaderControl();
            aircraftHeader               = new AircraftHeaderControl(currentDetail.Aircraft, true);
            baseDetailHeaderControl      = new BaseDetailHeaderControl(currentDetail);
            generalInformationControl    = new DetailGeneralInformationControl(currentDetail);
            compliancePerformanceControl = new DetailCompliancePerformanceListControl(currentDetail);
            warrantyControl              = new DetailWarrantyControl(currentDetail);
            easaControl                  = new EASAControl(currentDetail, "Adobe PDF Files|*.pdf",
                                                           "This record does not contain a file proving the origin of the detail. Enclose PDF file to prove the origin.",
                                                           "Attached file proves the origin of the detail.", icons.PDFSmall);
            if (!currentDetail.InUse)
            {
                storeControl = new DetailStoreControl(currentDetail);
            }
            complianceControl = new DetailComplianceListView(currentDetail);

            generalInformationContainer    = new ExtendableRichContainer();
            compliancePerformanceContainer = new ExtendableRichContainer();
            warrantyContainer         = new ExtendableRichContainer();
            easaContainer             = new ExtendableRichContainer();
            storeContainer            = new ExtendableRichContainer();
            complianceDetailContainer = new ExtendableRichContainer();

            buttonAddCompliance        = new AvButtonT();
            buttonAddActualData        = new AvButtonT();
            buttonDeleteRecord         = new AvButtonT();
            buttonEditRecord           = new AvButtonT();
            buttonInstallPickOffDetail = new RichReferenceButton();

            //
            // aircraftHeader
            //
            aircraftHeader.AircraftClickable = true;
            //
            // headerControl
            //
            headerControl.Controls.Add(aircraftHeader);
            headerControl.ButtonEdit.TextMain       = "Save";
            headerControl.ButtonEdit.Icon           = icons.Save;
            headerControl.ButtonEdit.IconNotEnabled = icons.SaveGray;
            headerControl.TabIndex = 0;
            headerControl.ContextActionControl.ShowPrintButton = true;
            headerControl.ButtonEdit.DisplayerRequested       += ButtonSave_DisplayerRequested;
            headerControl.ReloadRised += headerControl_ReloadRised;
            headerControl.ContextActionControl.ButtonPrint.DisplayerRequested += ButtonPrint_DisplayerRequested;
            headerControl.ContextActionControl.ButtonHelp.TopicID              = "work_with_the_aggregate";
            //
            // mainPanel
            //
            mainPanel.AutoScroll = true;
            mainPanel.Dock       = DockStyle.Fill;
            mainPanel.TabIndex   = 1;
            mainPanel.Controls.Add(containedPanel);
            //
            // containedPanel
            //
            containedPanel.AutoSize      = true;
            containedPanel.AutoSizeMode  = AutoSizeMode.GrowAndShrink;
            containedPanel.FlowDirection = FlowDirection.TopDown;
            containedPanel.TabIndex      = 1;
            //
            // generalInformationContainer
            //
            generalInformationContainer.Extended      = false;
            generalInformationContainer.BackColor     = Css.CommonAppearance.Colors.BackColor;
            generalInformationContainer.UpperLeftIcon = icons.GrayArrow;
            generalInformationContainer.Caption       = "Component General Information";
            generalInformationContainer.MainControl   = generalInformationControl;
            generalInformationContainer.TabIndex      = 2;
            //
            // compliancePerformanceContainer
            //
            compliancePerformanceContainer.Extended      = false;
            compliancePerformanceContainer.BackColor     = Css.CommonAppearance.Colors.BackColor;
            compliancePerformanceContainer.UpperLeftIcon = icons.GrayArrow;
            compliancePerformanceContainer.Caption       = "Compliance/Performance";
            compliancePerformanceContainer.MainControl   = compliancePerformanceControl;
            compliancePerformanceContainer.TabIndex      = 3;
            //
            // warrantyContainer
            //
            warrantyContainer.Extended      = false;
            warrantyContainer.BackColor     = Css.CommonAppearance.Colors.BackColor;
            warrantyContainer.UpperLeftIcon = icons.GrayArrow;
            warrantyContainer.Caption       = "Warranty";
            warrantyContainer.MainControl   = warrantyControl;
            warrantyContainer.TabIndex      = 4;
            //
            // easaContainer
            //
            easaContainer.Extended      = false;
            easaContainer.BackColor     = Css.CommonAppearance.Colors.BackColor;
            easaContainer.UpperLeftIcon = icons.GrayArrow;
            //easaContainer.Caption = "EASA / FAA Form 8330";
            easaContainer.Caption     = "FAA Form 8330";
            easaContainer.MainControl = easaControl;
            easaContainer.TabIndex    = 5;

            //
            // storeContainer
            //
            storeContainer.Extended      = false;
            storeContainer.BackColor     = Css.CommonAppearance.Colors.BackColor;
            storeContainer.UpperLeftIcon = icons.GrayArrow;
            storeContainer.Caption       = "Store";
            storeContainer.MainControl   = storeControl;
            storeContainer.TabIndex      = 7;
            //
            // buttonAddCompliance
            //
            buttonAddCompliance.BackColor          = Color.Transparent;
            buttonAddCompliance.FontMain           = Css.HeaderControl.Fonts.PrimaryFont;
            buttonAddCompliance.FontSecondary      = Css.HeaderControl.Fonts.PrimaryFont;
            buttonAddCompliance.ForeColorMain      = Css.HeaderControl.Colors.PrimaryColor;
            buttonAddCompliance.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor;
            buttonAddCompliance.Icon               = icons.Add;
            buttonAddCompliance.IconNotEnabled     = icons.AddGray;
            buttonAddCompliance.IconLayout         = ImageLayout.Center;
            buttonAddCompliance.PaddingSecondary   = new Padding(0);
            buttonAddCompliance.Size               = new Size(150, 50);
            buttonAddCompliance.TabIndex           = 16;
            buttonAddCompliance.TextAlignMain      = ContentAlignment.MiddleLeft;
            buttonAddCompliance.TextAlignSecondary = ContentAlignment.TopCenter;
            buttonAddCompliance.TextMain           = "Register Compliance";
            buttonAddCompliance.Click             += buttonAddCompliance_Click;
            //
            // buttonAddActualData
            //
            buttonAddActualData.BackColor          = Color.Transparent;
            buttonAddActualData.FontMain           = Css.HeaderControl.Fonts.PrimaryFont;
            buttonAddActualData.FontSecondary      = Css.HeaderControl.Fonts.PrimaryFont;
            buttonAddActualData.ForeColorMain      = Css.HeaderControl.Colors.PrimaryColor;
            buttonAddActualData.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor;
            buttonAddActualData.Icon               = icons.Add;
            buttonAddActualData.IconNotEnabled     = icons.AddGray;
            buttonAddActualData.IconLayout         = ImageLayout.Center;
            buttonAddActualData.PaddingSecondary   = new Padding(0);
            buttonAddActualData.Size               = new Size(150, 50);
            buttonAddActualData.TabIndex           = 16;
            buttonAddActualData.TextAlignMain      = ContentAlignment.MiddleLeft;
            buttonAddActualData.TextAlignSecondary = ContentAlignment.TopCenter;
            buttonAddActualData.TextMain           = "Set Actual State";
            buttonAddActualData.Click             += buttonAddActualData_Click;
            //
            // buttonEditRecord
            //
            buttonEditRecord.BackColor          = Color.Transparent;
            buttonEditRecord.FontMain           = Css.HeaderControl.Fonts.PrimaryFont;
            buttonEditRecord.FontSecondary      = Css.HeaderControl.Fonts.PrimaryFont;
            buttonEditRecord.ForeColorMain      = Css.HeaderControl.Colors.PrimaryColor;
            buttonEditRecord.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor;
            buttonEditRecord.Icon               = icons.Edit;
            buttonEditRecord.IconNotEnabled     = icons.EditGray;
            buttonEditRecord.IconLayout         = ImageLayout.Center;
            buttonEditRecord.PaddingSecondary   = new Padding(0);
            buttonEditRecord.Size               = new Size(130, 50);
            buttonEditRecord.TabIndex           = 16;
            buttonEditRecord.TextAlignMain      = ContentAlignment.MiddleLeft;
            buttonEditRecord.TextAlignSecondary = ContentAlignment.TopCenter;
            buttonEditRecord.TextMain           = "Edit";
            buttonEditRecord.Click             += buttonEditRecord_Click;
            //
            // buttonDeleteRecord
            //
            buttonDeleteRecord.BackColor          = Color.Transparent;
            buttonDeleteRecord.Cursor             = Cursors.Hand;
            buttonDeleteRecord.FontMain           = Css.HeaderControl.Fonts.PrimaryFont;
            buttonDeleteRecord.FontSecondary      = Css.HeaderControl.Fonts.PrimaryFont;
            buttonDeleteRecord.ForeColorMain      = Css.HeaderControl.Colors.PrimaryColor;
            buttonDeleteRecord.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor;
            buttonDeleteRecord.Icon               = icons.Delete;
            buttonDeleteRecord.IconNotEnabled     = icons.DeleteGray;
            buttonDeleteRecord.IconLayout         = ImageLayout.Center;
            buttonDeleteRecord.PaddingSecondary   = new Padding(0);
            buttonDeleteRecord.Size               = new Size(150, 50);
            buttonDeleteRecord.TabIndex           = 16;
            buttonDeleteRecord.TextAlignMain      = ContentAlignment.MiddleLeft;
            buttonDeleteRecord.TextAlignSecondary = ContentAlignment.TopCenter;
            buttonDeleteRecord.TextMain           = "Remove";
            buttonDeleteRecord.Click             += buttonDeleteRecord_Click;
            //
            // buttonInstallPickOffDetail
            //
            buttonInstallPickOffDetail.BackColor          = Color.Transparent;
            buttonInstallPickOffDetail.FontMain           = Css.HeaderControl.Fonts.PrimaryFont;
            buttonInstallPickOffDetail.FontSecondary      = Css.HeaderControl.Fonts.PrimaryFont;
            buttonInstallPickOffDetail.ForeColorMain      = Css.HeaderControl.Colors.PrimaryColor;
            buttonInstallPickOffDetail.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor;
            buttonInstallPickOffDetail.Icon               = icons.Edit;
            buttonInstallPickOffDetail.IconNotEnabled     = icons.EditGray;
            buttonInstallPickOffDetail.IconLayout         = ImageLayout.Center;
            buttonInstallPickOffDetail.PaddingSecondary   = new Padding(0);
            buttonInstallPickOffDetail.Size               = new Size(150, 50);
            buttonInstallPickOffDetail.TabIndex           = 16;
            buttonInstallPickOffDetail.TextAlignMain      = ContentAlignment.MiddleLeft;
            buttonInstallPickOffDetail.TextAlignSecondary = ContentAlignment.TopCenter;
            buttonInstallPickOffDetail.ReflectionType     = ReflectionTypes.DisplayInCurrent;
            if (currentDetail.InUse)
            {
                buttonInstallPickOffDetail.TextMain = "Pick Off";
            }
            else
            {
                buttonInstallPickOffDetail.TextMain = "Install";
            }
            buttonInstallPickOffDetail.DisplayerRequested += buttonInstallPickOffDetail_DisplayerRequested;
            //
            // complianceControl
            //

            complianceControl.Dock   = DockStyle.Top;
            complianceControl.Height = 188;
            complianceControl.SelectedItemsChanged += complianceDirectiveControl_SelectedItemsChanged;
            complianceControl.ItemEdited           += complianceDirectiveControl_ItemEdited;
            complianceControl.SizeChanged          += complianceDirectiveControl_SizeChanged;

            //
            // panelCompliance
            //
            panelCompliance.AutoSize     = true;
            panelCompliance.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            panelCompliance.BackColor    = Css.CommonAppearance.Colors.BackColor;
            panelCompliance.Dock         = DockStyle.Top;
            panelCompliance.Visible      = false;
            panelCompliance.TabIndex     = 7;
            panelCompliance.Controls.Add(complianceControl);
            panelCompliance.Controls.Add(buttonAddCompliance);
            panelCompliance.Controls.Add(buttonAddActualData);
            panelCompliance.Controls.Add(buttonEditRecord);
            panelCompliance.Controls.Add(buttonDeleteRecord);
            panelCompliance.Controls.Add(buttonInstallPickOffDetail);
            //
            // baseDetailHeaderControl
            //
            baseDetailHeaderControl.TabIndex = 0;
            //
            // complianceDetailContainer
            //
            complianceDetailContainer.LabelCaption.Text = "Compliance";
            complianceDetailContainer.UpperLeftIcon     = icons.GrayArrow;
            complianceDetailContainer.Extending        += complianceDirectiveContainer_Extending;
            complianceDetailContainer.TabIndex          = 6;

            containedPanel.Controls.Add(baseDetailHeaderControl);
            containedPanel.Controls.Add(generalInformationContainer);
            containedPanel.Controls.Add(compliancePerformanceContainer);
            containedPanel.Controls.Add(warrantyContainer);
            containedPanel.Controls.Add(easaContainer);
            if (!currentDetail.InUse)
            {
                containedPanel.Controls.Add(storeContainer);
            }
            containedPanel.Controls.Add(complianceDetailContainer);
            containedPanel.Controls.Add(panelCompliance);

            Controls.Add(mainPanel);
            Controls.Add(footerControl);
            Controls.Add(headerControl);
            UpdateDetail(false);

            complianceDirectiveControl_SelectedItemsChanged(complianceControl, new SelectedItemsChangeEventArgs(0));
        }