protected void Start() { ToggleMenuGameObjects(); BackButton.onClick.AddListener(NavigateToMainMenu); instance = this; SetLoadingOverlayVisiblity(neededBeforeInit.HasValue && neededBeforeInit.Value); }
public MenuController(MenuView menu) { this.menu = menu; if (menu is AdminMenu) { foreach (Button button in ((AdminMenu) menu).contentHolder.Children) button.Click += DoAction; } else if (menu is StudentMenu) { foreach (Button button in ((StudentMenu) menu).contentHolder.Children) button.Click += DoAction; } else { foreach (Button button in ((TeacherMenu) menu).contentHolder.Children) button.Click += DoAction; } }
public virtual void CreateMenuView(MenuView entity) { Create(entity); }
public static Task <object> ShowMenuAtPosition(IEnumerable <string> _data, Point position, string title = null) { return(MenuView.ShowAtPosition(_data, position, title)); }
public static Task <object> ShowMenu(IEnumerable <string> _data, FrameworkElement attachView, string title = null) { return(MenuView.ShowFromView(_data, attachView, title)); }
public void SetView(IView view) { this.view = (MenuView)view; }
/// <summary> /// 修改主菜单 /// </summary> /// <param name="menuId">主菜单id</param> /// <param name="menuView">主菜单信息</param> /// <param name="operatorAccount">操作员账号</param> public void UpdateMenu(string menuId, MenuView menuView) { SystemResourceService.UpdateMenu(Guid.Parse(menuId), menuView, this.CurrentUser.UserName); }
public void AddView(MenuView view) { views.Add(view); }
void UpdateParallax() { var openness = ((float)(MaxOffset - contentOffsetX)) / MaxOffset; MenuView.OffsetLeftAndRight((int)(-openness * MaxOffset * ParallaxSpeedRatio) - MenuView.Left); }
/// <summary> /// Bootstrapperを起動する /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Application_Startup(object sender, StartupEventArgs e) { var window = new MenuView(); window.Show(); }
public void Run() { logger.Debug("Initializer is running."); #region Build main menu MenuIcon newgame = new MenuIcon(Language.Instance.GetString("NewGame"), null, Color.Black); MenuIcon options = new MenuIcon(Language.Instance.GetString("Options"), null, Color.Black); MenuIcon help = new MenuIcon(Language.Instance.GetString("Help"), null, Color.Black); MenuIcon quit = new MenuIcon(Language.Instance.GetString("Quit"), null, Color.Black); List <MenuIcon> menuOptions = new List <MenuIcon>(); menuOptions.Add(newgame); menuOptions.Add(options); menuOptions.Add(help); menuOptions.Add(quit); Menu mainMenu = new Menu(Globals.MenuLayout.FourMatrix, menuOptions, "", Color.Black); MenuView view = MenuView.Instance; // Just to make sure everything is in there... new MenuController(TobiiController.GetInstance(this.windowHandle), mainMenu); #endregion ShowSplashScreen(); Cue backgroundSound = Sounds.Instance.LoadSound("Menu"); backgroundSound.Play(); while (true) { backgroundSound.Resume(); Recellection.CurrentState = view; logger.Info("Waiting for Tobii input..."); MenuIcon response = MenuController.GetInput(); logger.Info("Got input!"); if (response == newgame) { // START THE GAME ALREADY! GameInitializer gameInit = new GameInitializer(); backgroundSound.Pause(); WorldView.Initiate(gameInit.theWorld); Recellection.CurrentState = WorldView.Instance; // new WorldView(gameInit.theWorld); VictorTurner vt = new VictorTurner(gameInit); vt.Run(); } else if (response == quit) { List <MenuIcon> promptOptions = new List <MenuIcon>(2); MenuIcon yes = new MenuIcon(Language.Instance.GetString("Yes"), Recellection.textureMap.GetTexture(Globals.TextureTypes.Yes)); MenuIcon no = new MenuIcon(Language.Instance.GetString("No"), Recellection.textureMap.GetTexture(Globals.TextureTypes.No)); promptOptions.Add(yes); promptOptions.Add(no); MenuController.LoadMenu(new Menu(Globals.MenuLayout.Prompt, promptOptions, Language.Instance.GetString("AreYouSureYouWantToQuit"))); Recellection.CurrentState = MenuView.Instance; if (MenuController.GetInput() == yes) { Environment.Exit(0); } MenuController.UnloadMenu(); } else if (response == options) { Configurator.Instance.ChangeOptions(); } else if (response == help) { List <MenuIcon> opt = new List <MenuIcon>(1); MenuIcon cancel = new MenuIcon(""); cancel.region = new GUIRegion(Recellection.windowHandle, new System.Windows.Rect(0, Globals.VIEWPORT_HEIGHT - 100, Globals.VIEWPORT_WIDTH, 100)); opt.Add(cancel); Menu menu = new Menu(opt); MenuController.LoadMenu(menu); Recellection.CurrentState = new HelpView(); MenuController.GetInput(); MenuController.UnloadMenu(); } else { Recellection.playBeethoven(); } } }
public MenuView Create(MenuView view) { return(Update(view)); }
void Awake() { menuView = GetComponent <MenuView>(); menuView.OnClassicGameButtonPressed += OnClassicGameButtonPressedHandler; menuView.OnSurviveGameButtonPressed += OnSurviveGameButtonPressedHandler; }
private void Awake() { Instance = this; PlayButton.onClick.AddListener(OnPlayButtonClick); }
public virtual void DeleteMenuView(MenuView entity) { Delete(entity); }
public ActionResult Edit(MenuView request) { var menuTypeId = (long)MenuTypes.None; if (!string.IsNullOrWhiteSpace(Request["MenuTypeId"])) { menuTypeId = long.Parse(Request["MenuTypeId"]); } request.MenuType = Lookups.GetItem <MenuTypes>(menuTypeId); var schoolTypeId = (long)MenuSchoolTypes.None; if (!string.IsNullOrWhiteSpace(Request["SchoolTypeId"])) { schoolTypeId = long.Parse(Request["SchoolTypeId"]); } request.SchoolType = Lookups.GetItem <MenuSchoolTypes>(schoolTypeId); //TryUpdateModel(request); request.Foods = new List <FoodListItemView>(); Request.Form.AllKeys.Where(d => d.StartsWith("Foods")).ForEach(d => request.Schools.Add(new GeneralItemView { Id = long.Parse(Request[d]) })); request.Schools = new List <GeneralItemView>(); Request.Form.AllKeys.Where(d => d.StartsWith("Schools")).ForEach(d => request.Schools.Add(new GeneralItemView { Id = long.Parse(Request[d]) })); if (menuTypeId > 0 && (!string.IsNullOrWhiteSpace(request.Name))) { request.ModifiedBy = CurrentUser.Name; request.ModifiedByFullName = CurrentUser.FullName; if (!ModelState.IsValid) { return(View(request)); } if (request.Id == 0) { var response = MenuService.Create( new MenuCreateRequest { Menu = request }); if (response.Result == Result.Success) { InfoMessage = response.Message; return(RedirectToAction("Index")); } ErrorMessage = response.Message; } else { var response = MenuService.Update(new MenuUpdateRequest { Menu = request }); if (response.Result == Result.Success) { InfoMessage = response.Message; return(RedirectToAction("Index")); } ErrorMessage = response.Message; } } else { ErrorMessage = "Fill Name, Select Menu Type"; } //ViewBag.MenuTypes = Lookups.GetItems<MenuTypes>().Select(d => new SelectListItem {Value = d.Id.ToString(), Text = d.Text, Selected = d.Id == menuTypeId}).ToList(); ViewBag.MenuTypes = Lookups.MenuTypeList.Select(d => new SelectListItem { Value = d.Id.ToString(), Text = d.Text, Selected = d.Id == menuTypeId }).ToList(); ViewBag.MenuSchoolTypes = Lookups.GetItems <MenuSchoolTypes>().Select(d => new SelectListItem { Value = d.Id.ToString(), Text = d.Text, Selected = d.Id == schoolTypeId }).ToList(); return(View(request)); }
public MainWindow() { InitializeComponent(); DataContext = new MenuView(this); }
public async Task NavigateForward(AbstractViewModel vm) { ContentPage cp = null; bool isPopup = vm is IPopupViewModel; if (vm is LoginViewModel) { cp = new LoginView(); } else if (vm is AllSnippetsViewModel) { cp = new AllSnippetsView(); } else if (vm is AllUsersViewModel) { cp = new AllUsersView(); } else if (vm is YesNoPageViewModel) { cp = new YesNoPageView(); } else if (vm is SnippetViewModel) { cp = new SnippetView(); } else if (vm is UserViewModel) { cp = new UserView(); } else if (vm is VariableViewModel) { cp = new VariableView(); } else if (vm is MenuViewModel) { cp = new MenuView(); } else if (vm is AlertViewModel) { cp = new AlertView(); } else if (vm is ProfileViewModel) { cp = new ProfileView(); } else if (vm is TextInputViewModel) { cp = new TextInputView(); } cp.BindingContext = vm; await Task.Delay(100); if (isPopup) { SetHasBackButton(cp, false); await Navigation.PushModalAsync(cp); } else { await Navigation.PushAsync(cp); } }
public async Task Should_do_everything() { var cooker = await env.RegisterNewUser(); var product = new ProductView { Name = "Яблоко", Calories = 42, Carbohydrate = 10, Fat = 1, Protein = 1 }; var createdProduct = await cooker.Client.Post("/api/products", product); createdProduct.EnsureStatusCode(HttpStatusCode.Created); product = createdProduct.Value; var dish = new DishViewCook { Name = "Варенье", Ingredients = new[] { new IngredientView { ProductId = product.Id, Weight = 150 } }, PortionWeight = 200 }; var createdDish = await cooker.Client.Post("/api/dishes", dish); createdDish.EnsureStatusCode(HttpStatusCode.Created); dish = createdDish.Value; var menu = new MenuView { Date = new DateTime(2019, 11, 22), DishIds = new List <int> { dish.Id } }; var createdMenu = await cooker.Client.Post("/api/menus", menu); createdMenu.EnsureStatusCode(HttpStatusCode.Created); menu = createdMenu.Value; var user = await env.RegisterNewUser(Role.Customer); var getUserMenu = await user.Client.Get <MenuView>($"/api/menus/{menu.Id}"); getUserMenu.EnsureStatusCode(HttpStatusCode.OK); var userMenu = getUserMenu.Value; userMenu.Should().BeEquivalentTo(menu); var getUserDish = await user.Client.Get <DishViewCustomer>($"/api/dishes/{menu.DishIds[0]}"); getUserDish.EnsureStatusCode(HttpStatusCode.OK); var userDish = getUserDish.Value; var getUserProduct = await user.Client.Get <ProductView>($"/api/products/{dish.Ingredients[0].ProductId}"); getUserProduct.EnsureStatusCode(HttpStatusCode.NotFound); var order = new OrderView { MenuId = userMenu.Id, DishIds = new[] { userDish.Id } }; var createdOrder = await cooker.Client.Post("/api/orders", order); createdOrder.EnsureStatusCode(HttpStatusCode.Created); order = createdOrder.Value; }
public ViewResult RelateAuthority(Guid id) { MenuView currentMenu = this._menuPresenter.GetMenu(id); return(base.View(currentMenu)); }
public ActionResult TMenu(int?id, bool?D, bool?E) { var Mlist = new MenuView(); using (var transacion = db.Database.BeginTransaction()) { try { if (id != null && E == null) { var tmenu = db.TipoMenus.Find(id); if (tmenu == null) { ModelState.AddModelError(string.Empty, "El tipo de menú no existe"); ViewBag.Error = true; Mlist.LTipoMenu = db.TipoMenus.Where(t => t.Cod_TMenu != 1 && t.Eliminado_TMenu == true).ToList(); return(View(Mlist)); } else if (D != null) { tmenu.Estado_TMenu = D.Value; db.Entry(tmenu).State = EntityState.Modified; db.SaveChanges(); } else { tmenu.Eliminado_TMenu = false; tmenu.Estado_TMenu = false; db.Entry(tmenu).State = EntityState.Modified; db.SaveChanges(); } } else if (id != null && E == true) { var tmenu = db.TipoMenus.Find(id); if (tmenu == null) { ModelState.AddModelError(string.Empty, "El tipo de menú " + tmenu.Nombre_TMenu + " no existe"); ViewBag.Error = true; Mlist.LTipoMenu = db.TipoMenus.Where(t => t.Cod_TMenu != 1 && t.Eliminado_TMenu == true).ToList(); return(View(Mlist)); } else if (E != null) { Mlist.TipoMenu = tmenu; ViewBag.Editar = tmenu.Cod_TMenu; } } Mlist.LTipoMenu = db.TipoMenus.Where(t => t.Cod_TMenu != 1 && t.Eliminado_TMenu == true).OrderBy(t => t.Nombre_TMenu).ToList(); transacion.Commit(); return(View(Mlist)); } catch (Exception ex) { if (D != null) { ModelState.AddModelError(string.Empty, "Error al desactivar, " + ex.Message); } else if (id != null) { ModelState.AddModelError(string.Empty, "Error al Eliminar, " + ex.Message); } else { ModelState.AddModelError(string.Empty, ex.Message); } ViewBag.Error = true; Mlist.LTipoMenu = db.TipoMenus.Where(t => t.Cod_TMenu != 1 && t.Eliminado_TMenu == true).OrderBy(t => t.Nombre_TMenu).ToList(); transacion.Rollback(); return(View(Mlist)); } } }
public void CreateView() { this.view = new MenuView(); }
public ActionResult Create(MenuView MenuView, HttpPostedFileBase Imagen_Menu) { var Mlist = db.TipoMenus.Where(t => t.Estado_TMenu == true).ToList(); if (ModelState.IsValid) { using (var transacion = db.Database.BeginTransaction()) { try { if (Imagen_Menu != null && Imagen_Menu.ContentLength > 0) { byte[] imagenData = null; using (var binaryMenu = new BinaryReader(Imagen_Menu.InputStream)) { imagenData = binaryMenu.ReadBytes(Imagen_Menu.ContentLength); } MenuView.Menu.Imagen_Menu = imagenData; } else { ModelState.AddModelError(string.Empty, "Por favor Selecciones una Imagen"); } var Tmenu = Request["Cod_TMenu"]; if (Convert.ToInt32(Tmenu) == 0) { ModelState.AddModelError(string.Empty, "Por favor Selecciones el tipo de menu"); } var menu = new Menu { Nombre_Menu = MenuView.Menu.Nombre_Menu.ToLower(), Descripcion_Menu = MenuView.Menu.Descripcion_Menu.ToLower(), Cod_TMenu = Convert.ToInt32(Tmenu), Estado_Menu = true, Eliminado_Menu = true, Imagen_Menu = MenuView.Menu.Imagen_Menu, Valor_Menu = MenuView.Menu.Valor_Menu }; db.Menus.Add(menu); db.SaveChanges(); var id = db.Menus.Where(t => t.Estado_Menu == true).Max(m => m.Cod_Menu); transacion.Commit(); return(RedirectToAction(string.Format("AddDiaMenu/{0}", id))); } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException.InnerException != null && ex.InnerException.InnerException.Message != null) { if (db.Menus.Where(t => t.Nombre_Menu == MenuView.Menu.Nombre_Menu && t.Eliminado_Menu == false).Count() == 0) { ModelState.AddModelError(string.Empty, "El menú " + MenuView.Menu.Nombre_Menu + " ya existe"); } else { ModelState.AddModelError(string.Empty, "El menú " + MenuView.Menu.Nombre_Menu + " ya existe, pero se encuentra eliminado"); } } else { ModelState.AddModelError(string.Empty, ex.ToString()); } Mlist.Add(new TipoMenu { Cod_TMenu = 0, Nombre_TMenu = "Seleccione el Tipo Mesa" }); ViewBag.Cod_TMenu = new SelectList(Mlist.OrderBy(m => m.Cod_TMenu).ToList(), "Cod_TMenu", "Nombre_TMenu", MenuView.Menu.Cod_TMenu); transacion.Rollback(); ViewBag.Error = true; return(View(MenuView)); } } } Mlist.Add(new TipoMenu { Cod_TMenu = 0, Nombre_TMenu = "Seleccione el Tipo Menu" }); ViewBag.Cod_TMenu = new SelectList(Mlist.OrderBy(m => m.Cod_TMenu).ToList(), "Cod_TMenu", "Nombre_TMenu", MenuView.Menu.Cod_TMenu); return(View(MenuView)); }
/// <summary> /// Returns a complete menu for client side /// </summary> public IEnumerable <MenuView> GetForRole() { Claim userRoleClaim = ClaimHelper.GetClaimToString(ClaimTypes.Role); if (userRoleClaim == null || string.IsNullOrEmpty(userRoleClaim.Value)) { return(null); } IEnumerable <MenuRight> menuRights = menuRightRepository.GetByRoleName(userRoleClaim.Value).ToList(); // Get Parent Items IEnumerable <Menu> parents = menuRights.Where(menu => menu.Menu.IsRootItem).OrderBy(menu => menu.Menu.SortOrder).Select(menu => menu.Menu).ToList(); List <MenuView> menuViews = new List <MenuView>(); foreach (Menu parent in parents) { MenuView menuView = new MenuView { text = parent.MenuTitle, heading = true, icon = parent.MenuImagePath, sref = parent.MenuTargetController }; menuViews.Add(menuView); List <Menu> NotParentMenu = menuRights .Where(menu => !menu.Menu.IsRootItem && menu.Menu.ParentItem_MenuId.Equals(parent.MenuId)) .OrderBy(menu => menu.Menu.SortOrder).Select(menu => menu.Menu).ToList(); foreach (var menus in NotParentMenu) { MenuView menuViewz = new MenuView { text = menus.MenuTitle, icon = menus.MenuImagePath, sref = menus.MenuTargetController, submenu = new List <MenuView>() }; menuViews.Add(menuViewz); // Insert Sub menus if any List <Menu> childs = menuRights .Where(menu => !menu.Menu.IsRootItem && menu.Menu.ParentItem_MenuId == menus.MenuId) .OrderBy(menu => menu.Menu.SortOrder).Select(menu => menu.Menu).ToList(); if (!childs.Any()) { continue; } childs.ForEach(childMenu => menuViewz.submenu.Add(new MenuView { text = childMenu.MenuTitle, icon = childMenu.MenuImagePath, sref = childMenu.MenuTargetController })); } } return(menuViews); }
public WorkWithMenu() { _currentPunct = 0; Menu = new MenuView(); Record = new RecordView(); }
public static Task <object> ShowMenu(IEnumerable <string> _data, string title = null) { return(MenuView.Show(_data, title)); }
public MenuHeader(MenuView menu) { this.menu = menu; }
static void Main() { MenuView menuView = new MenuView(); menuView.MainMenu(); }
public MenuStatusBar(MenuView menu) { this.menu = menu; }
public virtual void UpdateMenuView(MenuView entity) { Update(entity); }
public MenuItems(MenuView menu) { this.menu = menu; }
/// <summary> /// Awakes this instance. /// </summary> private void Awake() { CurrentView = MenuView.Home; _uiStack.ViewChanged(CurrentView); }
public virtual void CreateMenuView(MenuView entity) { entityDao.CreateMenuView(entity); }
private void OnClickRetour(object o) { MenuView menu = new MenuView(frame); frame.Navigate(menu); }
public virtual void UpdateMenuView(MenuView entity) { entityDao.UpdateMenuView(entity); }
public void GetMenuChoice() { // Skapar Views och Models. Läser in från textfiler. MenuView startMenu = new MenuView(); MemberCatalog membCatalog = new MemberCatalog(); membCatalog.AddFullCatalog(); BoatCatalog boatCatalog = new BoatCatalog(membCatalog); boatCatalog.AddFullCatalog(); ViewMessage v = new ViewMessage(membCatalog, boatCatalog); // Deklaration av variabel som kommer innehålla valet man gjort i menyn. int? choice = null; do { // Kör funktionen som visar menyn. startMenu.ViewMenu(); int inputChoice; bool inputResult = int.TryParse(v.ReadInput(), out inputChoice); if (inputResult) { choice = inputChoice; } // Väljer case utifrån användarens input (0-8). switch (choice) { case 0: continue; case 1: // Skapar ny medlem. string[] regArr = v.RegisterMember(); membCatalog.CreateNewMember(regArr); v.RegisteredMemberResponse(); break; case 2: // Presenterar lista med medlemmar. v.ViewMembersList(); break; case 3: // Presenterar detaljerad information om en medlem. v.ViewOneMember(); break; case 4: // Ändrar en medlem. object[] editArray = v.ViewEditMember(); if ((int)editArray[1] == 1) { membCatalog.GetMemberByMemberNumber((int)editArray[0]).FirstName = editArray[2].ToString(); } else if ((int)editArray[1] == 2) { membCatalog.GetMemberByMemberNumber((int)editArray[0]).LastName = editArray[2].ToString(); } else if ((int)editArray[1] == 3) { membCatalog.GetMemberByMemberNumber((int)editArray[0]).SocialSecurityNumber = (int)editArray[2]; } else { if (!membCatalog.IsMemberNumbCorrect((int)editArray[2])) { membCatalog.GetMemberByMemberNumber((int)editArray[0]).MemberNumber = (int)editArray[2]; boatCatalog.EditBoatsMemberNumber(membCatalog.GetMemberByMemberNumber((int)editArray[0]), (int)editArray[2]); } else { v.MemberNumberIsTakenResponse(); } } break; case 5: // Ta bort en medlem. Member memberToDelete = membCatalog.GetMemberByMemberNumber(v.ViewDeleteMember()); membCatalog.DeleteMember(memberToDelete); boatCatalog.DeleteBoats(memberToDelete); v.ResponseMessage("RADERA MEDLEM", "Medlem raderad"); break; case 6: // Lägger till en båt. Member memb = membCatalog.GetMemberByMemberNumber(v.ViewAddBoatByMember()); int[] regArray = v.RegisterBoat(); boatCatalog.AddBoat(regArray[1], regArray[0], memb); v.ResponseMessage("REGISTRERA BÅT", "Båt registrerad"); break; case 7: // Tar bort en båt. Member memberToRemoveBoatTo = membCatalog.GetMemberByMemberNumber(v.ViewDeleteBoatByMember("RADERA BÅT")); int boatToRemove = v.ListAllBoatsByMember(memberToRemoveBoatTo, "RADERA BÅT"); boatCatalog.DeleteBoat(memberToRemoveBoatTo, boatToRemove); v.ResponseMessage("RADERA BÅT", "Båt raderad"); break; case 8: // Redigerar en båt. // Hämta memb att redigera ifrån Member memberToEditBoatTo = membCatalog.GetMemberByMemberNumber(v.ViewDeleteBoatByMember("REDIGERA BÅT")); // Lista båtindex. int boatToEdit = v.ListAllBoatsByMember(memberToEditBoatTo, "REDIGERA BÅT"); object[] boatEditInfo = v.ViewEditBoat(memberToEditBoatTo, boatToEdit); if ((int)boatEditInfo[0] == 1 && !membCatalog.IsMemberNumbCorrect((int)boatEditInfo[1])) { v.MemberNumberDoesNotExistResponse(); } else { boatCatalog.EditBoat(boatEditInfo, memberToEditBoatTo, boatToEdit); v.ResponseMessage("REDIGERA BÅT", "Båt redigerad"); } break; } v.ClearConsole(); } while (choice != 0); // Sparar förändringar. membCatalog.SaveCatalog(); boatCatalog.SaveCatalog(); }
public virtual void DeleteMenuView(MenuView entity) { entityDao.DeleteMenuView(entity); }
private void hypothesisButton_Click(object sender, RoutedEventArgs e) { if (_hypothesisMenuView == null) { _hypothesisMenuViewModel = new MenuViewModel { AttachmentOrientation = AttachmentOrientation.Left, NrColumns = 5, NrRows = 4, MoveOnHide = true }; var sliderItem = new MenuItemViewModel { MenuViewModel = _hypothesisMenuViewModel, Row = 0, ColumnSpan = 1, RowSpan = 1, Column = 0, Position = new Pt(menuHypothesisGrid.ActualWidth, 0), Size = new Vec(100, 50), TargetSize = new Vec(100, 50), IsAlwaysDisplayed = false, IsWidthBoundToParent = false, IsHeightBoundToParent = false }; var attr1 = new SliderMenuItemComponentViewModel { Label = "alpha", Value = 500, MinValue = 1, MaxValue = 1000, Formatter = d => { return(Math.Round(d / 100.0, 1).ToString("F2") + "%"); } }; attr1.PropertyChanged += (sender2, args) => { var model = sender2 as SliderMenuItemComponentViewModel; if (args.PropertyName == model.GetPropertyName(() => model.FinalValue)) { var tt = Math.Round(model.FinalValue / 100.0, 1) * 100.0; //exampleOperationViewModel.ExampleOperationModel.DummyValue = model.FinalValue; } }; sliderItem.MenuItemComponentViewModel = attr1; _hypothesisMenuViewModel.MenuItemViewModels.Add(sliderItem); // FDR var toggles = new List <ToggleMenuItemComponentViewModel>(); var items = new List <MenuItemViewModel>(); var count = 0; var col = 1; foreach (var riskCtrlType in new[] { RiskControlType.PCER, RiskControlType.Bonferroni, RiskControlType.AdaBonferroni, RiskControlType.HolmBonferroni, RiskControlType.BHFDR, RiskControlType.SeqFDR, RiskControlType.AlphaFDR, RiskControlType.BestFootForward, RiskControlType.BetaFarsighted, RiskControlType.GammaFixed, RiskControlType.DeltaHopeful, RiskControlType.EpsilonHybrid, RiskControlType.PsiSupport }) { var toggleMenuItem = new MenuItemViewModel { MenuViewModel = _hypothesisMenuViewModel, Row = count % 4, RowSpan = 0, Position = new Pt(menuHypothesisGrid.ActualWidth, 0), Column = col, Size = new Vec(75, 50), TargetSize = new Vec(75, 50) }; //toggleMenuItem.Position = attachmentItemViewModel.Position; var toggle = new ToggleMenuItemComponentViewModel { Label = riskCtrlType.ToString(), IsChecked = HypothesesViewController.Instance.RiskOperationModel.RiskControlType == riskCtrlType }; toggles.Add(toggle); toggleMenuItem.MenuItemComponentViewModel = toggle; toggleMenuItem.MenuItemComponentViewModel.PropertyChanged += (sender2, args2) => { var model = sender2 as ToggleMenuItemComponentViewModel; if (args2.PropertyName == model.GetPropertyName(() => model.IsChecked)) { if (model.IsChecked) { HypothesesViewController.Instance.RiskOperationModel.RiskControlType = riskCtrlType; foreach (var tg in model.OtherToggles) { tg.IsChecked = false; } } } }; _hypothesisMenuViewModel.MenuItemViewModels.Add(toggleMenuItem); items.Add(toggleMenuItem); count++; if (count % 4 == 0) { col += 1; } } foreach (var mi in items) { (mi.MenuItemComponentViewModel as ToggleMenuItemComponentViewModel).OtherToggles.AddRange(toggles.Where(ti => ti != mi.MenuItemComponentViewModel)); } if (_hypothesisMenuView != null) { menuHypothesisGrid.Children.Remove(_hypothesisMenuView); } _hypothesisMenuView = new MenuView { DataContext = _hypothesisMenuViewModel }; _hypothesisMenuViewModel.AnkerPosition = new Pt(menuHypothesisGrid.ActualWidth, -((_hypothesisMenuViewModel.NrRows - 1) * 50 + (_hypothesisMenuViewModel.NrRows - 1) * 4)); _hypothesisMenuViewModel.HidePosition = new Pt(menuHypothesisGrid.ActualWidth, 54); menuHypothesisGrid.Children.Add(_hypothesisMenuView); } _hypothesisMenuViewModel.IsDisplayed = !_hypothesisMenuViewModel.IsDisplayed; }
public GameController() { this._mv = new MenuView(); this._gv = new GameView(); this._iv = new InputView(); }
/// <summary> /// 添加主菜单 /// </summary> /// <param name="website">网站</param> /// <param name="menuView">主菜单信息</param> /// <param name="operatorAccount">操作员账号</param> public void RegisterMenu(Website website, MenuView menuView) { SystemResourceService.RegisterMenu(website, menuView, this.CurrentUser.UserName); }
/// <summary> /// Kreira instancu MenuController-a. /// </summary> /// <param name="menu"></param> /// <returns></returns> public static Controller NewMenuControllerInstance(MenuView menu) { return new MenuController(menu); }