public Application() { this.applicationWindow = new ApplicationWindow(); this.applicationWindow.Load += new EventHandler(this.ApplicationWindow_Load); this.applicationWindow.Closing += new CancelEventHandler(this.ApplicationWindow_Closing); this.applicationWindow.ResourceBrowser.PropertyChanged += new PropertyChangedEventHandler(this.ResourceBrowser_PropertyChanged); this.applicationWindow.ResourceBrowser.SelectedIndexChanged += new EventHandler(this.ResourceBrowser_SelectedIndexChanged); this.cutItem = new CommandBarButton(CommandBarResource.Cut, "Cu&t", new EventHandler(this.Cut_Click), Keys.Control | Keys.X); this.copyItem = new CommandBarButton(CommandBarResource.Copy, "&Copy", new EventHandler(this.Copy_Click), Keys.Control | Keys.C); this.pasteItem = new CommandBarButton(CommandBarResource.Paste, "&Paste", new EventHandler(this.Paste_Click), Keys.Control | Keys.V); this.deleteItem = new CommandBarButton(CommandBarResource.Delete, "&Delete", new EventHandler(this.Delete_Click)); // MenuBar CommandBar menuBar = this.applicationWindow.MenuBar; CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File"); fileMenu.Items.AddButton(CommandBarResource.New, "&New", new EventHandler(this.New_Click), Keys.Control | Keys.N); fileMenu.Items.AddButton(CommandBarResource.Open, "&Open...", new EventHandler(this.Open_Click), Keys.Control | Keys.O); fileMenu.Items.AddButton(CommandBarResource.Save, "&Save", new EventHandler(this.Save_Click), Keys.Control | Keys.S); fileMenu.Items.AddButton("Save &As...", new EventHandler(this.SaveAs_Click)); fileMenu.Items.AddSeparator(); fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click)); CommandBarMenu editMenu = menuBar.Items.AddMenu("&Edit"); editMenu.Items.Add(this.cutItem); editMenu.Items.Add(this.copyItem); editMenu.Items.Add(this.pasteItem); editMenu.Items.Add(this.deleteItem); editMenu.Items.AddSeparator(); editMenu.Items.AddButton(CommandBarResource.Edit, "Insert &Text...", new EventHandler(this.InsertText_Click), Keys.Control | Keys.T); editMenu.Items.AddButton(CommandBarResource.Parent, "Insert &Files...", new EventHandler(this.InsertFiles_Click), Keys.Control | Keys.F); CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help"); helpMenu.Items.AddButton("&About .NET Resourcer...", new EventHandler(this.About_Click)); // ToolBar CommandBar toolBar = this.applicationWindow.ToolBar; toolBar.Items.AddButton(CommandBarResource.New, "New", new EventHandler(this.New_Click), Keys.Control | Keys.N); toolBar.Items.AddButton(CommandBarResource.Open, "Open...", new EventHandler(this.Open_Click), Keys.Control | Keys.O); toolBar.Items.AddButton(CommandBarResource.Save, "Save", new EventHandler(this.Save_Click), Keys.Control | Keys.S); toolBar.Items.AddSeparator(); toolBar.Items.Add(this.cutItem); toolBar.Items.Add(this.copyItem); toolBar.Items.Add(this.pasteItem); toolBar.Items.Add(this.deleteItem); toolBar.Items.AddSeparator(); toolBar.Items.AddButton(CommandBarResource.Edit, "Insert &Text...", new EventHandler(this.InsertText_Click), Keys.Control | Keys.T); toolBar.Items.AddButton(CommandBarResource.Parent, "Insert &Files...", new EventHandler(this.InsertFiles_Click), Keys.Control | Keys.F); System.Windows.Forms.Application.Idle += new EventHandler(this.Application_Idle); }
public Application() { this.applicationWindow = new ApplicationWindow(); this.applicationWindow.Load +=new EventHandler(this.ApplicationWindow_Load); this.applicationWindow.Closing += new CancelEventHandler(this.ApplicationWindow_Closing); this.applicationWindow.ResourceBrowser.PropertyChanged += new PropertyChangedEventHandler(this.ResourceBrowser_PropertyChanged); this.applicationWindow.ResourceBrowser.SelectedIndexChanged += new EventHandler(this.ResourceBrowser_SelectedIndexChanged); this.cutItem = new CommandBarButton(CommandBarResource.Cut, "Cu&t", new EventHandler(this.Cut_Click), Keys.Control | Keys.X); this.copyItem = new CommandBarButton(CommandBarResource.Copy, "&Copy", new EventHandler(this.Copy_Click), Keys.Control | Keys.C); this.pasteItem = new CommandBarButton(CommandBarResource.Paste, "&Paste", new EventHandler(this.Paste_Click), Keys.Control | Keys.V); this.deleteItem = new CommandBarButton(CommandBarResource.Delete, "&Delete", new EventHandler(this.Delete_Click)); // MenuBar CommandBar menuBar = this.applicationWindow.MenuBar; CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File"); fileMenu.Items.AddButton(CommandBarResource.New, "&New", new EventHandler(this.New_Click), Keys.Control | Keys.N); fileMenu.Items.AddButton(CommandBarResource.Open, "&Open...", new EventHandler(this.Open_Click), Keys.Control | Keys.O); fileMenu.Items.AddButton(CommandBarResource.Save, "&Save", new EventHandler(this.Save_Click), Keys.Control | Keys.S); fileMenu.Items.AddButton("Save &As...", new EventHandler(this.SaveAs_Click)); fileMenu.Items.AddSeparator(); fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click)); CommandBarMenu editMenu = menuBar.Items.AddMenu("&Edit"); editMenu.Items.Add(this.cutItem); editMenu.Items.Add(this.copyItem); editMenu.Items.Add(this.pasteItem); editMenu.Items.Add(this.deleteItem); editMenu.Items.AddSeparator(); editMenu.Items.AddButton(CommandBarResource.Edit, "Insert &Text...", new EventHandler(this.InsertText_Click), Keys.Control | Keys.T); editMenu.Items.AddButton(CommandBarResource.Parent, "Insert &Files...", new EventHandler(this.InsertFiles_Click), Keys.Control | Keys.F); CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help"); helpMenu.Items.AddButton("&About .NET Resourcer...", new EventHandler(this.About_Click)); // ToolBar CommandBar toolBar = this.applicationWindow.ToolBar; toolBar.Items.AddButton(CommandBarResource.New, "New", new EventHandler(this.New_Click), Keys.Control | Keys.N); toolBar.Items.AddButton(CommandBarResource.Open, "Open...", new EventHandler(this.Open_Click), Keys.Control | Keys.O); toolBar.Items.AddButton(CommandBarResource.Save, "Save", new EventHandler(this.Save_Click), Keys.Control | Keys.S); toolBar.Items.AddSeparator(); toolBar.Items.Add(this.cutItem); toolBar.Items.Add(this.copyItem); toolBar.Items.Add(this.pasteItem); toolBar.Items.Add(this.deleteItem); toolBar.Items.AddSeparator(); toolBar.Items.AddButton(CommandBarResource.Edit, "Insert &Text...", new EventHandler(this.InsertText_Click), Keys.Control | Keys.T); toolBar.Items.AddButton(CommandBarResource.Parent, "Insert &Files...", new EventHandler(this.InsertFiles_Click), Keys.Control | Keys.F); System.Windows.Forms.Application.Idle += new EventHandler(this.Application_Idle); }