コード例 #1
0
 /// <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);
 }
コード例 #2
0
        private void UpdateAircraft(bool reloadAircraft)
        {
            try
            {
                if (reloadAircraft)
                {
                    currentAircraft.Reload(true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading data", ex);
                return;
            }
            UnHookBaseDetailEvents();
            UpdateHeader();
            aircraftInfoReference.UpdateData();

            if (flowLayoutPanelBaseDetailsContainer.Controls.Contains(apuControl))
            {
                flowLayoutPanelBaseDetailsContainer.Controls.Remove(apuControl);
            }
            for (int i = 0; i < enginesControls.Length; i++)
            {
                if (flowLayoutPanelBaseDetailsContainer.Controls.Contains(enginesControls[i]))
                {
                    flowLayoutPanelBaseDetailsContainer.Controls.Remove(enginesControls[i]);
                }
            }

            aircraftFrameControl.UpdateInformation();
            List <TemplateEngine> engines = new List <TemplateEngine>();

            engines.AddRange(currentAircraft.Engines);
            engines.Sort(new TemplateEnginePositionSerialNumberComparerDesc());
            enginesControls = new TemplateBaseDetailControl[engines.Count];
            flowLayoutPanelBaseDetailsContainer.AutoSize = false;
            for (int i = 0; i < engines.Count; i++)
            {
                if (engines[i] != null)
                {
                    enginesControls[i]          = new TemplateBaseDetailControl(engines[i]);
                    enginesControls[i].TabIndex = engines.Count - i;
                    enginesControls[i].Tag      = engines[i];
                    flowLayoutPanelBaseDetailsContainer.Controls.Add(enginesControls[i]);
                }
            }
            if (currentAircraft.Apu != null)
            {
                apuControl          = new TemplateBaseDetailControl(currentAircraft.Apu);
                apuControl.Height   = 50;
                apuControl.TabIndex = enginesControls.Length + 1;
                flowLayoutPanelBaseDetailsContainer.Controls.Add(apuControl);
            }
            flowLayoutPanelBaseDetailsContainer.AutoSize = true;
            landingGearsButtons.UpdateInformation();
            HookBaseDetailEvents();

/*                aircraftInfoReference.UpdateData();
 *          if (flowLayoutPanelBaseDetailsContainer.Controls.Contains(aircraftFrameControl))
 *              flowLayoutPanelBaseDetailsContainer.Controls.Remove(aircraftFrameControl);
 *          if (flowLayoutPanelBaseDetailsContainer.Controls.Contains(apuControl))
 *              flowLayoutPanelBaseDetailsContainer.Controls.Remove(apuControl);
 *          if (enginesControls != null)
 *          {
 *              for (int i = 0; i < enginesControls.Length; i++)
 *              {
 *                  if (flowLayoutPanelBaseDetailsContainer.Controls.Contains(enginesControls[i]))
 *                      flowLayoutPanelBaseDetailsContainer.Controls.Remove(enginesControls[i]);
 *              }
 *          }
 *          if (currentAircraft.TemplateAircraftContainer != null)
 *          {
 *              aircraftFrameControl = new TemplateBaseDetailControl(currentAircraft.TemplateAircraftContainer);
 *              aircraftFrameControl.Dock = DockStyle.Top;
 *              aircraftFrameControl.TabIndex = 0;
 *          }
 *          List<TemplateEngine> engines = new List<TemplateEngine>();
 *          engines.AddRange(currentAircraft.Engines);
 *          engines.Sort(new TemplateEnginePositionSerialNumberComparerDesc());
 *          enginesControls = new TemplateBaseDetailControl[engines.Count];
 *          for (int i = 0; i < engines.Count; i++)
 *          {
 *              if (engines[i] != null)
 *              {
 *                  enginesControls[i] = new TemplateBaseDetailControl(engines[i]);
 *                  enginesControls[i].Dock = DockStyle.Top;
 *                  enginesControls[i].TabIndex = engines.Count - i;
 *              }
 *          }
 *          if (currentAircraft.Apu != null)
 *          {
 *              apuControl = new TemplateBaseDetailControl(currentAircraft.Apu);
 *              apuControl.Dock = DockStyle.Top;
 *              apuControl.TabIndex = enginesControls.Length + 1;
 *          }
 *
 * /*
 *          if (currentAircraft.GearAssembly != null) //todo массив GearAssembly
 *          {
 *              landingGearsButtons = new TemplateLandingGearsButtonsControl(new TemplateDetail[] {});// currentAircraft.GearAssembly);
 *              landingGearsButtons.Dock = DockStyle.Top;
 *              landingGearsButtons.BackColor = Color.Transparent;
 *              landingGearsButtons.TabIndex = enginesControls.Length + 2;
 *          }
 */

            /*       flowLayoutPanelBaseDetailsContainer.Controls.Clear();
             *
             *
             *     flowLayoutPanelBaseDetailsContainer.Controls.Add(landingGearsButtons);
             *     flowLayoutPanelBaseDetailsContainer.Controls.Add(apuControl);
             *     flowLayoutPanelBaseDetailsContainer.Controls.AddRange(enginesControls);
             *     flowLayoutPanelBaseDetailsContainer.Controls.Add(aircraftFrameControl);
             *
             *     paddingPanel.SendToBack();
             *
             *     headerControl.ActionControl.ButtonEdit.Enabled =
             *         currentAircraft.HasPermission(Users.CurrentUser, DataEvent.Update);*/
        }