private void starMapColourToolStripMenuItem_Click(object sender, EventArgs e) { IEnumerable <DataGridViewRow> selectedRows = dataGridViewTravel.SelectedCells.Cast <DataGridViewCell>() .Select(cell => cell.OwningRow) .Distinct(); Color colour = selectedRows.First().Cells[4].Style.ForeColor; mapColorDialog.Color = colour; if (mapColorDialog.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; string sysName = ""; foreach (DataGridViewRow r in selectedRows) { r.Cells[4].Style.ForeColor = mapColorDialog.Color; sysName = r.Cells[1].Value.ToString(); SystemPosition sp = null; sp = (SystemPosition)r.Cells[1].Tag; if (sp == null) { sp = visitedSystems.First(s => s.Name.ToUpperInvariant() == sysName.ToUpperInvariant()); } if (sp.vs != null) { sp.vs.MapColour = mapColorDialog.Color.ToArgb(); sp.Update(); } } this.Cursor = Cursors.Default; } }
private void moveToAnotherCommanderToolStripMenuItem_Click(object sender, EventArgs e) { IEnumerable <DataGridViewRow> selectedRows = dataGridViewTravel.SelectedCells.Cast <DataGridViewCell>() .Select(cell => cell.OwningRow) .Distinct(); List <SystemPosition> listsyspos = new List <SystemPosition>(); { this.Cursor = Cursors.WaitCursor; string sysName = ""; foreach (DataGridViewRow r in selectedRows) { sysName = r.Cells[1].Value.ToString(); SystemPosition sp = null; sp = (SystemPosition)r.Cells[1].Tag; if (sp != null && sp.vs != null) { listsyspos.Add(sp); } } MoveToCommander movefrm = new MoveToCommander(); movefrm.Init(listsyspos.Count > 1); DialogResult red = movefrm.ShowDialog(); if (red == DialogResult.OK) { if (movefrm.checkBoxAllInNetlog.Checked == false) // Movel all in list. { foreach (SystemPosition sp in listsyspos) { sp.vs.Commander = movefrm.selectedCommander.Nr; sp.Update(); } this.Cursor = Cursors.Default; } else // Move all systems from the same session { } } this.Cursor = Cursors.Default; } }
private void hideSystemToolStripMenuItem_Click(object sender, EventArgs e) { IEnumerable <DataGridViewRow> selectedRows = dataGridViewTravel.SelectedCells.Cast <DataGridViewCell>() .Select(cell => cell.OwningRow) .Distinct(); { this.Cursor = Cursors.WaitCursor; string sysName = ""; foreach (DataGridViewRow r in selectedRows) { sysName = r.Cells[1].Value.ToString(); SystemPosition sp = null; sp = (SystemPosition)r.Cells[1].Tag; if (sp != null && sp.vs != null) { sp.vs.Commander = -1; sp.Update(); } } // Remove rows if (selectedRows.Count <DataGridViewRow>() == dataGridViewTravel.Rows.Count) { dataGridViewTravel.Rows.Clear(); } foreach (DataGridViewRow row in selectedRows.ToList <DataGridViewRow>()) { dataGridViewTravel.Rows.Remove(row); } this.Cursor = Cursors.Default; } }