private void MoveRight(bool controlPressed) { PropertySelectionItem selectedPropItem = PropertyItems.Where(x => x.Selected).FirstOrDefault(); if (CurrentPositionInProperty < selectedPropItem.Value.Length) { int stepCount = 5; if (controlPressed) { int maxStepCount = selectedPropItem.Value.Length - CurrentPositionInProperty; if (CurrentPositionInProperty + stepCount <= selectedPropItem.Value.Length) { CurrentPositionInProperty += stepCount; } else { CurrentPositionInProperty += maxStepCount; } } else { CurrentPositionInProperty++; } DrawProperties(selectedPropItem); } }
private void WriteChar(char chr) { PropertySelectionItem selectedPropItem = PropertyItems.Where(x => x.Selected).FirstOrDefault(); selectedPropItem.Value = selectedPropItem.Value.Insert(CurrentPositionInProperty, chr.ToString()); CurrentPositionInProperty++; DrawProperties(selectedPropItem); }
//private bool PressedModifier(ConsoleModifiers modifier) => pressedKey.Modifiers & ConsoleModifiers.Control != 0; private void MoveLeft(bool controlPressed) { if (CurrentPositionInProperty > 0) { PropertySelectionItem selectedPropItem = PropertyItems.Where(x => x.Selected).FirstOrDefault(); int stepCount = 5; if (controlPressed) { if (CurrentPositionInProperty >= stepCount) { CurrentPositionInProperty -= stepCount; } else { CurrentPositionInProperty -= CurrentPositionInProperty; } } else { CurrentPositionInProperty--; } DrawProperties(selectedPropItem); } }
private void EraseChar() { if (CurrentPositionInProperty > 0) { CurrentPositionInProperty--; PropertySelectionItem selectedPropItem = PropertyItems.Where(x => x.Selected).FirstOrDefault(); selectedPropItem.Value = selectedPropItem.Value.Remove(CurrentPositionInProperty, 1); DrawProperties(selectedPropItem); } }