private void refreshTextlist(SvgConfig config, SvgDocument svg, ResponseValue responseVar) { string name = config.BindingTags.First(p => p.id == responseVar.Id).name; string idAB = config.BindingTags.First(p => p.id == responseVar.Id).id; //yes we should save it (textlistConfig.Id) but this will be in the future var bindingTag = config.BindingTags.First(p => p.id == responseVar.Id); Textlist textlistConfig = config.SchemeTextlist.First( textlist => textlist.name == bindingTag.name); textlistConfig.id = bindingTag.id; int i = 0; while (i < 1000) { string idRect = responseVar.Id + "#" + i; string idText = responseVar.Id + "#" + ++i; if (svg.GetElementById(idRect) is SvgRectangle && svg.GetElementById(idText) is SvgTextSpan) { var rectangle = (SvgRectangle)svg.GetElementById(idRect); var svgText = (SvgTextSpan)svg.GetElementById(idText); setTextlist(svg, responseVar, textlistConfig, ref rectangle, ref svgText); break; } else { i++; } } }
public static void getTextlists(List <string> pathesToCfg, string pathSvgCfg, List <Textlist> textLists) { foreach (string path in pathesToCfg) { var file = System.IO.File.ReadAllLines(path).Select(line => line.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries)); List <string[]> textlistItems = file.Where(line => line.Length != 0).ToList(); Textlist textlist = new Textlist(); textlist.items = new List <TextlistItem>(); foreach (string[] item in textlistItems) { TextlistItem textlistItem = new TextlistItem(); textlistItem.index = int.Parse(item[0]); textlistItem.value = item[1]; if (item.Length > 2) { } else { textlistItem.bgColor = ColorTranslator.ToHtml(Color.White); textlistItem.textColor = ColorTranslator.ToHtml(Color.Black); } textlist.items.Add(textlistItem); } string textlistName = path.Substring(path.LastIndexOf("\\") + 1, path.LastIndexOf(".") - path.LastIndexOf("\\") - 1); textlist.name = textlistName; textLists.Add(textlist); } }
private void setTextlist(SvgDocument svg, ResponseValue responseVar, Textlist textlist, ref SvgRectangle rectangle, ref SvgTextSpan svgText) { int textId = int.Parse(responseVar.value.ToString()); SvgColourServer rectColor = new SvgColourServer(Color.FromName(textlist.items[textId].bgColor)); rectangle.Fill = rectColor; svgText.Text = textlist.items[textId].value; SvgColourServer textColor = new SvgColourServer(Color.FromName(textlist.items[textId].textColor)); svgText.Fill = textColor; }