private void AddActionButton_Click(object sender, RoutedEventArgs e) { if (this.TypeComboBox.SelectedIndex >= 0) { ActionTypeEntry type = (ActionTypeEntry)this.TypeComboBox.SelectedItem; ActionContainerControl actionControl = new ActionContainerControl(this.window, this, type.Type); this.AddActionControlContainer(actionControl); this.TypeComboBox.SelectedIndex = -1; } }
protected override async Task OnLoaded() { if (!hasLoaded) { List <ActionTypeEntry> actionTypes = new List <ActionTypeEntry>(); foreach (ActionTypeEnum actionType in EnumHelper.GetEnumList <ActionTypeEnum>()) { ActionTypeEntry entry = new ActionTypeEntry() { Name = EnumHelper.GetEnumName(actionType), Type = actionType }; switch (entry.Type) { case ActionTypeEnum.Custom: continue; case ActionTypeEnum.Chat: entry.Name += " Message"; break; case ActionTypeEnum.Counter: entry.Name += " (Create & Update)"; break; case ActionTypeEnum.Input: entry.Name += " (Keyboard & Mouse)"; break; case ActionTypeEnum.Overlay: entry.Name += " (Images & Videos)"; break; case ActionTypeEnum.File: entry.Name += " (Read & Write)"; break; default: break; } actionTypes.Add(entry); } this.TypeComboBox.ItemsSource = actionTypes.OrderBy(at => at.Name); this.ActionsListView.ItemsSource = this.actionControls; this.CommandDetailsGrid.Visibility = Visibility.Visible; this.CommandDetailsGrid.Children.Add(this.commandDetailsControl); await this.commandDetailsControl.Initialize(); List <ActionBase> actions = new List <ActionBase>(); CommandBase command = this.commandDetailsControl.GetExistingCommand(); if (command != null) { actions.AddRange(command.Actions); } else if (initialActions != null) { actions.AddRange(initialActions); } foreach (ActionBase action in actions) { ActionContainerControl actionControl = new ActionContainerControl(this.window, this, action); actionControl.Minimize(); this.actionControls.Add(actionControl); actionControl.OnWindowSizeChanged(this.window.RenderSize); } } hasLoaded = true; await base.OnLoaded(); }