public MainWindow() { foreach (var type in typeof(AdaptiveHostConfig).Assembly.GetExportedTypes() .Where(t => t.Namespace == typeof(AdaptiveHostConfig).Namespace)) { TypeDescriptor.AddAttributes(type, new ExpandableObjectAttribute()); } InitializeComponent(); _synth = new SpeechSynthesizer(); _synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult); _synth.SetOutputToDefaultAudioDevice(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; timer.Tick += Timer_Tick; timer.Start(); foreach (var config in Directory.GetFiles(@"HostConfig", "*.json")) { hostConfigs.Items.Add(new ComboBoxItem { Content = Path.GetFileNameWithoutExtension(config), Tag = config }); } foreach (var samples in Directory.GetFiles(@"Samples", "*.json")) { Samples.Add(Path.GetFileNameWithoutExtension(samples)); } listBoxSamples.ItemsSource = Samples; Renderer = new AdaptiveCardRenderer() { Resources = Resources }; // Use the Xceed rich input controls Renderer.UseXceedElementRenderers(); // Register custom elements and actions // TODO: Change to instance property? Change to UWP parser registration AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomRating>(); AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomAction>(); Renderer.ElementRenderers.Set <MyCustomRating>(MyCustomRating.Render); // This seems unecessary? Renderer.ActionHandlers.AddSupportedAction <MyCustomAction>(); CardType.ItemsSource = new string[] { "Hero", "Regular", "DetailCard" }; }
/* * // This variable exists so the sample styles are not added twice * private bool _stylesAdded = false; */ public MainWindow() { foreach (var type in typeof(AdaptiveHostConfig).Assembly.GetExportedTypes() .Where(t => t.Namespace == typeof(AdaptiveHostConfig).Namespace)) { TypeDescriptor.AddAttributes(type, new ExpandableObjectAttribute()); } InitializeComponent(); LoadJsonSyntaxHighlighting(); CardPayload = File.ReadAllText("Samples\\ActivityUpdate.json"); _synth = new SpeechSynthesizer(); _synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult); _synth.SetOutputToDefaultAudioDevice(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; timer.Tick += Timer_Tick; timer.Start(); foreach (var config in Directory.GetFiles("HostConfigs", "*.json")) { hostConfigs.Items.Add(new ComboBoxItem { Content = Path.GetFileNameWithoutExtension(config), Tag = config }); } Renderer = new AdaptiveCardRenderer() { Resources = Resources }; Renderer.FeatureRegistration.Set("acTest", "1.0"); // Use the Xceed rich input controls Renderer.UseXceedElementRenderers(); xceedCheckbox.IsChecked = true; // Register custom elements and actions // TODO: Change to instance property? Change to UWP parser registration AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomRating>(); AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomAction>(); Renderer.ElementRenderers.Set <MyCustomRating>(MyCustomRating.Render); // This seems unecessary? Renderer.ActionHandlers.AddSupportedAction <MyCustomAction>(); }
public MainWindow() { foreach (var type in typeof(AdaptiveHostConfig).Assembly.GetExportedTypes() .Where(t => t.Namespace == typeof(AdaptiveHostConfig).Namespace)) { TypeDescriptor.AddAttributes(type, new ExpandableObjectAttribute()); } InitializeComponent(); _synth = new SpeechSynthesizer(); _synth.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Adult); _synth.SetOutputToDefaultAudioDevice(); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; timer.Tick += Timer_Tick; timer.Start(); foreach (var config in Directory.GetFiles(@"..\..\..\..\..\..\samples\v1.0\HostConfig", "*.json")) { hostConfigs.Items.Add(new ComboBoxItem { Content = Path.GetFileNameWithoutExtension(config), Tag = config }); } Renderer = new AdaptiveCardRenderer() { Resources = Resources }; // Use the Xceed rich input controls Renderer.UseXceedElementRenderers(); // Register custom elements and actions AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomRating>(); AdaptiveTypedElementConverter.RegisterTypedElement <MyCustomAction>(); Renderer.ElementRenderers.Set <MyCustomRating>(MyCustomRating.Render); Renderer.ActionHandlers.AddSupportedAction <MyCustomAction>(); }