private void LoadRemartText(IList<string> list, RemartText remartText) { foreach (var text in RemartTexts) { var remartTextInfo = text.Replace("$RemartText$", remartText.Name); remartTextInfo = remartTextInfo.Replace("$StartPoint$", remartText.StartPoint.Name); remartTextInfo = remartTextInfo.Replace("$Orientation$", string.Format("Orientation.{0}", remartText.Orientation.ToString())); remartTextInfo = remartTextInfo.Replace("$Express$", String.Format("{0}.ToString()", remartText.TextExpress)); list.Add(remartTextInfo); Trace.WriteLine(remartTextInfo); } }
private void AddRemartTextCommandExecute() { if (string.IsNullOrEmpty(RemartText)) return; if (string.IsNullOrEmpty(RemartTextExpress)) return; if (string.IsNullOrEmpty(StartPoint)) return; var startPoint = GraphSet.GraphObjects.FirstOrDefault(obj => string.Equals(obj.Name, StartPoint)) as Point; if (startPoint == null) return; var newRemartText = new RemartText(startPoint, IsHor ? Orientation.Hor : Orientation.Ver, RemartText, 12); newRemartText.Name = string.Format("RemartText{0}", ++remartTextCount); newRemartText.TextExpress = RemartTextExpress; GraphSet.GraphObjects.Add(newRemartText); Canvas.InvalidateVisual(); }