internal LedController(LedControllerConnector connector) { InitializeComponent(); VM = new LedControllerViewModel(connector, () => FreeTextTextBox.Focus(), () => FullTextTextBox.Focus()); DataContext = VM; }
internal LedControllerViewModel(LedControllerConnector connector, Action focusToFreeTextTextBoxAction, Action focusToFullTextTextBoxAction) { this.connector = connector; ShortcutCancel = new DelegateCommand(() => { Shortcut = ""; }); PartCancel = new DelegateCommand(() => { Part = ""; }); GroupCancel = new DelegateCommand(() => { Group = ""; }); DefCancel = new DelegateCommand(() => { Def = ""; }); ShortcutDown = new DelegateCommand(() => { if (ShortcutCur - 1 < ShortcutCollection.Count) { ShortcutCur += 1; } }); PartDown = new DelegateCommand(() => { if (PartCur - 1 < PartCollection.Count) { PartCur += 1; } }); GroupDown = new DelegateCommand(() => { if (GroupCur - 1 < GroupCollection.Count) { GroupCur += 1; } }); DefDown = new DelegateCommand(() => { if (DefCur - 1 < DefCollection.Count) { DefCur += 1; } }); ShortcutUp = new DelegateCommand(() => { if (ShortcutCur != 0) { ShortcutCur -= 1; } }); PartUp = new DelegateCommand(() => { if (PartCur != 0) { PartCur -= 1; } }); GroupUp = new DelegateCommand(() => { if (GroupCur != 0) { GroupCur -= 1; } }); DefUp = new DelegateCommand(() => { if (DefCur != 0) { DefCur -= 1; } }); Initialize(focusToFreeTextTextBoxAction, focusToFullTextTextBoxAction); }