Пример #1
0
        private void MenuMember_AddToGroup_Click( object sender, EventArgs e )
        {
            using ( var dialog = new DialogTextSelect( "グループの選択", "追加するグループを選択してください:",
                KCDatabase.Instance.ShipGroup.ShipGroups.Values.ToArray() ) ) {

                if ( dialog.ShowDialog( this ) == System.Windows.Forms.DialogResult.OK ) {

                    var group = (ShipGroupData)dialog.SelectedItem;
                    if ( group != null ) {
                        group.AddInclusionFilter( GetSelectedShipID() );

                        if ( group.ID == CurrentGroup.ID )
                            ChangeShipView( SelectedTab );
                    }

                }
            }
        }
Пример #2
0
        private void MenuMember_AddToGroup_Click( object sender, EventArgs e )
        {
            using ( var dialog = new DialogTextSelect( GeneralRes.SelectGroup, GeneralRes.SpecifySelectGroup,
                KCDatabase.Instance.ShipGroup.ShipGroups.Values.Where( g => g.GroupID >= 0 ).ToArray() ) ) {

                if ( dialog.ShowDialog( this ) == System.Windows.Forms.DialogResult.OK ) {

                    ShipGroupData group = (ShipGroupData)dialog.SelectedItem;
                    if ( group != null && group.GroupID >= 0 ) {

                        List<int> members = new List<int>( ShipView.Rows.GetRowCount( DataGridViewElementStates.Selected ) );

                        foreach ( DataGridViewRow row in ShipView.SelectedRows.OfType<DataGridViewRow>().OrderBy( r => r.Tag ) ) {

                            members.Add( (int)row.Cells[ShipView_ID.Index].Value );
                        }

                        group.Members.AddRange( members );
                        group.CheckMembers();
                    }
                }
            }
        }