public Menus() : base() { base.Init(this.GetType().FullName, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name); baseDal.OnOperationLog += new OperationLogEventHandler(OperationLog.OnOperationLog);//如果需要记录操作日志,则实现这个事件 this.menuDal = baseDal as IMenus; }
/// <summary> /// Switch menu /// </summary> /// <param name="menu">New menu</param> public void ChangeMenu(IMenus menu) { currentMenu?.UnloadContent(); // ?. to avoid crash on the first menu load currentMenu = menu; currentMenu.Initialize(); currentMenu.LoadContent(Content, GraphicsDevice); }
public GameSaveSourceControl(IFolderPathManager folderPathManager, IMappingManager mappingManager, ISharedRepoManager sharedRepoManager, IMenus menus, IMessages messages, IApplicationTrackingManager applicationTrackingManager) { _folderPathManager = folderPathManager; _mappingManager = mappingManager; _sharedRepoManager = sharedRepoManager; _menus = menus; _messages = messages; _applicationTrackingManager = applicationTrackingManager; }
/// <summary> /// Create a congratulation menu /// </summary> /// <param name="tetris"></param> /// <param name="score"></param> /// <param name="level"></param> /// <param name="nextMenu"></param> public CongratulationMenu(Tetris tetris, int score, int level, IMenus nextMenu) { this.frameCount = 0; this.tetris = tetris; this.score = score; this.level = level; this.nextMenu = nextMenu; this.selectedIndexCharCursor = 0; this.selectedIndexChar = new int[6]; for (int i = 0; i < selectedIndexChar.Length; i++) { this.selectedIndexChar[i] = 0; } }
public Form OpenFiles(ICollection <string> fileNames) { Form foundForm = null; foreach (string fileName in fileNames) { string canonicalPath = Path.GetFullPath(fileName).ToLower(); if (_documentForms.ContainsKey(canonicalPath)) { /* document already open */ foundForm = _documentForms[canonicalPath]; } else { /* document needs to be created */ _documentForms[canonicalPath] = foundForm = CreateForm(fileName); IMenus documentFormMenus = foundForm as IMenus; if (documentFormMenus != null) { /* exit menu quits the app */ documentFormMenus.ExitMenuItem.Click += delegate(object sender, EventArgs eventArgs) { Application.Exit(); }; /* open menu asks user which files to open and then opens them */ documentFormMenus.OpenMenuItem.Click += delegate(object sender, EventArgs eventArgs) { string[] filesToOpen = FilesToOpen(); if (filesToOpen != null) { OpenFiles(filesToOpen); } }; /* window menu shows a list of all document forms, select one to activate it */ documentFormMenus.WindowMenuItem.DropDownOpening += delegate(object sender, EventArgs eventArgs) { ToolStripMenuItem windowMenuItem = sender as ToolStripMenuItem; if (windowMenuItem != null) { windowMenuItem.DropDownItems.Clear(); int i = 0; foreach (Form form in _documentForms.Values) { Form innerForm = form; ToolStripMenuItem formMenuItem = new ToolStripMenuItem(string.Format("{0} {1}", ++i, form.Text)); formMenuItem.Checked = Form.ActiveForm == innerForm; formMenuItem.Click += delegate(object innerSender, EventArgs innerEventArgs) { innerForm.Activate(); }; windowMenuItem.DropDownItems.Add(formMenuItem); } } }; } /* when form activated, change the main form */ foundForm.Activated += delegate(object sender, EventArgs eventArgs) { _mainForm = (Form)sender; if (MainFormChanged != null) { MainFormChanged(_mainForm, EventArgs.Empty); } }; /* when form closed, remove it from our list; exit when all closed */ foundForm.FormClosed += delegate(object sender, FormClosedEventArgs e) { _documentForms.Remove(canonicalPath); if (_documentForms.Count == 0) { Application.Exit(); } }; foundForm.Show(); } } return(foundForm); }
public MenusController(IMenus process, IProfilesMenu processprofilemenu) { _process = process; _processprofilemenu = processprofilemenu; }