Exemple #1
0
        protected virtual void DoSaveFamily(GUIButton sender, object value)
        {
            if (!string.IsNullOrEmpty(value.ToString()) && KLVCore.FamilyAvailable(value.ToString()))
            {
                if (editingFamily == null)
                {
                    //Adding new family
                    KLVCore.AddVehicleFamily(value.ToString());
                }
                else
                {
                    //Editing existing family
                    editingFamily.SetName(value.ToString());
                    editingFamily = null;
                }

                KLVCore.Save();
                KLVCore.UpdateAllVehicleNameSchemes();
                UpdateFamilies();
                textEditFamily.SetText("");
                textEditFamily.SetEditing(false);

                SetFamilyEditState(false);
            }
        }
        private static void Main()
        {
            var defaultObject = default(VehicleFamily);
            var normalObject  = new VehicleFamily();


            WriteLine(defaultObject.Name);
        }
Exemple #3
0
        /// <summary>
        /// Gets a complete <see cref="Summary"/> object for the specified <see cref="VehicleFamily"/>.
        /// </summary>
        /// <param name="vehicleFamily">The <see cref="VehicleFamily"/> to analyze.</param>
        public Summary GetCompleteSummary(VehicleFamily vehicleFamily)
        {
            var numberOfVehicles  = GetNumberOfVehicles(vehicleFamily);
            var fairingSummary    = FairingController.GetFairingSummary(vehicleFamily);
            var priceSummary      = PriceController.GetPriceSummary(vehicleFamily);
            var capabilitySummary = CapabilityController.GetCapabilitySummary(vehicleFamily).ToList();

            return(new Summary(numberOfVehicles, capabilitySummary, fairingSummary, priceSummary));
        }
Exemple #4
0
        /// <summary>
        /// Gets the price of the cheapest and most expensive launcher in a vehicle family,
        /// and then returns them in the form of a <see cref="PriceSummary"/>.
        /// </summary>
        /// <param name="vehicleFamily">The vehicle family to analyze.</param>
        /// <returns>
        /// A <see cref="PriceSummary"/> containing the price of the cheapest and
        /// most expensive launcher in a vehicle family.
        /// </returns>
        public PriceSummary GetPriceSummary(VehicleFamily vehicleFamily)
        {
            // Get the summaries.
            var launcherPriceSummary   = GetPriceSummary(vehicleFamily.Launchers);
            var collectionPriceSummary = GetPriceSummary(vehicleFamily.LauncherCollections);

            // Get the cheapest and most expensive of the two summaries in the same categories.
            var cheapest      = ValueComparer.GetSmallerValue(launcherPriceSummary.Cheapest, collectionPriceSummary.Cheapest);
            var mostExpensive = ValueComparer.GetLargerValue(launcherPriceSummary.MostExpensive, collectionPriceSummary.MostExpensive);

            return(new PriceSummary(cheapest, mostExpensive));
        }
        /// <summary>
        /// Gets the values from the longest and the largest diameter fairing in a vehicle family
        /// and returns the values in the form of a <see cref="FairingSummary"/>;
        /// </summary>
        /// <param name="vehicleFamily">The vehicle family to analyze.</param>
        /// <returns>
        /// A <see cref="FairingSummary"/> containing the longest and the largest diameter fairing in a vehicle family.
        /// </returns>
        public FairingSummary GetFairingSummary(VehicleFamily vehicleFamily)
        {
            // Get the summaries.
            var launcherFairingSummary   = GetFairingSummary(vehicleFamily.Launchers);
            var collectionFairingSummary = GetFairingSummary(vehicleFamily.LauncherCollections);

            // Get the larger of the two summaries in the same categories.
            var maxLength   = ValueComparer.GetLargerValue(launcherFairingSummary.MaxLength, collectionFairingSummary.MaxLength);
            var maxDiameter = ValueComparer.GetLargerValue(launcherFairingSummary.MaxDiameter, collectionFairingSummary.MaxDiameter);

            return(new FairingSummary(maxLength, maxDiameter));
        }
Exemple #6
0
        /// <summary>
        /// Gets the number of launchers in a <see cref="VehicleFamily"/> and it's associated launcher collections.
        /// </summary>
        /// <param name="vehicleFamily">The <see cref="VehicleFamily"/> to analyze.</param>
        public int GetNumberOfVehicles(VehicleFamily vehicleFamily)
        {
            // Go through each LauncherCollection, get the number of
            // Launchers it's holding, and then add them to the total.
            var numberOfvehicles = vehicleFamily.LauncherCollections.Sum(e => e.Launchers.Count);

            // Get the number of Launchers in the family that don't belong
            // to any specific collection, and then add them to the total.
            numberOfvehicles += vehicleFamily.Launchers.Count;

            return(numberOfvehicles);
        }
        /// <summary>
        /// Creates the <see cref="VehicleFamily"/> that's used in the test initializer.
        /// </summary>
        protected virtual void CreateVehicleFamily()
        {
            Family = new VehicleFamily(CreateFamilyName())
            {
                Notes           = CreateFamilyNotes(),
                PreviewLocation = CreateFamilyPreviewLocation(),
            };

            // Add the collection(s) to the family and then create the summary.
            Family.LauncherCollections.Add(Collection);

            Family.Summary = CreateFamilySummary();
        }
Exemple #8
0
        public IEnumerable <CapabilitySummary> GetCapabilitySummary(VehicleFamily vehicleFamily)
        {
            var capabilitySummaries = new List <CapabilitySummary>();

            var collectionSummaries = GetASummaryForAllCapabilities(vehicleFamily.LauncherCollections);
            var launcherSummaries   = GetASummaryForAllCapabilities(vehicleFamily.Launchers);

            capabilitySummaries.AddRange(collectionSummaries);
            capabilitySummaries.AddRange(launcherSummaries);

            var orbitTypesToCompare = GetOrbitTypesToCompare(capabilitySummaries);

            return(GetSummariesOfPayloadRangeExtremes(orbitTypesToCompare, capabilitySummaries));
        }
Exemple #9
0
        protected virtual void DoBeginFamilyEdit(GUIButton sender, object value)
        {
            if (value != null && GlobalSettings.AllowFamilyEdit)
            {
                var family = KLVCore.GetVehicleFamily(value.ToString().Trim());

                if (family != null)
                {
                    editingFamily = family;
                    SetFamilyEditState(true);
                    textEditFamily.SetText(editingFamily.Name);
                    textEditFamily.SetEditing(true);
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="VehicleFamilyController"/> class.
 /// </summary>
 /// <param name="vehicleFamily">
 /// The <see cref="DataProviders.VehicleFamily"/> that this controller will work with.
 /// </param>
 public VehicleFamilyController(VehicleFamily vehicleFamily)
 {
     VehicleFamily = vehicleFamily;
 }
Exemple #11
0
 protected virtual void DoCancelFamilyEdit(GUIButton sender, object value)
 {
     editingFamily = null;
     SetFamilyEditState(false);
 }