/// <summary>
        /// Creates a DrawingCommands object and parses the given XML
        /// stream to populate it with the data.
        /// </summary>
        public DrawingCommands Read(XmlReader xml)
        {
            // Create the object
            DrawingCommands dc = new DrawingCommands();

            // Parse through it
            while (xml.Read())
            {
                // See if we are closing
                if (xml.NodeType == XmlNodeType.EndElement &&
                    xml.LocalName == "draw")
                {
                    // We are done reading
                    break;
                }

                // Parse the elements
                if (xml.NodeType == XmlNodeType.Element)
                {
                    switch (xml.LocalName)
                    {
                        case "circle":
                            dc.Add(new DrawCircle(xml));
                            break;
                    }
                }
            }

            // Return the results
            return dc;
        }
        public MainWindow()
        {
            InitializeComponent();

            var _document = new Document();

            Drawing      = new Drawing(_document);
            Drawing.Name = "My drawing";

            this.KeyDown += MainWindow_KeyDown;
            this.KeyUp   += MainWindow_KeyUp;

            this.CommandBindings.Add(new CommandBinding(UndoCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new UndoCmd();
                Drawing.OnCommand(cmd);
            },
                                                        (object sender, CanExecuteRoutedEventArgs e) => { e.CanExecute = Drawing.CanUndo; }));

            this.CommandBindings.Add(new CommandBinding(RedoCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var cmd = new RedoCmd();
                Drawing.OnCommand(cmd);
            },
                                                        (object sender, CanExecuteRoutedEventArgs e) => { e.CanExecute = Drawing.CanRedo; }));


            this.CommandBindings.Add(new CommandBinding(AboutDialogCommand,
                                                        (object sender, ExecutedRoutedEventArgs e) =>
            {
                var win   = new About();
                win.Owner = this;
                win.ShowDialog();
            },
                                                        null));

            FileMenuCommands = new FileMenuCommands(this);
            DrawingCommands  = new DrawingCommands(this);
            DataContext      = this;
        }