Ejemplo n.º 1
0
        /// <summary>
        /// Constructor for this handler.
        /// </summary>
        public TaskGroup()
        {
            m_oTaskGroupPanel = new Panels.TaskGroup_Panel();
            m_oRenameTaskGroupPanel = new Panels.ClassDes_RenameClass();

            /// <summary>
            /// create the location dictionary
            /// </summary>
            SystemLocationDict = new Dictionary<Guid, SystemListObject>();
            SystemLocationGuidDict = new Dictionary<Guid, string>();

            /// <summary>
            /// setup viewmodel:
            /// Bind TG Selection Combo Box.
            /// Bind faction Selection as well.
            /// </summary>
            VM = new ViewModels.TaskGroupViewModel();

            OrgSelectedTGList = new BindingList<TaskGroupTN>();

            /// <summary>
            /// Set up the faction bindings. FactionSelectionComboBox is in the TaskGroup_Panel.designer.cs file.
            /// </summary>
            m_oTaskGroupPanel.FactionSelectionComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oTaskGroupPanel.FactionSelectionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oTaskGroupPanel.FactionSelectionComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => CurrentFaction = VM.CurrentFaction;
            CurrentFaction = VM.CurrentFaction;
            m_oTaskGroupPanel.FactionSelectionComboBox.SelectedIndexChanged += (s, args) => m_oTaskGroupPanel.FactionSelectionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTaskGroupPanel.FactionSelectionComboBox.SelectedIndexChanged += new EventHandler(FactionSelectComboBox_SelectedIndexChanged);


            /// <summary>
            /// Bind the TaskGroup to the appropriate combo box.
            /// </summary>
            m_oTaskGroupPanel.TaskGroupSelectionComboBox.Bind(c => c.DataSource, VM, d => d.TaskGroups);
            m_oTaskGroupPanel.TaskGroupSelectionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentTaskGroup, DataSourceUpdateMode.OnPropertyChanged);
            m_oTaskGroupPanel.TaskGroupSelectionComboBox.DisplayMember = "Name";
            VM.TaskGroupChanged += (s, args) => CurrentTaskGroup = VM.CurrentTaskGroup;
            CurrentTaskGroup = VM.CurrentTaskGroup;
            m_oTaskGroupPanel.TaskGroupSelectionComboBox.SelectedIndexChanged += (s, args) => m_oTaskGroupPanel.TaskGroupSelectionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oTaskGroupPanel.TaskGroupSelectionComboBox.SelectedIndexChanged += new EventHandler(TaskGroupSelectComboBox_SelectedIndexChanged);

            /// <summary>
            /// Setup TG Data Grid:
            /// </summary>
            m_oTaskGroupPanel.TaskGroupDataGrid.SelectionMode = DataGridViewSelectionMode.CellSelect;
            m_oTaskGroupPanel.TaskGroupDataGrid.RowHeadersVisible = false;
            m_oTaskGroupPanel.TaskGroupDataGrid.AutoGenerateColumns = false;
            SetupShipDataGrid();

            m_oTaskGroupPanel.SystemLocationsListBox.SelectedIndexChanged += new EventHandler(SystemLocationListBox_SelectedIndexChanged);
            m_oTaskGroupPanel.DisplayContactsCheckBox.CheckStateChanged += new EventHandler(DisplayContactsCheckBox_CheckChanged);
            m_oTaskGroupPanel.DisplayTaskGroupsCheckBox.CheckStateChanged += new EventHandler(DisplayTaskGroupsCheckBox_CheckChanged);
            m_oTaskGroupPanel.DisplayWaypointsCheckBox.CheckStateChanged += new EventHandler(DisplayWaypointsCheckBox_CheckChanged);
            m_oTaskGroupPanel.OrderFilteringCheckBox.CheckStateChanged += new EventHandler(OrderFilteringCheckBox_CheckChanged);

            m_oTaskGroupPanel.NewTaskGroupButton.Click += new EventHandler(NewTaskGroupButton_Click);
            m_oTaskGroupPanel.RenameTaskGroupButton.Click += new EventHandler(RenameTaskGroupButton_Click);
            m_oTaskGroupPanel.SetSpeedButton.Click += new EventHandler(SetSpeedButton_Clicked);
            m_oTaskGroupPanel.MaxSpeedButton.Click += new EventHandler(MaxSpeedButton_Clicked);
            m_oTaskGroupPanel.AddMoveButton.Click += new EventHandler(AddMoveButton_Clicked);
            m_oTaskGroupPanel.RemoveButton.Click += new EventHandler(RemoveButton_Clicked);
            m_oTaskGroupPanel.RemoveAllButton.Click += new EventHandler(RemoveAllButton_Clicked);

            m_oTaskGroupPanel.CurrentTDRadioButton.CheckedChanged += new EventHandler(CurrentTDRadioButton_CheckChanged);
            m_oTaskGroupPanel.AllOrdersTDRadioButton.CheckedChanged += new EventHandler(AllOrdersTDRadioButton_CheckChanged);

            m_oTaskGroupPanel.AvailableActionsListBox.MouseDoubleClick += new MouseEventHandler(AddMoveButton_Clicked);
            m_oTaskGroupPanel.SystemLocationsListBox.MouseDoubleClick += new MouseEventHandler(AddMoveButton_Clicked);
            m_oTaskGroupPanel.PlottedMovesListBox.MouseDoubleClick += new MouseEventHandler(RemoveButton_Clicked);

            //m_oTaskGroupPanel.PlottedMovesListBox.SelectedIndexChanged += new EventHandler(PlottedMovesListBox_SelectedIndexChanged);
            m_oTaskGroupPanel.PlottedMovesListBox.MouseDown += new MouseEventHandler(PlottedMovesListBox_MouseDown);
            SelectedOrderIndex = m_oTaskGroupPanel.PlottedMovesListBox.SelectedIndex;

            #region Organization Tab
            m_oTaskGroupPanel.OrgSelectedTGComboBox.SelectedIndexChanged += new EventHandler(OrgSelectedTGComboBox_SelectedIndexChanged);
            m_oTaskGroupPanel.OrgMoveLeftButton.Click += new EventHandler(OrgMoveLeftButton_Click);
            m_oTaskGroupPanel.OrgMoveRightButton.Click += new EventHandler(OrgMoveRightButton_Click);
            #endregion


            /// <summary>
            /// Rename Class Button Handlers:
            /// </summary>
            m_oRenameTaskGroupPanel.NewClassNameLabel.Text = "Please enter a new taskgroup name";
            m_oRenameTaskGroupPanel.OKButton.Click += new EventHandler(OKButton_Click);
            m_oRenameTaskGroupPanel.CancelRenameButton.Click += new EventHandler(CancelRenameButton_Click);
            m_oRenameTaskGroupPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

            RefreshTGPanel();
        }
Ejemplo n.º 2
0
        public ClassDesign()
        {

            ComponentAmt = 1;
            MissileAmt = 1;

            TotalComponents = 0;

            CLBSet = false;
            CDGSet = false;

            CompLocation = new BindingList<int>();

            // create panels:
            //m_oClassPropertiesPanel = new Panels.ClassDes_Properties();
            //m_oDesignAndInformationPanel = new Panels.ClassDes_DesignAndInfo();
            m_oOptionsPanel = new Panels.ClassDes_Options();
            m_oRenameClassPanel = new Panels.ClassDes_RenameClass();

            //m_oClassPropertiesPanel.ClassPropertyGrid.PropertySort = PropertySort.CategorizedAlphabetical;

            // creat ViewModel.
            VM = new ClassDesignViewModel();

            /// <summary>
            /// setup bindings:
            /// </summary>
            m_oOptionsPanel.FactionComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oOptionsPanel.FactionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oOptionsPanel.FactionComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => CurrentFaction = VM.CurrentFaction;
            CurrentFaction = VM.CurrentFaction;

            m_oOptionsPanel.FactionComboBox.SelectedIndexChanged += (s, args) => m_oOptionsPanel.FactionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oOptionsPanel.FactionComboBox.SelectedIndexChanged += new EventHandler(FactionComboBox_SelectedIndexChanged);


            m_oOptionsPanel.ClassComboBox.Bind(c => c.DataSource, VM, d => d.ShipDesigns);
            m_oOptionsPanel.ClassComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentShipClass, DataSourceUpdateMode.OnPropertyChanged);
            m_oOptionsPanel.ClassComboBox.DisplayMember = "Name";
            VM.ShipClassChanged += (s, args) => CurrentShipClass = VM.CurrentShipClass;
            CurrentShipClass = VM.CurrentShipClass;
            m_oOptionsPanel.ClassComboBox.SelectedIndexChanged += (s, args) => m_oOptionsPanel.ClassComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oOptionsPanel.ClassComboBox.SelectedIndexChanged += new EventHandler(ClassComboBox_SelectedIndexChanged);

            m_oOptionsPanel.Notes.Bind(c => c.Text, VM, d => d.CurrentShipClassNotes);

            //if (VM.CurrentShipClass != null)
            //{
            //    m_oClassPropertiesPanel.ClassPropertyGrid.SelectedObject = VM.CurrentShipClass;
            //}


            // Setup Events:
            m_oOptionsPanel.NewButton.Click += new EventHandler(NewButton_Click);

            m_oOptionsPanel.SizeInTonsCheckBox.CheckStateChanged += new EventHandler(SizeInTonsCheckBox_CheckedStateChanged);
            m_oOptionsPanel.GroupComponentsCheckBox.CheckStateChanged += new EventHandler(GroupComponentsCheckBox_CheckStateChanged);

            m_oOptionsPanel.OneRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.FiveRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.TenRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.HundredRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);

            m_oOptionsPanel.ObsoleteCompButton.Click += new EventHandler(ObsoleteCompButton_Click);

            if (CurrentFaction != null)
            {
                if (CurrentFaction.ShipDesigns.Count != 0)
                    CurrentShipClass = CurrentFaction.ShipDesigns[0];
            }

            m_oOptionsPanel.ComponentDataGrid.SelectionMode = DataGridViewSelectionMode.CellSelect;
            m_oOptionsPanel.ComponentDataGrid.RowHeadersVisible = false;
            m_oOptionsPanel.ComponentDataGrid.AutoGenerateColumns = false;
            m_oOptionsPanel.ComponentDataGrid.SelectionChanged += new EventHandler(ComponentDataGrid_SelectionChanged);
            m_oOptionsPanel.ComponentDataGrid.DoubleClick += new EventHandler(ComponentDataGrid_DoubleClick);
            SetupComponentDataGrid();

            m_oOptionsPanel.ComponentsListBox.SelectedIndexChanged += new EventHandler(ComponentsListBox_SelectedIndexChanged);
            m_oOptionsPanel.ComponentsListBox.DoubleClick += new EventHandler(ComponentsListBox_DoubleClick);

            /// <summary>
            /// options checkbox handlers:
            /// </summary>
            m_oOptionsPanel.TankerCheckBox.CheckedChanged += new System.EventHandler(this.TankerCheckbox_Changed);
            m_oOptionsPanel.CollierCheckBox.CheckedChanged += new System.EventHandler(this.CollierCheckbox_Changed);
            m_oOptionsPanel.SupplyShipCheckBox.CheckedChanged += new System.EventHandler(this.SupplyCheckbox_Changed);

            /// <summary>
            /// Button click handlers:
            /// </summary>
            m_oOptionsPanel.RefreshTechButton.Click += new EventHandler(RefreshTechButton_Click);
            m_oOptionsPanel.AddButton.Click += new EventHandler(AddButton_Click);
            m_oOptionsPanel.RemoveButton.Click += new EventHandler(RemoveButton_Click);
            m_oOptionsPanel.ArmourUpButton.Click += new EventHandler(ArmourUpButton_Click);
            m_oOptionsPanel.ArmourDownButton.Click += new EventHandler(ArmourDownButton_Click);
            m_oOptionsPanel.NewArmorButton.Click += new EventHandler(NewArmorButton_Click);
            m_oOptionsPanel.DesignTechButton.Click += new EventHandler(DesignTechButton_Click);
            m_oOptionsPanel.RenameButton.Click += new EventHandler(RenameButton_Click);
            m_oOptionsPanel.SaveNotes.Click += new EventHandler(SaveNotesButton_Click);

            /// <summary>
            /// Rename Class Button Handlers:
            /// </summary>
            m_oRenameClassPanel.OKButton.Click += new EventHandler(OKButton_Click);
            m_oRenameClassPanel.CancelRenameButton.Click += new EventHandler(CancelRenameButton_Click);
            m_oRenameClassPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

            m_oOptionsPanel.DeploymentTimeTextBox.TextChanged += new EventHandler(DeploymentTimeTextBox_TextChanged);


            /// <summary>
            /// Ordnance and fighter tab:
            /// </summary>
            m_oOptionsPanel.OF1xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF10xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF100xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF1000xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.MissileDataGrid.DoubleClick += new EventHandler(MissileDataGrid_DoubleClick);
            m_oOptionsPanel.PreferredOrdnanceListBox.DoubleClick += new EventHandler(PreferredOrdnanceListBox_DoubleClick);
            m_oOptionsPanel.MslObsButton.Click += new EventHandler(MslObsButton_Click);
            m_oOptionsPanel.ShowObsMslCheckBox.CheckedChanged += new EventHandler(ShowObsMslCheckBox_CheckedChanged);
            m_oOptionsPanel.IgnoreMslSizeCheckBox.CheckedChanged += new EventHandler(IgnoreMslSizeCheckBox_CheckedChanged);
            SetupMissileDataGrid();

            UpdateDisplay();

        }
Ejemplo n.º 3
0
        public ClassDesign()
        {

            ComponentAmt = 1;
            MissileAmt = 1;

            TotalComponents = 0;

            CLBSet = false;
            CDGSet = false;

            CompLocation = new BindingList<int>();

            ToolTip toolTip = new ToolTip();
            toolTip.AutoPopDelay = 5000;
            toolTip.InitialDelay = 1000;
            toolTip.ReshowDelay = 500;
            toolTip.ShowAlways = true;

            // create panels:
            //m_oClassPropertiesPanel = new Panels.ClassDes_Properties();
            //m_oDesignAndInformationPanel = new Panels.ClassDes_DesignAndInfo();
            m_oOptionsPanel = new Panels.ClassDes_Options();
            m_oRenameClassPanel = new Panels.ClassDes_RenameClass();

            //m_oClassPropertiesPanel.ClassPropertyGrid.PropertySort = PropertySort.CategorizedAlphabetical;

            // creat ViewModel.
            VM = new ClassDesignViewModel();

            /// <summary>
            /// setup bindings:
            /// </summary>
            m_oOptionsPanel.FactionComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oOptionsPanel.FactionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oOptionsPanel.FactionComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => CurrentFaction = VM.CurrentFaction;
            CurrentFaction = VM.CurrentFaction;

            m_oOptionsPanel.FactionComboBox.SelectedIndexChanged += (s, args) => m_oOptionsPanel.FactionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oOptionsPanel.FactionComboBox.SelectedIndexChanged += new EventHandler(FactionComboBox_SelectedIndexChanged);


            m_oOptionsPanel.ClassComboBox.Bind(c => c.DataSource, VM, d => d.ShipDesigns);
            m_oOptionsPanel.ClassComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentShipClass, DataSourceUpdateMode.OnPropertyChanged);
            m_oOptionsPanel.ClassComboBox.DisplayMember = "Name";
            VM.ShipClassChanged += (s, args) => CurrentShipClass = VM.CurrentShipClass;
            CurrentShipClass = VM.CurrentShipClass;
            m_oOptionsPanel.ClassComboBox.SelectedIndexChanged += (s, args) => m_oOptionsPanel.ClassComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oOptionsPanel.ClassComboBox.SelectedIndexChanged += new EventHandler(ClassComboBox_SelectedIndexChanged);

            m_oOptionsPanel.Notes.Bind(c => c.Text, VM, d => d.CurrentShipClassNotes);

            //if (VM.CurrentShipClass != null)
            //{
            //    m_oClassPropertiesPanel.ClassPropertyGrid.SelectedObject = VM.CurrentShipClass;
            //}


            // Setup Events:
            m_oOptionsPanel.NewButton.Click += new EventHandler(NewButton_Click);

            m_oOptionsPanel.SizeInTonsCheckBox.CheckStateChanged += new EventHandler(SizeInTonsCheckBox_CheckedStateChanged);
            m_oOptionsPanel.GroupComponentsCheckBox.CheckStateChanged += new EventHandler(GroupComponentsCheckBox_CheckStateChanged);

            m_oOptionsPanel.OneRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.FiveRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.TenRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);
            m_oOptionsPanel.HundredRadioButton.CheckedChanged += new EventHandler(AMTRadioButton_CheckedChanged);

            m_oOptionsPanel.ObsoleteCompButton.Click += new EventHandler(ObsoleteCompButton_Click);

            if (CurrentFaction != null)
            {
                if (CurrentFaction.ShipDesigns.Count != 0)
                    CurrentShipClass = CurrentFaction.ShipDesigns[0];
            }

            m_oOptionsPanel.ComponentDataGrid.SelectionMode = DataGridViewSelectionMode.CellSelect;
            m_oOptionsPanel.ComponentDataGrid.RowHeadersVisible = false;
            m_oOptionsPanel.ComponentDataGrid.AutoGenerateColumns = false;
            m_oOptionsPanel.ComponentDataGrid.SelectionChanged += new EventHandler(ComponentDataGrid_SelectionChanged);
            m_oOptionsPanel.ComponentDataGrid.DoubleClick += new EventHandler(ComponentDataGrid_DoubleClick);
            SetupComponentDataGrid();

            m_oOptionsPanel.ComponentsListBox.SelectedIndexChanged += new EventHandler(ComponentsListBox_SelectedIndexChanged);
            m_oOptionsPanel.ComponentsListBox.DoubleClick += new EventHandler(ComponentsListBox_DoubleClick);

            /// <summary>
            /// options checkbox handlers:
            /// </summary>
            m_oOptionsPanel.TankerCheckBox.CheckedChanged += new System.EventHandler(this.TankerCheckbox_Changed);
            m_oOptionsPanel.CollierCheckBox.CheckedChanged += new System.EventHandler(this.CollierCheckbox_Changed);
            m_oOptionsPanel.SupplyShipCheckBox.CheckedChanged += new System.EventHandler(this.SupplyCheckbox_Changed);

            /// <summary>
            /// set checkbox tooltips:
            /// </summary>
            toolTip.SetToolTip(m_oOptionsPanel.TankerCheckBox, "Clicking this button will designate the ship as a fuel tanker. This allows the ship to carry out fuel delivery orders.");
            toolTip.SetToolTip(m_oOptionsPanel.CollierCheckBox, "Clicking this button will designate the ship as an ammunition collier. When a fleet reloads magazines during a turn, they will reload from the magazines of any colliers in the fleet.");
            toolTip.SetToolTip(m_oOptionsPanel.ConscriptCheckBox, "Checking this box means that all new ships of that class will use conscript-only crews.");
            toolTip.SetToolTip(m_oOptionsPanel.ObsoleteCheckBox, "Checking this box will stop this class appearing in lists for construction or refit.");
            toolTip.SetToolTip(m_oOptionsPanel.SupplyShipCheckBox, "Clicking this button will designate the ship as a maintenance supply ship.");
            toolTip.SetToolTip(m_oOptionsPanel.SizeInTonsCheckBox, "If this box is checked, sizes will be shown in tons rather than hull spaces (1 HS = 50 tons).");
            toolTip.SetToolTip(m_oOptionsPanel.KeepExcessQuarters, "Do not automatically remove crew quarters beyond those needed for the normal crew. This is useful for carriers to leave Q available for the flight crews.");

            /// <summary>
            /// Button click handlers:
            /// </summary>
            m_oOptionsPanel.RefreshTechButton.Click += new EventHandler(RefreshTechButton_Click);
            m_oOptionsPanel.AddButton.Click += new EventHandler(AddButton_Click);
            m_oOptionsPanel.RemoveButton.Click += new EventHandler(RemoveButton_Click);
            m_oOptionsPanel.ArmourUpButton.Click += new EventHandler(ArmourUpButton_Click);
            m_oOptionsPanel.ArmourDownButton.Click += new EventHandler(ArmourDownButton_Click);
            m_oOptionsPanel.NewArmorButton.Click += new EventHandler(NewArmorButton_Click);
            m_oOptionsPanel.DesignTechButton.Click += new EventHandler(DesignTechButton_Click);
            m_oOptionsPanel.RenameButton.Click += new EventHandler(RenameButton_Click);
            m_oOptionsPanel.SaveNotes.Click += new EventHandler(SaveNotesButton_Click);

            /// <summary>
            /// Rename Class Button Handlers:
            /// </summary>
            m_oRenameClassPanel.OKButton.Click += new EventHandler(OKButton_Click);
            m_oRenameClassPanel.CancelRenameButton.Click += new EventHandler(CancelRenameButton_Click);
            m_oRenameClassPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

            m_oOptionsPanel.DeploymentTimeTextBox.TextChanged += new EventHandler(DeploymentTimeTextBox_TextChanged);


            /// <summary>
            /// Ordnance and fighter tab:
            /// </summary>
            m_oOptionsPanel.OF1xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF10xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF100xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.OF1000xRadioButton.CheckedChanged += new EventHandler(MslAMTRadioButton_CheckedChanged);
            m_oOptionsPanel.MissileDataGrid.DoubleClick += new EventHandler(MissileDataGrid_DoubleClick);
            m_oOptionsPanel.PreferredOrdnanceListBox.DoubleClick += new EventHandler(PreferredOrdnanceListBox_DoubleClick);
            m_oOptionsPanel.MslObsButton.Click += new EventHandler(MslObsButton_Click);
            m_oOptionsPanel.ShowObsMslCheckBox.CheckedChanged += new EventHandler(ShowObsMslCheckBox_CheckedChanged);
            m_oOptionsPanel.IgnoreMslSizeCheckBox.CheckedChanged += new EventHandler(IgnoreMslSizeCheckBox_CheckedChanged);
            SetupMissileDataGrid();

            UpdateDisplay();

        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor for missile design handler.
        /// </summary>
        public MissileDesignHandler()
        {
            m_oMissileDesignPanel = new Panels.MissileDesign();
            m_oNameSeriesPanel = new Panels.ClassDes_RenameClass();


            VM = new MissileDesignViewModel();

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

            /// <summary>
            /// Binding missile engines to the appropriate combo box.
            /// </summary>
            m_oMissileDesignPanel.MissileEngineComboBox.Bind(c => c.DataSource, VM, d => d.MissileEngines);
            m_oMissileDesignPanel.MissileEngineComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissileEngine, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.MissileEngineComboBox.DisplayMember = "Name";
            VM.MissileEngineChanged += (s, args) => _CurrnetMissileEngine = VM.CurrentMissileEngine;
            _CurrnetMissileEngine = VM.CurrentMissileEngine;
            m_oMissileDesignPanel.MissileEngineComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.MissileEngineComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.MissileEngineComboBox.SelectedIndexChanged += new EventHandler(MissileEngineComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.MSeriesComboBox.Bind(c => c.DataSource, VM, d => d.MissileSeries);
            m_oMissileDesignPanel.MSeriesComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissileSeries, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.MSeriesComboBox.DisplayMember = "Name";
            VM.MissileSeriesChanged += (s, args) => _CurrnetMissileSeries = VM.CurrentMissileSeries;
            _CurrnetMissileSeries = VM.CurrentMissileSeries;
            m_oMissileDesignPanel.MSeriesComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.MSeriesComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.MSeriesComboBox.SelectedIndexChanged += new EventHandler(MSeriesComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.PreviousOrdnanceComboBox.Bind(c => c.DataSource, VM, d => d.Missiles);
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissile, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.DisplayMember = "Name";
            VM.MissileChanged += (s, args) => _CurrnetMissile = VM.CurrentMissile;
            _CurrnetMissile = VM.CurrentMissile;
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.PreviousOrdnanceComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.SelectedIndexChanged += new EventHandler(PreviousOrdnanceComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.SubMunitionComboBox.SelectedIndexChanged += new EventHandler(SubMunitionComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.CloseMDButton.Click += new EventHandler(CloseMDButton_Click);

            m_oMissileDesignPanel.NumEnginesTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.WHMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.FuelMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.AgilityMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.ActiveMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ThermalMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.EMMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.GeoMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ResolutionTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.ArmourMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ECMMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.LaserWCheckBox.CheckedChanged += new EventHandler(LWCheckBox_CheckedChanged);
            m_oMissileDesignPanel.ERCheckBox.CheckedChanged += new EventHandler(ERCheckBox_CheckedChanged);

            m_oMissileDesignPanel.CreateSeriesButton.Click += new EventHandler(CreateSeriesButton_Click);
            m_oMissileDesignPanel.DeleteSeriesButton.Click += new EventHandler(DeleteSeriesButton_Click);
            m_oMissileDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);
            m_oMissileDesignPanel.ClearDesignButton.Click += new EventHandler(ClearDesignButton_Click);
            m_oMissileDesignPanel.SetSeriesButton.Click += new EventHandler(SetSeriesButton_Click);
            m_oMissileDesignPanel.ReplaceAllButton.Click += new EventHandler(ReplaceAllButton_Click);
            m_oMissileDesignPanel.CreateMissileButton.Click += new EventHandler(CreateMissileButton_Click);
            m_oMissileDesignPanel.ToggleInfoButton.Click += new EventHandler(ToggleInfoButton_Click);

            m_oMissileDesignPanel.SepRangeTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.SubNumberTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);


            m_oNameSeriesPanel.NewClassNameLabel.Text = "Please enter the name of the new Missile Series";
            m_oNameSeriesPanel.OKButton.Click += new EventHandler(OKButton_Click);
            m_oNameSeriesPanel.CancelRenameButton.Click += new EventHandler(CancelRenameButton_Click);
            m_oNameSeriesPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

            InfoToggle = false;

            m_oMissileDesignPanel.TechDataGrid.SelectionMode = DataGridViewSelectionMode.CellSelect;
            m_oMissileDesignPanel.TechDataGrid.RowHeadersVisible = false;
            m_oMissileDesignPanel.TechDataGrid.AutoGenerateColumns = false;
            SetupTechDataGrid();
        }