public XElement SerializeItem(object item, object parentItem) { MixerInput input = item as MixerInput; if (input == null) { return(null); } XElement xmlElement = new XElement(TAG_NAME); xmlElement.SetAttributeValue(ATTRIBUTE_NAME, input.Name); xmlElement.SetAttributeValue(ATTRIBUTE_INDEX, input.Index); xmlElement.SetAttributeValue(ATTRIBUTE_SOURCE, ((input.Source != null) ? input.Source.SignalUniqueId : "")); return(xmlElement); }
public MixerInputTallyBoolean(MixerInput input, TallyColor color) : base(getName(input, color), getColor(color), getDescription(input, color)) { this.input = input; this.color = color; //input.IndexChanged += indexChangedHandler; input.NameChanged += nameChangedHandler; input.Mixer.IdChanged += routerIdChangedHandler; input.Mixer.NameChanged += routerNameChangedHandler; switch (color) { case TallyColor.Red: CurrentState = input.RedTally; input.RedTallyChanged += tallyChangedHandler; break; case TallyColor.Green: CurrentState = input.GreenTally; input.GreenTallyChanged += tallyChangedHandler; break; } }
private static string getDescription(MixerInput input, TallyColor color) => string.Format("The [(#{2}) {3}] input of mixer [(#{0}) {1}] has {4} tally.", input.Mixer.ID, input.Mixer.Name, input.Index, input.Name, getColorString(color));
private static string getName(MixerInput input, TallyColor color) => string.Format("mixer.{0}.input.{1}.{2}tally", input.Mixer.ID, input.Index, getColorString(color));
private void nameChangedHandler(MixerInput output, string oldName, string newName) { Description = getDescription(output, color); }
private void indexChangedHandler(MixerInput output, int oldIndex, int newIndex) { Name = getName(output, color); Description = getDescription(output, color); }
private void tallyChangedHandler(MixerInput output, bool newState) { CurrentState = newState; }