Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TurretDesignHandler()
        {
            m_oTurretDesignPanel = new Panels.TurretDesign();

            VM = new ViewModels.TurretDesignViewModel();

            /// <summary>
            /// Bind factions to the empire selection combo box.
            /// </summary>
            m_oTurretDesignPanel.EmpireComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oTurretDesignPanel.EmpireComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oTurretDesignPanel.EmpireComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => _CurrnetFaction = VM.CurrentFaction;
            _CurrnetFaction    = VM.CurrentFaction;
            m_oTurretDesignPanel.EmpireComboBox.SelectedIndexChanged += (s, args) => m_oTurretDesignPanel.EmpireComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTurretDesignPanel.EmpireComboBox.SelectedIndexChanged += new EventHandler(EmpireComboBox_SelectedIndexChanged);

            /// <summary>
            /// Binding missile engines to the appropriate combo box.
            /// </summary>
            m_oTurretDesignPanel.BeamComboBox.Bind(c => c.DataSource, VM, d => d.TurretableList);
            m_oTurretDesignPanel.BeamComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentBeam, DataSourceUpdateMode.OnPropertyChanged);
            m_oTurretDesignPanel.BeamComboBox.DisplayMember = "Name";
            VM.BeamChanged += (s, args) => _CurrnetBeam = VM.CurrentBeam;
            _CurrnetBeam    = VM.CurrentBeam;
            m_oTurretDesignPanel.BeamComboBox.SelectedIndexChanged += (s, args) => m_oTurretDesignPanel.BeamComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTurretDesignPanel.BeamComboBox.SelectedIndexChanged += new EventHandler(BeamComboBox_SelectedIndexChanged);


            m_oTurretDesignPanel.SingleRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.TwinRadioButton.CheckedChanged   += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.TripleRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.QuadRadioButton.CheckedChanged   += new EventHandler(MultRadioButton_CheckedChanged);

            m_oTurretDesignPanel.TrackSpeedTextBox.TextChanged   += new EventHandler(TrackSpeedTextBox_TextChanged);
            m_oTurretDesignPanel.TurretArmourTextBox.TextChanged += new EventHandler(TurretArmourTextBox_TextChanged);

            m_oTurretDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);

            m_oTurretDesignPanel.CloseTDButton.Click += new EventHandler(CloseTDButton_Click);

            Multiplier         = 1;
            TurretProjTracking = 10000;
            TurretProjArmour   = 0;

            TurretProject = null;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public TurretDesignHandler()
        {
            m_oTurretDesignPanel = new Panels.TurretDesign();

            VM = new ViewModels.TurretDesignViewModel();

            /// <summary>
            /// Bind factions to the empire selection combo box.
            /// </summary>
            m_oTurretDesignPanel.EmpireComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oTurretDesignPanel.EmpireComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oTurretDesignPanel.EmpireComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => _CurrnetFaction = VM.CurrentFaction;
            _CurrnetFaction = VM.CurrentFaction;
            m_oTurretDesignPanel.EmpireComboBox.SelectedIndexChanged += (s, args) => m_oTurretDesignPanel.EmpireComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTurretDesignPanel.EmpireComboBox.SelectedIndexChanged += new EventHandler(EmpireComboBox_SelectedIndexChanged);

            /// <summary>
            /// Binding missile engines to the appropriate combo box.
            /// </summary>
            m_oTurretDesignPanel.BeamComboBox.Bind(c => c.DataSource, VM, d => d.TurretableList);
            m_oTurretDesignPanel.BeamComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentBeam, DataSourceUpdateMode.OnPropertyChanged);
            m_oTurretDesignPanel.BeamComboBox.DisplayMember = "Name";
            VM.BeamChanged += (s, args) => _CurrnetBeam = VM.CurrentBeam;
            _CurrnetBeam = VM.CurrentBeam;
            m_oTurretDesignPanel.BeamComboBox.SelectedIndexChanged += (s, args) => m_oTurretDesignPanel.BeamComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTurretDesignPanel.BeamComboBox.SelectedIndexChanged += new EventHandler(BeamComboBox_SelectedIndexChanged);


            m_oTurretDesignPanel.SingleRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.TwinRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.TripleRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);
            m_oTurretDesignPanel.QuadRadioButton.CheckedChanged += new EventHandler(MultRadioButton_CheckedChanged);

            m_oTurretDesignPanel.TrackSpeedTextBox.TextChanged += new EventHandler(TrackSpeedTextBox_TextChanged);
            m_oTurretDesignPanel.TurretArmourTextBox.TextChanged += new EventHandler(TurretArmourTextBox_TextChanged);

            m_oTurretDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);

            m_oTurretDesignPanel.CloseTDButton.Click += new EventHandler(CloseTDButton_Click);

            Multiplier = 1;
            TurretProjTracking = 10000;
            TurretProjArmour = 0;

            TurretProject = null;
        }