/// <summary> /// Метод, проверяющий права доступа текущего пользователя и блокирует при необходимости текстовые поля /// </summary> private void CheckPermission() { bool permission = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update); textBoxCockpitSeating.ReadOnly = !permission; textBoxGalleys.ReadOnly = !permission; textBoxLavatory.ReadOnly = !permission; textBoxSeatingCapacity.ReadOnly = !permission; }
/// <summary> /// Метод, проверяющий права доступа текущего пользователя и блокирует при необходимости текстовые поля /// </summary> private void CheckPermission() { bool permission = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update); textBoxAircraftModel.ReadOnly = !permission; textBoxAircraftTypeCertificateNumber.ReadOnly = !permission; textBoxLineNumber.ReadOnly = !permission; textBoxVariableNumber.ReadOnly = !permission; //textBoxAmount.ReadOnly = !permission; }
/// <summary> /// Метод, проверяющий права доступа текущего пользователя и блокирует при необходимости текстовые поля /// </summary> private void CheckPermission() { bool permission = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update); textBoxBasicEmptyWeight.ReadOnly = !permission; textBoxBasicEmptyWeightCargoConfig.ReadOnly = !permission; textBoxCargoCapacityContainer.ReadOnly = !permission; textBoxCruise.ReadOnly = !permission; textBoxCruiseFuelFlow.ReadOnly = !permission; textBoxFuelCapacity.ReadOnly = !permission; textBoxMaxCruiseAltitude.ReadOnly = !permission; textBoxMaxLandingWeight.ReadOnly = !permission; textBoxMaxTakeOffCrossWeight.ReadOnly = !permission; textBoxMaxZeroFuelWeight.ReadOnly = !permission; }
/// <summary> /// Обновляет информацию о текущем шаблонном ВС /// </summary> private void UpdateScreen() { try { currentAircraft.Reload(true); aircraftControl.Aircraft = currentAircraft; powerPlantsControl.Aircraft = currentAircraft; APUControl.BaseDetail = currentAircraft.Apu; APUContainer.MainControl = APUControl; performanceDataControl.Aircraft = currentAircraft; filter = new TemplateLandingGearsFilter(true, true, true); collectionFilter = new TemplateDetailCollectionFilter(currentAircraft.ContainedDetails, new TemplateDetailFilter[] { filter }); landingGearsControl.Details = collectionFilter.GatherDetails(); interiorConfigurationControl.Aircraft = currentAircraft; headerControl.ActionControl.ShowEditButton = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update); } catch (Exception ex) { Program.Provider.Logger.Log("Error while loading data", ex); } }
private void InitializeComponent() { headerControl = new HeaderControl(); aircraftHeaderControl = new TemplateAircraftHeaderControl(aircraft); footerControl = new FooterControl(); mainPanel = new Panel(); containedPanel = new FlowLayoutPanel(); extendableRichContainerLimitations = new ExtendableRichContainer(); limitationsControl = new TemplateMaintenanceLimitationsControl(aircraft.MaintenanceDirective); // // headerControl // headerControl.Controls.Add(aircraftHeaderControl); headerControl.ActionControl.EditDisplayerRequested += ActionControl_EditDisplayerRequested; headerControl.ActionControl.ReloadRised += ActionControl_ReloadRised; headerControl.ActionControl.ButtonEdit.TextMain = "Save"; headerControl.ActionControl.ButtonEdit.Icon = icons.Save; headerControl.ActionControl.ButtonEdit.IconNotEnabled = icons.SaveGray; headerControl.ActionControl.ButtonEdit.Enabled = aircraft.HasPermission(Users.CurrentUser, DataEvent.Update); headerControl.ContextActionControl.ShowPrintButton = true; headerControl.ContextActionControl.ButtonPrint.DisplayerRequested += ButtonPrint_DisplayerRequested; headerControl.TabIndex = 0; // // aircraftHeaderControl // aircraftHeaderControl.Aircraft = aircraft; aircraftHeaderControl.AircraftClickable = true; aircraftHeaderControl.OperatorClickable = true; // // footerControl // footerControl.TabIndex = 2; // // extendableRichContainerLimitations // extendableRichContainerLimitations.Caption = "Maintenance Program"; //extendableRichContainerLimitations.Extended = false; extendableRichContainerLimitations.MainControl = limitationsControl; extendableRichContainerLimitations.TabIndex = 1; extendableRichContainerLimitations.UpperLeftIcon = icons.GrayArrow; // // containedPanel // containedPanel.AutoSize = true; containedPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; containedPanel.FlowDirection = FlowDirection.TopDown; containedPanel.Controls.Add(extendableRichContainerLimitations); containedPanel.TabIndex = 1; // // mainPanel // mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; mainPanel.TabIndex = 1; mainPanel.Controls.Add(containedPanel); BackColor = Css.CommonAppearance.Colors.BackColor; Controls.Add(mainPanel); Controls.Add(headerControl); Controls.Add(footerControl); }
/// <summary> /// Создает элемент управления для отображения информации о шаблонном ВС /// </summary> /// <param name="currentAircraft"></param> public TemplateAircraftGeneralDataScreen(TemplateAircraft currentAircraft) { this.currentAircraft = currentAircraft; BackColor = Css.CommonAppearance.Colors.BackColor; Dock = DockStyle.Fill; aircraftHeaderControl = new TemplateAircraftHeaderControl(currentAircraft, true, true); // // aircraftControl // aircraftControl = new TemplateAircraftControl(currentAircraft); // // powerPlantsControl // powerPlantsControl = new TemplatePowerPlantsControl(currentAircraft); // // APUControl // APUControl = new TemplateAPUControl(currentAircraft.Apu); // // performanceDataControl // performanceDataControl = new TemplatePerformanceDataControl(currentAircraft); // // landingGearsControl // filter = new TemplateLandingGearsFilter(true, true, true); collectionFilter = new TemplateDetailCollectionFilter(currentAircraft.ContainedDetails, new TemplateDetailFilter[] { filter }); landingGearsControl = new TemplateLandingGearsControl(collectionFilter.GatherDetails()); /* // * // maintenanceStatusControl * // * maintenanceStatusControl = new MaintenanceStatusControl();*/ // // interiorConfigurationControl // interiorConfigurationControl = new TemplateInteriorConfigurationControl(currentAircraft); // // aircraftContainer // aircraftContainer.Caption = "A. Aircraft"; aircraftContainer.UpperLeftIcon = icons.GrayArrow; aircraftContainer.MainControl = aircraftControl; aircraftContainer.Dock = DockStyle.Top; aircraftContainer.TabIndex = 1; // // powerPlantsContainer // powerPlantsContainer.Caption = "B. Power Plants"; powerPlantsContainer.UpperLeftIcon = icons.GrayArrow; powerPlantsContainer.MainControl = powerPlantsControl; powerPlantsContainer.Dock = DockStyle.Top; powerPlantsContainer.Extended = false; powerPlantsContainer.TabIndex = 2; // // APUContainer // APUContainer.Caption = "C. Auxiliary Power Unit"; APUContainer.UpperLeftIcon = icons.GrayArrow; APUContainer.MainControl = APUControl; APUContainer.Dock = DockStyle.Top; APUContainer.Extended = false; APUContainer.TabIndex = 3; // // performanceDataContainer // performanceDataContainer.Caption = "D. Performance Data"; performanceDataContainer.UpperLeftIcon = icons.GrayArrow; performanceDataContainer.MainControl = performanceDataControl; performanceDataContainer.Dock = DockStyle.Top; performanceDataContainer.Extended = false; performanceDataContainer.TabIndex = 4; // // landingGearsContainer // landingGearsContainer.Caption = "E. Landing Gears"; landingGearsContainer.UpperLeftIcon = icons.GrayArrow; landingGearsContainer.MainControl = landingGearsControl; landingGearsContainer.Dock = DockStyle.Top; landingGearsContainer.Extended = false; landingGearsContainer.TabIndex = 5; /* // * // maintenanceStatusContainer * // * maintenanceStatusContainer.Caption = "F. Maintenance Status"; * maintenanceStatusContainer.UpperLeftIcon = icons.GrayArrow; * maintenanceStatusContainer.MainControl = maintenanceStatusControl; * maintenanceStatusContainer.Dock = DockStyle.Top; * maintenanceStatusContainer.Extended = false; * maintenanceStatusContainer.TabIndex = 6;*/ // // interiorConfigurationContainer // interiorConfigurationContainer.Caption = "G. Interior Configuration"; interiorConfigurationContainer.UpperLeftIcon = icons.GrayArrow; interiorConfigurationContainer.MainControl = interiorConfigurationControl; interiorConfigurationContainer.Dock = DockStyle.Top; interiorConfigurationContainer.Extended = false; interiorConfigurationContainer.TabIndex = 7; // // headerControl // headerControl.ContextActionControl.ShowPrintButton = true; headerControl.ActionControl.ButtonEdit.TextMain = "Save"; headerControl.ActionControl.ButtonEdit.Icon = icons.Save; headerControl.ActionControl.ButtonEdit.IconNotEnabled = icons.SaveGray; headerControl.ActionControl.ButtonEdit.DisplayerRequested += ButtonSave_Click; headerControl.ActionControl.ButtonReload.Click += ButtonReload_Click; headerControl.ContextActionControl.ShowPrintButton = false; headerControl.Controls.Add(aircraftHeaderControl); headerControl.ActionControl.ShowEditButton = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update); headerControl.TabIndex = 0; // // mainPanel // mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; mainPanel.TabIndex = 1; mainPanel.Controls.Add(interiorConfigurationContainer); //mainPanel.Controls.Add(maintenanceStatusContainer); mainPanel.Controls.Add(landingGearsContainer); mainPanel.Controls.Add(performanceDataContainer); if (currentAircraft.Apu != null) { mainPanel.Controls.Add(APUContainer); } if (currentAircraft.Engines.Length > 0) { mainPanel.Controls.Add(powerPlantsContainer); } mainPanel.Controls.Add(aircraftContainer); Controls.Add(mainPanel); Controls.Add(headerControl); Controls.Add(footerControl); }
/// <summary> /// Semiautomatically generated code /// </summary> private void InitializeComponent() { tableLayoutPanelReferences = new TableLayoutPanel(); mainPanel = new Panel(); flowLayoutPanelBaseDetailsContainer = new FlowLayoutPanel(); aircraftReferencesControl1 = new TemplateAircraftReferencesControl(); aircraftInfoReference = new TemplateAircraftInfoReference(currentAircraft); footerControl = new FooterControl(); headerControl = new HeaderControl(); aircraftHeader = new TemplateAircraftHeaderControl(currentAircraft, true, false); buttonAddTemplate = new RichReferenceButton(); buttonDeleteTemplate = new RichReferenceButton(); buttonAddBaseDetail = new AvButtonT(); aircraftFrameControl = new TemplateBaseDetailControl(currentAircraft.AircraftFrame); landingGearsButtons = new TemplateLandingGearsButtonsControl(currentAircraft); linkLandingGearStatus = new ReferenceStatusImageLinkLabel(); permissionForDelete = currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Remove); // // tableLayoutPanelReferences // tableLayoutPanelReferences.AutoSize = true; tableLayoutPanelReferences.AutoSizeMode = AutoSizeMode.GrowAndShrink; tableLayoutPanelReferences.ColumnStyles.Add(new ColumnStyle()); tableLayoutPanelReferences.Controls.Add(aircraftReferencesControl1, 0, 0); tableLayoutPanelReferences.Controls.Add(aircraftInfoReference, 0, 1); tableLayoutPanelReferences.Location = new Point(0, 0); tableLayoutPanelReferences.Margin = new Padding(10); tableLayoutPanelReferences.RowStyles.Add(new RowStyle()); tableLayoutPanelReferences.RowStyles.Add(new RowStyle()); tableLayoutPanelReferences.RowStyles.Add(new RowStyle()); tableLayoutPanelReferences.MinimumSize = new Size(REFERENCES_WIDTH, REFERENCES_HEIGHT); tableLayoutPanelReferences.TabIndex = 0; // // mainPanel // mainPanel.Controls.Add(flowLayoutPanelBaseDetailsContainer); mainPanel.Controls.Add(tableLayoutPanelReferences); mainPanel.Controls.Add(landingGearsButtons); mainPanel.Controls.Add(linkLandingGearStatus); mainPanel.Controls.Add(buttonAddBaseDetail); mainPanel.Controls.Add(buttonDeleteTemplate); mainPanel.Controls.Add(buttonAddTemplate); mainPanel.AutoScroll = true; mainPanel.Dock = DockStyle.Fill; mainPanel.TabIndex = 1; mainPanel.SizeChanged += mainPanel_SizeChanged; // // flowLayoutPanelBaseDetailsContainer // flowLayoutPanelBaseDetailsContainer.FlowDirection = FlowDirection.TopDown; flowLayoutPanelBaseDetailsContainer.AutoScroll = true; flowLayoutPanelBaseDetailsContainer.AutoSize = true; flowLayoutPanelBaseDetailsContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink; flowLayoutPanelBaseDetailsContainer.Location = new Point(REFERENCES_WIDTH, 0); flowLayoutPanelBaseDetailsContainer.Padding = new Padding(0, 27, 0, 0); flowLayoutPanelBaseDetailsContainer.TabIndex = 1; flowLayoutPanelBaseDetailsContainer.SizeChanged += flowLayoutPanelContentContainer_SizeChanged; flowLayoutPanelBaseDetailsContainer.Controls.Add(aircraftFrameControl); // // aircraftReferencesControl1 // aircraftReferencesControl1.AutoSize = true; aircraftReferencesControl1.AutoSizeMode = AutoSizeMode.GrowAndShrink; aircraftReferencesControl1.BackColor = Css.CommonAppearance.Colors.BackColor; aircraftReferencesControl1.Caption = "Aircraft references"; aircraftReferencesControl1.DescriptionTextColor = Color.DimGray; aircraftReferencesControl1.Dock = DockStyle.Top; aircraftReferencesControl1.Location = new Point(30, 30); aircraftReferencesControl1.Margin = new Padding(30, 30, 3, 3); aircraftReferencesControl1.MinimumSize = new Size(50, 50); aircraftReferencesControl1.Size = new Size(362, 528); aircraftReferencesControl1.TabIndex = 0; aircraftReferencesControl1.UpperLeftIcon = icons.GrayArrow; aircraftReferencesControl1.LinkADStatusDisplayerRequested += linkADStatus_DisplayerRequested; aircraftReferencesControl1.LinkAgingProgramDisplayerRequested += linkAgingProgram_DisplayerRequested; aircraftReferencesControl1.LinkAircraftGeneralDataDisplayerRequested += linkAircraftGeneralData_DisplaeyRequested; aircraftReferencesControl1.LinkComponentStatusDisplayerRequested += linkComponentStatus_DisplayerRequested; aircraftReferencesControl1.LinkCPCPStatusDisplayerRequested += linkCPCPStatus_DisplayerRequested; aircraftReferencesControl1.LinkLandingGearStatusDisplayerRequested += LinkLandingGearStatus_DisplayerRequested; aircraftReferencesControl1.LinkMaintenanceStatusDisplayerRequested += linkMaintenanceStatusDisplayerRequested; aircraftReferencesControl1.LinkSBStatusDisplayerRequested += linkSBStatus_DisplayerRequested; // // aircraftInfoReference // aircraftInfoReference.AutoSize = true; aircraftInfoReference.AutoSizeMode = AutoSizeMode.GrowAndShrink; aircraftInfoReference.BackColor = Css.CommonAppearance.Colors.BackColor; aircraftInfoReference.Caption = "Aircraft information"; aircraftInfoReference.DescriptionTextColor = Color.DimGray; aircraftInfoReference.Margin = new Padding(30, 15, 30, 3); aircraftInfoReference.MinimumSize = new Size(50, 50); aircraftInfoReference.TabIndex = 1; aircraftInfoReference.UpperLeftIcon = icons.GrayArrow; // // footerControl // footerControl.TabIndex = 2; // // headerControl // headerControl.Controls.Add(aircraftHeader); headerControl.TabIndex = 0; headerControl.ReloadRised += headerControl_ReloadRised; headerControl.EditDisplayerRequested += linkAircraftGeneralData_DisplaeyRequested; headerControl.ActionControl.ShowEditButton = true; headerControl.ContextActionControl.ButtonHelp.TopicID = "entering_an_aircraft_to_the_cas_database"; // // buttonAddBaseDetail // buttonAddBaseDetail.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonAddBaseDetail.FontMain = Css.HeaderControl.Fonts.PrimaryFont; buttonAddBaseDetail.ForeColorMain = Css.HeaderControl.Colors.PrimaryColor; buttonAddBaseDetail.Icon = icons.Add; buttonAddBaseDetail.IconNotEnabled = icons.AddGray; buttonAddBaseDetail.Width = 160; buttonAddBaseDetail.TextMain = "Add Base Component"; buttonAddBaseDetail.Click += buttonAddBaseDetail_Click; // // buttonDeleteTemplate // buttonDeleteTemplate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonDeleteTemplate.FontMain = Css.HeaderControl.Fonts.PrimaryFont; buttonDeleteTemplate.ForeColorMain = Css.HeaderControl.Colors.PrimaryColor; buttonDeleteTemplate.Icon = icons.Delete; buttonDeleteTemplate.IconNotEnabled = icons.DeleteGray; buttonDeleteTemplate.ReflectionType = ReflectionTypes.CloseSelected; buttonDeleteTemplate.Width = 150; buttonDeleteTemplate.Location = new Point(mainPanel.Right - buttonDeleteTemplate.Width, mainPanel.Bottom - buttonDeleteTemplate.Height - BOTTOM_MARGIN); buttonDeleteTemplate.TextMain = "Delete Template"; buttonDeleteTemplate.DisplayerRequested += buttonDeleteTemplate_DisplayerRequested; buttonDeleteTemplate.Visible = permissionForDelete; // // buttonAddTemplate // buttonAddTemplate.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonAddTemplate.FontMain = Css.HeaderControl.Fonts.PrimaryFont; buttonAddTemplate.ForeColorMain = Css.HeaderControl.Colors.PrimaryColor; buttonAddTemplate.FontSecondary = Css.HeaderControl.Fonts.PrimaryFont; buttonAddTemplate.ForeColorSecondary = Css.HeaderControl.Colors.PrimaryColor; buttonAddTemplate.Icon = icons.Add; buttonAddTemplate.IconNotEnabled = icons.AddGray; buttonAddTemplate.Width = 350; buttonAddTemplate.PaddingMain = new Padding(3, 0, 0, 0); buttonAddTemplate.TextAlignMain = ContentAlignment.BottomLeft; buttonAddTemplate.TextAlignSecondary = ContentAlignment.TopLeft; buttonAddTemplate.TextMain = "Add " + currentAircraft.Model; if (OperatorCollection.Instance.Count == 1) { buttonAddTemplate.TextSecondary = " to " + OperatorCollection.Instance[0].Name; } else { buttonAddTemplate.TextSecondary = " to operator"; } buttonAddTemplate.DisplayerRequested += buttonAddTemplate_DisplayerRequested; // // linkLandingGearStatus // Css.ImageLink.Adjust(linkLandingGearStatus); linkLandingGearStatus.Margin = new Padding(1); linkLandingGearStatus.Size = new Size(300, 30); linkLandingGearStatus.Text = "View Landing Gear Status"; linkLandingGearStatus.TextAlign = ContentAlignment.MiddleLeft; linkLandingGearStatus.ReflectionType = ReflectionTypes.DisplayInNew; linkLandingGearStatus.DisplayerRequested += LinkLandingGearStatus_DisplayerRequested; linkLandingGearStatus.Enabled = true; // // aircraftFrameControl // aircraftFrameControl.TabIndex = 0; // // landingGearsButtons // landingGearsButtons.LocationChanged += landingGearsButtons_LocationChanged; landingGearsButtons.SizeChanged += landingGearsButtons_SizeChanged; // // TemplateAircraftScreen // BackColor = Css.CommonAppearance.Colors.BackColor; Controls.Add(mainPanel); Controls.Add(footerControl); Controls.Add(headerControl); }