/// <summary> /// Initiate a Trainer instance wit given dictionnary of verbs and train Parameters. /// Once initiated, Trainer will automatically prepare the next verbs queue. /// </summary> public Trainer(Dictionary <string, Verb> dict, OptionsArgs param) { durationSW = new Stopwatch(); remainingTimerCheckerTimer = new Timer(100); remainingTimerCheckerTimer.Elapsed += RemainingTimerCheckerTimer_Elapsed; Dict = dict; Parameters = param; RunningVerbIndex = -1; }
public Task UpdateOptionsReceived(object sender, OptionsArgs args) { if (messageHub.Options == null) { messageHub.Options = args.Options; } this.Dispatcher.Invoke(() => { ManualCommands.Items.Clear(); }); foreach (var(group, buttons) in messageHub.Options) { this.Dispatcher.Invoke(() => { var tabItem = new TabItem { Header = group.ToString(), Content = new ScrollViewer { HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Content = new WrapPanel() } }; foreach (var button in buttons) { var uiButton = new Button { Content = button.Name, Margin = new Thickness(10, 10, 10, 10) }; uiButton.Click += (sender, e) => { this.OpenPopup(button.SubMethodParams, group); }; ((WrapPanel)((ScrollViewer)tabItem.Content).Content).Children.Add(uiButton); } ManualCommands.Items.Add(tabItem); }); } return(null); }
private static void SendUpdateOptionsReceived(object sender, OptionsArgs e) { OnUpdateOptionsReceived?.Invoke(sender, e); }