public void Refresh(RefreshDirection direction) { switch (direction) { case RefreshDirection.Right: if (_indx == _items.Count - 1) { return; } _indx++; break; case RefreshDirection.Left: if (_indx - (ItemsPerFrame - 1) <= 0) { return; } _indx--; break; } HidePreviousItems(_currentItems); _currentItems = LoadNewItems(_indx); RepositionItems(); RenderNewItems(_currentItems); }
/// <summary> /// Returns true if any change was actually made /// </summary> private bool RefreshMatrixOrTextBoxes(RefreshDirection direction) { this.suspendAutoRefresh = true; bool different = false; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { bool result = false; switch (direction) { case RefreshDirection.FromMatrix: result = RefreshTextBox(i, j); break; case RefreshDirection.FromTextboxes: try { result = RefreshMatrix(i, j); } catch (Exception) { //ResetMatrix(); throw new Exception("Invalid matrix!"); } break; default: throw new Exception("F**k you!"); } if (result) { different = true; } } } this.suspendAutoRefresh = false; if (different) { OnMatrixChanged(); } return(different); }