private void imgHexMap_MapDrag(object sender, MapEventArgs e) { if (_lockControls) { return; } if (e.Button == MouseButtons.Left || (e.Button == MouseButtons.Right && _currentDrawingTool == DrawingTools.FogOfWar)) { if (_lastDraggedHex == null || !_lastDraggedHex.Equals(e.HexScreenCoordinate)) { _lastDraggedHex = e.HexScreenCoordinate; imgHexMap_MapClick(sender, e); } } }
private void txtDetail_TextChanged(object sender, System.EventArgs e) { if (_selectedCoordinate == null) { txtDetail.Text = "No hex selected"; return; } //If the last scheduled detail update was to this hex, unschedule it, since we are making a new one (for this hex) if (_saveDetailTimer != null && _lastScheduledDetailSave.Equals(_selectedCoordinate)) { _saveDetailTimer.Dispose(); } //Schedule a detail update after 1 second (so we wait to update until the user is done typing) TimerCallback callback = SaveDetailText; object[] state = { _selectedCoordinate, txtDetail.Text }; _saveDetailTimer = new Timer(callback, state, TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(-1)); //Update which hex is scheduled for an update, for use next time this event gets called _lastScheduledDetailSave = _selectedCoordinate; }