Exemplo n.º 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();
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 void ConsumeTextCommand(string command)
 {
     Deselect();
     currentCommand.Insert(caretIndex, command);
     currentBox.SetText(currentCommand.ToString());
     caretIndex   += command.Length;
     this.MinWidth = Math.Max(this.MinWidth, currentBox.Width + 100);
     AdjustCaret();
 }