Esempio n. 1
0
 void InitializeDelegates(TextModel model)
 {
     enterDelegate = new ModelAction(model.InsertParagraphTag);
     shiftEnterDelegate = new ModelAction(model.InsertReturn);
     insertSectionDelegate = new ModelAction(model.InsertSectionTag);
     insertPreDelegate = new ModelAction(model.InsertPreTag);
     saveAction = new ModelAction(this.SaveFile);
     loadAction = new ModelAction(this.LoadFile);
     insertUnorderedListAction = new ModelAction(model.InsertUnorderedList);
 }
Esempio n. 2
0
 public void CreateModel()
 {
     model = new TextModel();
 }
Esempio n. 3
0
        public XMLNotepad()
        {
            Text = "XML Notepad";
            textBox = new TestableTextBox();
            textBox.Parent = this;
            textBox.Dock = DockStyle.Fill;
            textBox.BorderStyle = BorderStyle.None;
            textBox.Multiline = true;
            textBox.ScrollBars = ScrollBars.Both;
            textBox.AcceptsTab = true;

            insertPre = new MenuItem("Insert &Pre", new EventHandler(MenuInsertPre));
            insertSection = new MenuItem("Insert &Section", new EventHandler(MenuInsertSection));

            MenuItem fileMenu = new MenuItem("&File");
            MenuItem newFile = new MenuItem("&New");
            newFile.Click += new EventHandler(MenuFileNewOnClick);
            newFile.Shortcut = Shortcut.CtrlN;
            fileMenu.MenuItems.Add(newFile);

            openFile = new MenuItem("&Open...");
            openFile.Click += new EventHandler(MenuFileOpenOnClick);
            openFile.Shortcut = Shortcut.CtrlO;
            fileMenu.MenuItems.Add(openFile);

            saveFile = new MenuItem("&Save");
            saveFile.Click += new EventHandler(MenuFileSaveOnClick);
            saveFile.Shortcut = Shortcut.CtrlS;
            fileMenu.MenuItems.Add(saveFile);

            MenuItem saveAsFile = new MenuItem("Save &As...");
            saveAsFile.Click += new EventHandler(MenuFileSaveAsOnClick);
            saveAsFile.Shortcut = Shortcut.CtrlA;
            fileMenu.MenuItems.Add(saveAsFile);

            insertUnorderedList = new MenuItem("Insert &UL", new EventHandler(MenuInsertUnorderedList));

            this.Menu = new MainMenu(new MenuItem[] {fileMenu, insertPre, insertSection, insertUnorderedList});
            textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
            textBox.KeyPress += new KeyPressEventHandler(textBox_KeyPress);
            model = new TextModel();
            InitializeDelegates(model);
        }