public ActionResult Sorting(int id = 0, string sortlist = "") { try { string[] separator = new string[3] { "item[", "&item[", "]=" }; string[] tempArray = sortlist.Split(separator, StringSplitOptions.RemoveEmptyEntries); // Брой на елементите int itemCount = tempArray.Length / 2; // масива трябва да има четен брой елементи if ((((double)tempArray.Length) / 2) > itemCount) { return(Content("Грешка при запис")); } using (MenuContext context = new MenuContext()) { for (int i = 0; i < tempArray.Length / 2; i++) { int itemID = Int32.Parse(tempArray[(2 * i)].Replace("null", "-1")); int parentID = Int32.Parse(tempArray[(2 * i + 1)].Replace("null", "-1")); int orderNo = i + 1; context.SetSortItem(id, itemID, parentID, orderNo); } } return(Content("Успешен запис")); } catch (Exception ex) { return(Content(ex.Message)); } }
private void Awake() { _menuContext = MenuContext.GetMenuContext(); _buttons = new List <Button>(); _buttons.AddRange(canvas.GetComponentsInChildren <Button>()); _photonView = GetComponent <PhotonView>(); }
private void tvCat_MouseUp(object sender, MouseEventArgs e) { //Console.WriteLine("MouseUp: EXPANDING=" + EXPANDING.ToString()); if (!EXPANDING) { TreeNode t = null; t = tvCat.GetNodeAt(e.X, e.Y); if ((tvCat.SelectedNode != null) & (t != null)) { if (tvCat.SelectedNode.Name != t.Name) { tvCat.SelectedNode = t; SELECT_Node(); } } else { tvCat.SelectedNode = t; SELECT_Node(); } if (e.Button == MouseButtons.Right) { SHOW_Buttons(); MenuContext.Show(tvCat, e.Location); } } EXPANDING = false; }
public static MingMenuItem CreateMenuItem(string id, Bitmap icon, string title, MenuContext menuContext, ContextMenuPosition position) { var item = CreateMenuItem(id, icon, title, menuContext); item.ContextMenuPosition = position; return item; }
private void AddDemoMenu(MenuContext menuContext, string href) { menuContext.Menus.Add(new Menu() { FromArea = "PRM", Href = href, Key = href, ParentKey = "/", Text = href }); }
public static void InitMenu(ContextMenuStrip menu, MenuContext menuContext) { MenuContext prevMenuContext = menu.Tag as MenuContext; if (null == prevMenuContext) menu.Opening += OnMenuOpening; menu.Tag = menuContext; }
public VenueController(ILogger <VenueController> logger, IConfiguration config, MenuContext context) { _logger = logger; _apiUrl = Environment.GetEnvironmentVariable("API_URL"); _clientIdSecret = Environment.GetEnvironmentVariable("CLIENT_ID_SECRET"); venueContext = context; }
public static MingMenuItem CreateSeparator(MenuContext menuContext, ContextMenuPosition position) { var item = CreateSeparator(menuContext); item.ContextMenuPosition = position; return item; }
private static void OnPrisonerReleased(Hero hero, IFaction arg2, EndCaptivityDetail arg3) { if (hero == null) { return; } ZenDzeeRomanceHelper.EndLoverRomances(hero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner); if (hero != Hero.MainHero && !Hero.MainHero.IsPrisoner) { MenuContext currentMenuContext = Campaign.Current.CurrentMenuContext; if (currentMenuContext == null) { return; } if (currentMenuContext.GameMenu.StringId == "zendzee_town_wait_menus" && ZenDzeeRomanceHelper.GetLover(Hero.MainHero, ZenDzeeRomanceHelper.RomanceLevel_Prisoner) == null) { GameMenu.SwitchToMenu("town_wait_menus"); } } }
static private void OnMenuItemClick(object sender, EventArgs e) { ToolStripMenuItem menuItem = sender as ToolStripMenuItem; MenuContext menuContext = GetMenuContext(menuItem.Owner); if (null == menuContext) { return; } string action = menuItem.Tag as string; bool res = false; if (null != menuContext.nodes) { if (!res && (null != menuContext.ActionList)) { res = menuContext.ActionList.trigger_action(action, menuContext.nodes); } if (!res && (null != menuContext.TriggerNodesAction) && (null != menuContext.nodes)) { res = menuContext.TriggerNodesAction(action, menuContext.nodes); } } else if (null != menuContext.rows) { if (!res && (null != menuContext.ActionList)) { res = menuContext.ActionList.trigger_action(action, menuContext.rows, menuContext.column); } if (!res && (null != menuContext.TriggerRowsColAction)) { res = menuContext.TriggerRowsColAction(action, menuContext.rows, menuContext.column); } } }
private static void OnCharacterPortraitPopUpOpened(CharacterObject characterObject) { if (characterObject == null || LocationComplex.Current == null) { return; } Location locationOfCharacter = LocationComplex.Current.GetLocationOfCharacter(characterObject.HeroObject); if (!characterObject.HeroObject.IsPrisoner) { return; } heroToTalk = characterObject.HeroObject; MenuContext menuContext = Campaign.Current.CurrentMenuContext; if (menuContext == null) { return; } GameOverlays.MenuOverlayType menuOverlayType = Campaign.Current.GameMenuManager.GetMenuOverlayType(menuContext); if (menuOverlayType == GameOverlays.MenuOverlayType.SettlementWithCharacters) { // get menu overlay layer, see GauntletMenuOverlayBase; ScreenBase topScreen = ScreenManager.TopScreen; if (topScreen == null) { return; } GauntletLayer gauntletLayer = topScreen.FindLayer <ScreenLayer>("BasicLayer") as GauntletLayer; if (gauntletLayer == null) { return; } // get _moviesAndDatasources, its public // and there will be ViewModel for SettlementMenuOverlayVM; var movieAndDatasource = gauntletLayer._moviesAndDatasources.FirstOrDefault(p => p.Item2 is SettlementMenuOverlayVM); if (movieAndDatasource == null) { return; } SettlementMenuOverlayVM dataSource = movieAndDatasource.Item2 as SettlementMenuOverlayVM; // it has prop ContextList; // you should add new items there, example ExecuteOnSetAsActiveContextMenuItem; GameMenuOverlayActionVM overlayItem = new GameMenuOverlayActionVM( OnTalkToPrisonerAction, GameTexts.FindText("str_menu_overlay_context_list", "Conversation").ToString(), true, 1, // ID for Conversation ""); dataSource.ContextList.Add(overlayItem); } }
public MenuAdminController(MenuContext db) { InitCtx(_routeNameRepository as IContextRepository <DbContext>, db); InitCtx(_routeParamRepository as IContextRepository <DbContext>, db); InitCtx(_menuRelationRepository as IContextRepository <DbContext>, db); InitCtx(_menuItemRelationGroupRepository as IContextRepository <DbContext>, db); InitCtx(_menuItemRepository as IContextRepository <DbContext>, db); }
/// <summary> /// Constructor for arguments class passed to the MenuEvent event /// </summary> /// <param name="window">IWindow</param> /// <param name="menuType">MenuType</param> /// <param name="menuContext">MenuContext</param> /// <param name="text">string</param> /// <param name="menuItems">ToolStripItemCollection</param> /// <param name="eatData">EatData</param> public MenuEventArgs(IWindow window, MenuType menuType, MenuContext menuContext, string text, ToolStripItemCollection menuItems, EatData eatData) { this.window = window; this.menuType = menuType; this.menuContext = menuContext; this.text = text; this.menuItems = menuItems; this.eataData = eatData; }
public void Execute(MenuContext context) { var emissor = EmissorFactory.GetEmissor(context.UF); emissor.Cancelar(new NFSe { Numero = context.NumeroNF }); }
private void Awake() { if (GameObject.FindWithTag("DontDestroy") == null) { Instantiate(_dontDestroy); } context = new MenuContext(this); }
public static MingMenuItem CreateSeparator(MenuContext menuContext) { var item = new MingMenuItem(); item.IsSeparator = true; item.MenuContext = menuContext; return item; }
public MenuButton[] GetContextMenuItems(MenuContext context) { var mbFormat = new MenuButton(context.SessionProfile.CurrentLanguage.Abbr == "RUS" ? "Формат..." : "Format...") { Action = args => (( XYPlotSeq )args.CurrentRegion).ShowFormatDialog(EnChartElement.Chart) }; return(new[] { mbFormat }); }
void Awake() { curState = null; Menu = new MenuContext( this ); Character = new CharacterContext( this ); Map = new MapContext( this ); EnterName = new EnterNameContext( this ); MatchScore = new MatchScore( this ); Header = new HeaderContext( this ); }
// // GET: /Admin/Menu/Edit public ActionResult Edit(int id = 0) { MenuModel menu = null; using (MenuContext context = new MenuContext()) { menu = context.GetMenu(id); } return(View(menu)); }
// // GET: /Admin/Menu/Items public ActionResult Items(int id = 0) { List <MenuItemModel> menuItems = null; using (MenuContext context = new MenuContext()) { menuItems = context.GetMenuItems(id); } return(View(menuItems)); }
void OnAddMemberBinding(object value) { MenuContext context = (MenuContext)value; SerializedProperty methodName = context.property.FindPropertyRelative("methodName"); SerializedProperty parameterType = context.property.FindPropertyRelative("parameterTypeName"); methodName.stringValue = context.memberInfo.Name; parameterType.stringValue = context.parameterType != null ? context.parameterType.AssemblyQualifiedName : null; context.property.serializedObject.ApplyModifiedProperties(); }
public void CheckAddCommandToTwoContexts() { var ctx1 = new MenuContext (string.Empty, string.Empty); var ctx2 = new MenuContext (string.Empty, string.Empty); var cmd = new MenuCommand (string.Empty, string.Empty); ctx1.AddCommand (cmd); ctx2.AddCommand (cmd); }
public IMenuContext CreateContext() { IMenuContext context = new MenuContext { Requests = GetFaqRequests().Select(ToFaqRequest).ToList(), Messages = GetMessages().Select(ToMessage).ToList() }; return(context); }
static public void InitMenu(ContextMenuStrip menu, MenuContext menuContext) { MenuContext prevMenuContext = menu.Tag as MenuContext; if (null == prevMenuContext) { menu.Opening += OnMenuOpening; } menu.Tag = menuContext; }
void Start() { Debug.Assert(paintingCanvasPanel != null && bottomBarMoneyPanel != null && weeklyPanel != null && mainMenuPanel != null, "Not all MenuPanels have been set!"); Debug.Assert(goldFameText != null && weeklyExpensesText != null && timeOfDayText != null, "Not all fields set!"); context = new MenuContext(); context.goldFameText = goldFameText; context.weeklyExpensesText = weeklyExpensesText; context.timeOfDayText = timeOfDayText; context.paintingSettingsPanel = paintingSettingsPanel; context.moneyPopper = moneyPopper; }
// // GET: /Admin/Menu/ public ActionResult Index() { // Списък на менюта List <MenuModel> menus = null; using (MenuContext context = new MenuContext()) { menus = context.GetMenus(HttpSession.CurrentSiteID); } return(View(menus)); }
public void ProcessMenu(MenuContext menuContext) { menuContext.Menus.Add(new Menu() { FromArea = "Demo", Href = "/Demo/Home/Index", Key = "/Demo/Home/Index", ParentKey = "/", Text = "DemoHomeIndex" }); menuContext.Menus.Add(new Menu() { FromArea = "Demo", Href = "/Demo/Home/DiTest", Key = "/Demo/Home/DiTest", ParentKey = "/", Text = "DemoHomeDiTest" }); }
public static MingMenuItem CreateMenuItem(string id, Bitmap icon, string title, MenuContext menuContext) { var item = new MingMenuItem(); item.Id = id; item.Icon = Utilities.BitmapImageFromBitmap(icon); item.Title = title; item.MenuContext = menuContext; return item; }
private void FolderListView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.FullPath.Contains("/")) { currentMenuContext = MenuContext.Directory; } else { currentMenuContext = MenuContext.HostName; } updateMenuSelection(); }
public MainViewModel(string dbPath) { Console.WriteLine(1); AppetizersButton = new Command(() => { using (var menu = new MenuContext(dbPath)) { collectionItems = new ObservableCollection <string>(menu.Appetizers.ToArray().Select((a) => a.AppetizerName)); } }); }
public ActionResult ItemEdit(MenuItemModel menuItem) { if (ModelState.IsValid) { using (MenuContext context = new MenuContext()) { context.SetMenuItem(menuItem); } return(RedirectToAction("Items", new { id = menuItem.MenuID })); } return(View(menuItem)); }
// // GET: /Admin/Menu/ItemEdit public ActionResult ItemEdit(int id = 0) { MenuItemModel menuItem = null; using (MenuContext context = new MenuContext()) { menuItem = context.GetMenuItem(id); //ViewBag.MenuItemTypes = context.GetMenuItemTypes(menuItem.TypeID); } return(View(menuItem)); }
private void Awake() { _menuContext = MenuContext.GetMenuContext(); _services = UsableServices.SharedInstance; _services.Initialize(_menuContext); _setupSystem = new SetupSystem(_menuContext, _services); _menuSystem = new MenuSystem(_menuContext, _services, log); _setupSystem.Awake(); _menuSystem.Awake(); }
public ActionResult Edit(MenuModel menu) { if (ModelState.IsValid) { using (MenuContext context = new MenuContext()) { context.SetMenu(menu); } return(RedirectToAction("Index")); } return(View(menu)); }
public void Execute(MenuContext context) { var emissor = EmissorFactory.GetEmissor(context.UF); emissor.Emitir(new NFSe { UF = context.UF, NomeCliente = context.NomeCliente, DescricaoServico = context.DescricaoServico, Valor = context.Valor }); }
public static void Initialize(MenuContext context) { if (!context.AdminList.Any()) { context.AdminList.AddRange( new Admin { FirstName = "ктота", SecondName = "какойта", Age = 666, City = "гдета" }, new Admin { FirstName = "чел", SecondName = "челочич", Age = 444, City = "человековск" }, new Admin { FirstName = "Митяй", SecondName = "Минин", Age = 18, City = "ВДК" } ); context.SaveChanges(); } if (!context.ModeratorList.Any()) { context.ModeratorList.AddRange( new Moderator { FirstName = "Модер", SecondName = "Модерович", Age = 1, Experience = 1000 }, new Moderator { FirstName = "Каратель228", SecondName = "ТвоюМа", Age = 10, Experience = 10 } ); context.SaveChanges(); } }
public List <MainMenu> GetMainMenu() { List <MainMenu> ObjMainMenu = new List <MainMenu>(); MenuContext db = new MenuContext(); var c1 = db.Categorias.ToList(); foreach (var item in c1) { ObjMainMenu.Add(new MainMenu { ID = item.CategoriaID, MainMenuItem = item.CategoryName }); } return(ObjMainMenu); }
private static MenuContext ReadInputForCancelar() { Console.Write("Informe a UF: "); var uf = Console.ReadLine(); Console.Write("Informe o Número da NFSe: "); var numero = Console.ReadLine(); var context = new MenuContext { UF = uf, NumeroNF = numero }; return(context); }
public void Init() { this.driver = new MenuDriver (); var root_context = new MenuContext ("", ""); root_context.AddCommand (new MenuCommand ("a", "")); root_context.AddCommand (new MenuCommand ("aaa", "")); root_context.AddCommand (new MenuCommand ("aab", "")); root_context.AddCommand (new MenuCommand ("ccc", "")); var context1 = new MenuContext ("context1", "", new MenuItemParameter ("param1", ""), new MenuItemParameter ("param2", "")); context1.AddCommand (new MenuCommand ("", "")); context1.AddCommand (new MenuCommand ("cmd", "")); var context2 = new MenuContext ("context2", ""); context2.AddCommand (new MenuCommand ("cmd", "")); var context = new MenuContext ("context", "", new MenuItemParameter ("param1", ""), new MenuItemParameter ("param2", ""), new MenuItemParameter ("param3", "")); context.AddCommand (new MenuCommand ("cmd", "")); var context10 = new MenuContext ("context10", "", new MenuItemParameter ("param1", "")); context10.AddCommand (new MenuCommand ("cmd", "")); var sub_a = new MenuContext ("sub_A", ""); sub_a.AddCommand (new MenuCommand ("command", "")); sub_a.AddCommand (new MenuCommand ("command1", "")); sub_a.AddCommand (new MenuCommand ("command2", "")); sub_a.AddCommand (new MenuCommand ("command12", "")); var sub_b = new MenuContext ("Sub_B", ""); sub_b.AddCommand (new MenuCommand ("aaa", "")); sub_b.AddCommand (new MenuCommand ("bbb", "")); sub_b.AddCommand (new MenuCommand ("ccc", "")); var ctx = new MenuContext ("ctx", "", new MenuItemParameter ("param1", "")); ctx.AddCommand (new MenuCommand ("cmd", "")); var myctx = new MenuContext ("myctx", "", new MenuItemParameter ("param1", ""), new MenuItemParameter ("param2", ""), new MenuItemParameter ("param3", ""), new MenuItemParameter ("param4", "")); myctx.AddCommand (new MenuCommand ("cmd", "")); var context2__sub = new MenuContext ("sub", "", new MenuItemParameter ("param1", "")); var context__sub = new MenuContext ("sub", "", new MenuItemParameter ("param1", "")); context__sub.AddCommand (new MenuCommand ("cmd", "")); var sub_b__a = new MenuContext ("a", ""); sub_b.AddSubContext (sub_b__a); context.AddSubContext (context__sub); context2.AddSubContext (context2__sub); context1.AddSubContext (sub_a); context1.AddSubContext (sub_b); context1.AddSubContext (ctx); context1.AddSubContext (myctx); root_context.AddSubContext (context); root_context.AddSubContext (context1); root_context.AddSubContext (context2); root_context.AddSubContext (context10); this.driver.SetRootContext (root_context); }
public void CheckSetRootContext_NotRoot_ToRoot() { this.driver = new MenuDriver (); var root = new MenuContext ("root", ""); root.AddCommand (new MenuCommand ("cmd-1", "")); root.AddCommand (new MenuCommand ("cmd-2", "")); var sub = new MenuContext ("sub", ""); sub.AddCommand (new MenuCommand ("cmd", "")); root.AddSubContext (sub); this.driver.SetRootContext (sub); this.driver.ToRoot (); Assert.AreEqual (sub, this.driver.Current); }
public void CheckNullNameConstructor() { this.context = new MenuContext (null, string.Empty, new MenuItemParameter (string.Empty, string.Empty)); Assert.IsNull (this.context.Name); }
public void CheckNullDescriptionConstructor() { this.context = new MenuContext (string.Empty, null, new MenuItemParameter (string.Empty, string.Empty)); Assert.IsNull (this.context.Description); }
public void CheckSetParameter() { var param1 = new MenuItemParameter ("p1", "dp1"); param1.SetValue (string.Empty); var param2 = new MenuItemParameter ("p2", "dp2"); param2.SetValue (string.Empty); const string pv1 = "new-value"; this.context = new MenuContext (string.Empty, string.Empty, param1, param2); this.context [0] = pv1; Assert.AreEqual (pv1, this.context.Parameters [0].Value); Assert.AreEqual (string.Empty, this.context.Parameters [1].Value); }
public void CheckRemoveSubContext() { const string name1 = "name-1"; const string name2 = "name-2"; var ctx1 = new MenuContext (name1, string.Empty); var ctx2 = new MenuContext (name2, string.Empty); this.context.AddSubContext (ctx1); this.context.AddSubContext (ctx2); this.context.RemoveSubContext (name2); Assert.IsNull (ctx2.Parent); Assert.AreEqual (1, this.context.ChildContexts.Count ()); Assert.AreEqual (ctx1, this.context.ChildContexts.First ()); }
public void CheckSetParametersCount_RemoveParams() { var param1 = new MenuItemParameter ("p1", "dp-1"); var param2 = new MenuItemParameter ("p2", "dp-2"); var param3 = new MenuItemParameter ("p3", "dp-3"); this.context = new MenuContext (string.Empty, string.Empty, param1, param2, param3); this.context.SetParametersCount (2); Assert.AreEqual (2, this.context.ParametersCount); Assert.AreEqual (param1, this.context.Parameters [0]); Assert.AreEqual (param2, this.context.Parameters [1]); }
public void CheckSetParametersCount_AddParams() { var param1 = new MenuItemParameter ("p1", "dp-1"); var param2 = new MenuItemParameter ("p2", "dp-2"); this.context = new MenuContext (string.Empty, string.Empty, param1, param2); this.context.SetParametersCount (3); Assert.AreEqual (3, this.context.ParametersCount); Assert.AreEqual (param1, this.context.Parameters [0]); Assert.AreEqual (param2, this.context.Parameters [1]); Assert.AreEqual (string.Empty, this.context.Parameters [2].Name); Assert.AreEqual (string.Empty, this.context.Parameters [2].Description); Assert.IsNull (this.context.Parameters [2].Value); }
public void Init() { this.context = new MenuContext (string.Empty, string.Empty); }
public void CheckAddSubContextToTwoContexts() { var ctx1 = new MenuContext (string.Empty, string.Empty); var ctx2 = new MenuContext (string.Empty, string.Empty); ctx1.AddSubContext (this.context); ctx2.AddSubContext (this.context); }
public void CheckAddSubContext() { const string name1 = "name-1"; const string name2 = "name-2"; var ctx1 = new MenuContext (name1, string.Empty); var ctx2 = new MenuContext (name2, string.Empty); this.context.AddSubContext (ctx1); this.context.AddSubContext (ctx2); Assert.AreEqual (2, this.context.ChildContexts.Count ()); Assert.AreEqual (this.context, ctx1.Parent); Assert.AreEqual (this.context, ctx2.Parent); Assert.IsTrue (this.context.ChildContexts.Contains (ctx1)); Assert.IsTrue (this.context.ChildContexts.Contains (ctx2)); }
void Awake() { context = new MenuContext(this); }
public void CheckGetSubContext() { const string name1 = "name-1"; const string name2 = "name-2"; var ctx1 = new MenuContext (name1, string.Empty); var ctx2 = new MenuContext (name2, string.Empty); this.context.AddSubContext (ctx1); this.context.AddSubContext (ctx2); Assert.AreEqual (ctx1, this.context.GetChild (name1)); Assert.AreEqual (ctx2, this.context.GetChild (name2)); }
public void CheckSetOutOfRangeParameter_Less() { var param1 = new MenuItemParameter ("p1", "dp1"); param1.SetValue (string.Empty); var param2 = new MenuItemParameter ("p2", "dp2"); param2.SetValue (string.Empty); const string pv1 = "new-value"; this.context = new MenuContext (string.Empty, string.Empty, param1, param2); this.context [-1] = pv1; }
public void CheckAfterConstruct() { const string name = "name"; const string description = "desc"; var param1 = new MenuItemParameter ("p1", "dp1"); var param2 = new MenuItemParameter ("p2", "dp2"); this.context = new MenuContext (name, description, param1, param2); Assert.AreEqual (name, this.context.Name); Assert.AreEqual (description, this.context.Description); Assert.AreEqual (2, this.context.ParametersCount); Assert.AreEqual (param1, this.context.Parameters [0]); Assert.AreEqual (param2, this.context.Parameters [1]); Assert.IsNull (this.context.Parent); Assert.AreEqual (0, this.context.ChildContexts.Count ()); Assert.AreEqual (0, this.context.Commands.Count ()); }