private void LoadSnippetOptions() { foreach (SnippetOptions options in SnippetOptions.LoadAvailableOptions()) { MenuItem item = new MenuItem(); item.Header = options.Name; item.IsCheckable = true; item.Tag = options; item.Checked += HandleOptionsSelection; item.IsChecked = false; OptionsMenu.Items.Add(item); } ((MenuItem)OptionsMenu.Items[0]).IsChecked = true; }
private void LoadSnippetOptions() { foreach (SnippetOptions options in SnippetOptions.LoadAvailableOptions()) { MenuItem item = new MenuItem(); item.Header = options.Name; item.IsCheckable = true; item.Tag = options; item.Checked += HandleOptionsSelection; item.IsChecked = false; OptionsMenu.Items.Add(item); } // Default to the last option... OptionsMenu.Items.Cast <MenuItem>().Last().IsChecked = true; }
private static SnippetOptions FromXmlElement(XmlElement element) { SnippetOptions ret = new SnippetOptions(element.Attributes["name"].Value); foreach (XmlElement tag in element.GetElementsByTagName("Assembly")) { ret.Assemblies.Add(tag.Attributes["name"].Value); } foreach (XmlElement tag in element.GetElementsByTagName("Namespace")) { ret.Namespaces.Add(tag.Attributes["name"].Value); } foreach (XmlElement tag in element.GetElementsByTagName("CompilerOption")) { ret.CompilerOptions[tag.Attributes["name"].Value] = tag.Attributes["value"].Value; } return ret; }
private static SnippetOptions FromXmlElement(XmlElement element) { SnippetOptions ret = new SnippetOptions(element.Attributes["name"].Value); foreach (XmlElement tag in element.GetElementsByTagName("Assembly")) { ret.Assemblies.Add(tag.Attributes["name"].Value); } foreach (XmlElement tag in element.GetElementsByTagName("Namespace")) { ret.Namespaces.Add(tag.Attributes["name"].Value); } foreach (XmlElement tag in element.GetElementsByTagName("CompilerOption")) { ret.CompilerOptions[tag.Attributes["name"].Value] = tag.Attributes["value"].Value; } return(ret); }
/// <summary> /// Generates a snippet from the given text, with the given options. /// </summary> public Snippet(string snippetText, SnippetOptions options) { this.snippetText = snippetText; this.options = options; }