private void ProcessTextBlock(FrameworkElement item) { var _tag = (string)item.Tag; var props = ParseTag(_tag); if (props.Count > 0) { if (props.ContainsKey("Type")) { switch (props["Type"]) { case "Team": case "Score": var key = props["Number"]; if (!_teamSet.ContainsKey(key)) { var _data = new Data.TeamData(); if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Description")) { _data.Description = props["Description"]; } BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding(props["Type"] == "Team" ? "Name" : "Score") { Source = _data, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); _settings.Teams.Add(_data); _teamSet.Add(key, _settings.Teams.Count - 1); } else { BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding(props["Type"] == "Team" ? "Name" : "Score") { Source = _settings.Teams[_teamSet[key]], UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); } if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Description")) { _settings.Teams[_teamSet[key]].Description = props["Description"]; } if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Default")) { _settings.Teams[_teamSet[key]].Name = props["Default"]; } break; case "Stopwatch": var _sdata = new Data.StopwatchData(); BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding("Time") { Source = _sdata, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); _settings.Teams.Add(_sdata); break; } } } }
private void ProcessTextBlock(FrameworkElement item) { var _tag = (string)item.Tag; var props = ParseTag(_tag); if (props.Count > 0) { if (props.ContainsKey("Type")) { switch (props["Type"]) { case "Team": case "Score": var key = props["Number"]; if (!_teamSet.ContainsKey(key)) { var _data = new Data.TeamData(); if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Description")) _data.Description = props["Description"]; BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding(props["Type"] == "Team" ? "Name" : "Score") { Source = _data, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); _settings.Teams.Add(_data); _teamSet.Add(key, _settings.Teams.Count - 1); } else BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding(props["Type"] == "Team" ? "Name" : "Score") { Source = _settings.Teams[_teamSet[key]], UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Description")) _settings.Teams[_teamSet[key]].Description = props["Description"]; if (props.ContainsKey("Type") && props["Type"] == "Team" && props.ContainsKey("Default")) _settings.Teams[_teamSet[key]].Name = props["Default"]; break; case "Stopwatch": var _sdata = new Data.StopwatchData(); BindingOperations.SetBinding(item, item is TextBlock ? TextBlock.TextProperty : vMixTitleLibrary.TextBlockDesign.TextProperty, new Binding("Time") { Source = _sdata, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); _settings.Teams.Add(_sdata); break; } } } }