Exemplo n.º 1
0
// ============================================================================
// Save button pressed. Build an armour object and add it to the list of all
// available components (this will also result in any existing design with the
// same name being overwritten).
// ============================================================================

        private void SaveButton_Click(object sender, EventArgs e)
        {
            string componentName = CommonProperties.ComponentName.Text;

            if (componentName == null || componentName == "")
            {
                Report.Error("You must specify a component name");
                return;
            }

            // Create a new component and copy the form details to it.
            NovaCommon.Component armorComponent = new NovaCommon.Component(CommonProperties.Value);

            Armor armorProperties = new Armor();

            armorProperties.Strength = (int)ArmourStrength.Value; // TODO change the form property to American spelling
            armorProperties.Shields  = (int)Shielding.Value;

            armorComponent.Properties.Add("Armor", armorProperties);

            AllComponents[armorComponent.Name] = armorComponent;

            CommonProperties.UpdateListBox(typeof(NovaCommon.Component));
            Report.Information("Armour design has been saved");
        }
Exemplo n.º 2
0
// ============================================================================
// Construction
// ============================================================================

        public ArmorDialog()
        {
            InitializeComponent();
            CommonProperties.ListBoxChanged += OnSelectionChanged;
            AllComponents = NovaCommon.AllComponents.Data.Components;

            CommonProperties.UpdateListBox(typeof(NovaCommon.Component));
        }
Exemplo n.º 3
0
// ============================================================================
// Save button pressed. Build an shield object and add it to the list of all
// available components (this will also result in any existing design with the
// same name being overwritten).
// ============================================================================

        private void SaveButton_Click(object sender, EventArgs e)
        {
            string componentName = CommonProperties.ComponentName.Text;

            if (componentName == null || componentName == "")
            {
                Report.Error("You must specify a component name");
                return;
            }

            Shield shield = new Shield(CommonProperties.Value);

            shield.Strength            = (int)ShieldStrength.Value;
            shield.Armour              = (int)ArmourStrength.Value;
            AllComponents[shield.Name] = shield;

            CommonProperties.UpdateListBox(typeof(Shield));
            Report.Information("Shield design has been saved");
        }