Beispiel #1
0
        public void OpenFile(XElement root)
        {
            XElement data = root.Element("data");

            Clear();
            displayBoxes.Clear();
            currentCommand.Clear();
            foreach (XElement xe in data.Elements())
            {
                DisplayBoxType dbt = (DisplayBoxType)Enum.Parse(typeof(DisplayBoxType), xe.Attribute("type").Value);
                Point          location;
                if (displayBoxes.Count > 0)
                {
                    location        = new Point(currentBox.Location.X, currentBox.Bottom);
                    this.MinHeight += currentBox.Height;
                }
                else
                {
                    location = caret.Location;
                }
                TextDisplayBox newBox = new TextDisplayBox(dbt, location);
                displayBoxes.Add(newBox);
                newBox.SetText(xe.Value);
                currentBox = newBox;
            }
            if (currentBox.BoxType == DisplayBoxType.Input)
            {
                currentCommand.Append(currentBox.Text);
                caretIndex = currentCommand.Length;
            }
            commandCache.LoadXML(root);
            Calculator.LoadXML(root);
            AdjustCaret();
        }
 public TextDisplayBox(DisplayBoxType boxType, Point location)
 {
     BoxType = boxType;
     locations.Add(location);
     formattedTextList.Add(TextManager.CreateFormattedText("", Brushes.Black));
     Text = "";
 }
Beispiel #3
0
        void AddNewBox(DisplayBoxType dbt, string text)
        {
            TextDisplayBox newBox = new TextDisplayBox(dbt, new Point(currentBox.Location.X, currentBox.Bottom));

            newBox.SetText(text);
            displayBoxes.Add(newBox);
            currentBox      = newBox;
            this.MinHeight += currentBox.Height;
        }