StephaneLenclud@211: using System; StephaneLenclud@211: using System.Collections.Generic; StephaneLenclud@211: using System.ComponentModel; StephaneLenclud@211: using System.Data; StephaneLenclud@211: using System.Drawing; StephaneLenclud@211: using System.Linq; StephaneLenclud@211: using System.Text; StephaneLenclud@211: using System.Threading.Tasks; StephaneLenclud@211: using System.Windows.Forms; StephaneLenclud@211: using SharpLib.Ear; StephaneLenclud@211: StephaneLenclud@211: namespace SharpDisplayManager StephaneLenclud@211: { StephaneLenclud@214: /// StephaneLenclud@214: /// Used to populate our action type combobox with friendly names StephaneLenclud@214: /// StephaneLenclud@214: class ItemActionType StephaneLenclud@214: { StephaneLenclud@214: public Type Type; StephaneLenclud@214: StephaneLenclud@214: public ItemActionType(Type type) StephaneLenclud@214: { StephaneLenclud@214: this.Type = type; StephaneLenclud@214: } StephaneLenclud@214: StephaneLenclud@214: public override string ToString() StephaneLenclud@214: { StephaneLenclud@214: //Get friendly action name from action attribute. StephaneLenclud@214: //That we then show up in our combobox StephaneLenclud@214: return SharpLib.Utils.Reflection.GetAttribute(Type).Name; StephaneLenclud@214: } StephaneLenclud@214: } StephaneLenclud@214: StephaneLenclud@214: StephaneLenclud@214: StephaneLenclud@214: /// StephaneLenclud@214: /// Action edit dialog form. StephaneLenclud@214: /// StephaneLenclud@211: public partial class FormEditAction : Form StephaneLenclud@211: { StephaneLenclud@211: public SharpLib.Ear.Action Action = null; StephaneLenclud@211: StephaneLenclud@211: public FormEditAction() StephaneLenclud@211: { StephaneLenclud@211: InitializeComponent(); StephaneLenclud@211: } StephaneLenclud@211: StephaneLenclud@211: private void FormEditAction_Load(object sender, EventArgs e) StephaneLenclud@211: { StephaneLenclud@211: //Populate registered actions Stephane@212: foreach (string key in ManagerEventAction.Current.ActionTypes.Keys) StephaneLenclud@211: { StephaneLenclud@214: ItemActionType item = new ItemActionType(ManagerEventAction.Current.ActionTypes[key]); StephaneLenclud@214: comboBoxActionType.Items.Add(item); StephaneLenclud@211: } StephaneLenclud@211: StephaneLenclud@211: comboBoxActionType.SelectedIndex = 0; StephaneLenclud@211: } StephaneLenclud@211: StephaneLenclud@211: private void buttonOk_Click(object sender, EventArgs e) StephaneLenclud@211: { StephaneLenclud@214: Action = (SharpLib.Ear.Action)Activator.CreateInstance(((ItemActionType)comboBoxActionType.SelectedItem).Type); StephaneLenclud@211: } StephaneLenclud@211: StephaneLenclud@211: private void FormEditAction_Validating(object sender, CancelEventArgs e) StephaneLenclud@211: { StephaneLenclud@211: StephaneLenclud@211: } StephaneLenclud@211: } StephaneLenclud@211: }