private void ReadItemtemplates(ZipFile z) { var t = Info["Templates"] as ObjectValue; var items = (t.Value["Item"] as ArrayValue).Value; foreach (var tt in items) { var obj = (tt as ObjectValue).Value; var te = new ItemTemplate(); te.ProjectID = Guid.Parse(Info["ID"].ToString()); te.Name = obj["Name"].ToString(); te.Extension = obj["Extension"].ToString(); if (Icons.Count > 0) { te.Icon = Icons[obj["Icon"].ToString()]; } var h = z["Highlighting/" + obj["Highlighting"].ToString()]; te.Highlighting = obj["Highlighting"].ToString(); HighlightingManager.Manager.AddSyntaxModeFileProvider(new StreamProvider(h.OpenReader())); ItemTemplates.Add(te); } }
/// <summary> /// Initializes a new instance of the <see cref="T:Forms9Patch.MultiPicker"/> class. /// </summary> public MultiPicker() { PlainTextCellType = typeof(MultiPickerCellContentView); HtmlTextCellType = typeof(MultiPickerHtmlCellContentView); SelectionMode = SelectionMode.Multiple; ItemTemplates.Clear(); ItemTemplates.Add(typeof(string), PlainTextCellType); }
private async void ContentDialog_Loaded(object sender, RoutedEventArgs e) { // Get the available templates var itemTemplates = await ItemTemplate.LoadTemplatesAsync(); foreach (var itemTemplate in itemTemplates) { ItemTemplates.Add(itemTemplate); } }
private void ReadItemtemplates(ZipFile z) { var t = Info["Templates"] as ObjectValue; var items = (t.Value["Item"] as ArrayValue).Value; JsonExtensionResolver.Archive = z; foreach (var tt in items) { var obj = (tt as ObjectValue).Value; var te = new ItemTemplate(this); te.ProjectID = Guid.Parse(JsonExtensionResolver.Resolve <string>(Info["ID"].ToString())); te.Name = obj["Name"].ToString(); te.Extension = obj["Extension"].ToString(); te.ID = Guid.Parse(JsonExtensionResolver.Resolve <string>(obj["ID"].ToString())); var ms = new MemoryStream(); z["Templates/Items/" + obj["Template"]].OpenReader().CopyTo(ms); te.Raw = ms.ToArray(); if (Icons.Count > 0) { te.Icon = Icons[obj["Icon"].ToString()]; SolutionExplorer.Icons.Add(te.ID, ResizeIcon(te.Icon, new Size(16, 16))); } if (obj.ContainsKey("View")) { te.View = View.FromXaml(new StreamReader(z["Views/" + obj["View"]].OpenReader()).ReadToEnd()); te.ViewSource = new StreamReader(z["Sources/" + obj["View"].ToString().Replace("xaml", "js")].OpenReader()).ReadToEnd(); } var h = z["Highlighting/" + obj["Highlighting"].ToString()]; te.Highlighting = obj["Highlighting"].ToString(); var hs = HighlightingDefinitionParser.Parse(new SyntaxMode(te.Highlighting, te.Name, te.Extension), new XmlTextReader(h.OpenReader())); HighlightingManager.Manager.AddHighlightingStrategy(hs); hs.ResolveReferences(); ItemTemplates.Add(te); } }
private void ReadItemtemplates(ZipFile z) { var t = Info["Templates"] as ObjectValue; var items = (t.Value["Item"] as ArrayValue).Value; foreach (var tt in items) { var obj = (tt as ObjectValue).Value; var te = new ItemTemplate(); te.ProjectID = Guid.Parse(Info["ID"].ToString()); te.Name = obj["Name"].ToString(); te.Extension = obj["Extension"].ToString(); te.ID = Guid.Parse(obj["ID"].ToString()); var ms = new MemoryStream(); z["Templates/Items/" + obj["Template"]].OpenReader().CopyTo(ms); te.Raw = ms.ToArray(); if (Icons.Count > 0) { te.Icon = Icons[obj["Icon"].ToString()]; SolutionExplorer.Icons.Add(te.ID, ResizeIcon(te.Icon, new Size(16, 16))); } if (obj.ContainsKey("View")) { te.View = View.FromXaml(new StreamReader(z["Views/" + obj["View"]].OpenReader()).ReadToEnd()); } var h = z["Highlighting/" + obj["Highlighting"].ToString()]; te.Highlighting = obj["Highlighting"].ToString(); HighlightingManager.Manager.AddSyntaxModeFileProvider(new StreamProvider(h.OpenReader())); ItemTemplates.Add(te); } }