Пример #1
0
        private void GridExVillage_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                var rowCount = GridExVillage.SelectedItems.Count;
                if (rowCount == 1)
                {
                    var row = GridExVillage.CurrentRow;
                    if (row != null && row.RowType == RowType.Record)
                    {
                        VillageGridExRow record = GetVillageRow(row);

                        var contextMenu = new VillageContextMenu(World.Default.Map, record.Village, () => GridExVillage.Refresh());
                        contextMenu.Show(GridExVillage, e.Location);
                    }
                }
                else if (rowCount > 1)
                {
                    IEnumerable <Village> villages = GridExVillage.SelectedItems.GetRows <VillageGridExRow>().Select(x => x.Village);

                    var contextMenu = new VillagesContextMenu(World.Default.Map, villages.ToArray(), type => GridExVillage.Refresh());
                    contextMenu.Show(GridExVillage, e.Location);
                }
            }
        }
Пример #2
0
 private void GridExVillage_CurrentCellChanging(object sender, CurrentCellChangingEventArgs e)
 {
     if (e.Row != null && e.Row.RowType == RowType.Record)
     {
         VillageGridExRow row = GetVillageRow(e.Row);
         World.Default.Map.EventPublisher.SelectVillages(null, row.Village, VillageTools.PinPoint);
     }
     else
     {
         GridExVillage.ContextMenu = null;
     }
 }