public MainWindow() : base(0, 0, Console.WindowWidth, Console.WindowHeight, null) { fileLabel = new Label(' ' + FileInfo.Filename + ' ', 2, (Console.WindowWidth/2)-(FileInfo.Filename.Count()+2), "fileLabel", this); fileMenu = BulidFileMenu(); settingMenu = BuildSettingMenu(); helpMenu = BulidHelpMenu(); textArea = new TextArea(3, 1, Console.WindowWidth - 3, Console.WindowHeight - 5, "textArea", this); textArea.OnChange = delegate() { FileInfo.HasChanged = true; }; Inputs.Add(fileMenu); Inputs.Add(settingMenu); Inputs.Add(helpMenu); Inputs.Add(fileLabel); Inputs.Add(textArea); CurrentlySelected = textArea; Draw(); MainLoop(); }
private Menu BulidFileMenu() { List<MenuItem> menuItems = new List<MenuItem>(); Menu fileMenu = new Menu("File", 1, 2, "fileMenu", this); var newMenuItem = new MenuItem("New", "fileMenuMenuItemNew", fileMenu.MenuDropdown); newMenuItem.Action = delegate() { NewFile(newMenuItem.ParentWindow); }; menuItems.Add(newMenuItem); var loadMenuItem = new MenuItem("Load", "fileMenuMenuItemLoad", fileMenu.MenuDropdown); loadMenuItem.Action = delegate() { LoadData(loadMenuItem.ParentWindow); }; menuItems.Add(loadMenuItem); var saveMenuItem = new MenuItem("Save", "fileMenuMenuItemSave", fileMenu.MenuDropdown); saveMenuItem.Action = delegate() { SaveData(saveMenuItem.ParentWindow); }; menuItems.Add(saveMenuItem); var exitMenuItem = new MenuItem("Exit", "fileMenuMenuItemExit", fileMenu.MenuDropdown); exitMenuItem.Action = delegate() { ExitApp(saveMenuItem.ParentWindow); }; menuItems.Add(exitMenuItem); fileMenu.MenuItems.AddRange(menuItems); return fileMenu; }
private Menu BulidHelpMenu() { List<MenuItem> menuItems = new List<MenuItem>(); Menu helpMenu = new Menu("Help", 1, 22, "helpMenu", this); var viewHelpMenuItem = new MenuItem("Help", "fileMenuMenuItemViewHelp", fileMenu.MenuDropdown); viewHelpMenuItem.Action = delegate() { new Alert("Coming Soon!", viewHelpMenuItem.ParentWindow); }; menuItems.Add(viewHelpMenuItem); var aboutMenuItem = new MenuItem("About", "fileMenuMenuItemAbout", fileMenu.MenuDropdown); aboutMenuItem.Action = delegate() { new Alert("Does anyone ever read this?", viewHelpMenuItem.ParentWindow); }; menuItems.Add(aboutMenuItem); helpMenu.MenuItems.AddRange(menuItems); return helpMenu; }
private Menu BuildSettingMenu() { List<MenuItem> menuItems = new List<MenuItem>(); Menu settingMenu = new Menu("Settings", 1, 10, "settingMenu", this); var resolutionMenuItem = new MenuItem("Set Resolution", "settingMenuMenuItemResolution", fileMenu.MenuDropdown); resolutionMenuItem.Action = delegate() { new Resolution(resolutionMenuItem.ParentWindow); fileLabel.Ypostion = (Console.WindowWidth / 2) - (FileInfo.Filename.Count() + 2); Draw(); }; menuItems.Add(resolutionMenuItem); settingMenu.MenuItems.AddRange(menuItems); return settingMenu; }