コード例 #1
0
 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));
     }
 }
コード例 #2
0
 private void Awake()
 {
     _menuContext = MenuContext.GetMenuContext();
     _buttons     = new List <Button>();
     _buttons.AddRange(canvas.GetComponentsInChildren <Button>());
     _photonView = GetComponent <PhotonView>();
 }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: MingMenuItemFactory.cs プロジェクト: stevehjohn/Hub
        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;
        }
コード例 #5
0
ファイル: PRMMenuProcess.cs プロジェクト: congzw/nbsites
 private void AddDemoMenu(MenuContext menuContext, string href)
 {
     menuContext.Menus.Add(new Menu()
     {
         FromArea = "PRM", Href = href, Key = href, ParentKey = "/", Text = href
     });
 }
コード例 #6
0
 public static void InitMenu(ContextMenuStrip menu, MenuContext menuContext)
 {
     MenuContext prevMenuContext = menu.Tag as MenuContext;
       if (null == prevMenuContext)
     menu.Opening += OnMenuOpening;
       menu.Tag = menuContext;
 }
コード例 #7
0
 public VenueController(ILogger <VenueController> logger, IConfiguration config, MenuContext context)
 {
     _logger         = logger;
     _apiUrl         = Environment.GetEnvironmentVariable("API_URL");
     _clientIdSecret = Environment.GetEnvironmentVariable("CLIENT_ID_SECRET");
     venueContext    = context;
 }
コード例 #8
0
ファイル: MingMenuItemFactory.cs プロジェクト: stevehjohn/Hub
        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);
            }
        }
コード例 #12
0
 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);
 }
コード例 #13
0
ファイル: MenuEventArgs.cs プロジェクト: krystinalynn/apiv2
 /// <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;
 }
コード例 #14
0
        public void Execute(MenuContext context)
        {
            var emissor = EmissorFactory.GetEmissor(context.UF);

            emissor.Cancelar(new NFSe
            {
                Numero = context.NumeroNF
            });
        }
コード例 #15
0
        private void Awake()
        {
            if (GameObject.FindWithTag("DontDestroy") == null)
            {
                Instantiate(_dontDestroy);
            }

            context = new MenuContext(this);
        }
コード例 #16
0
ファイル: MingMenuItemFactory.cs プロジェクト: stevehjohn/Hub
        public static MingMenuItem CreateSeparator(MenuContext menuContext)
        {
            var item = new MingMenuItem();

            item.IsSeparator = true;
            item.MenuContext = menuContext;

            return item;
        }
コード例 #17
0
        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 });
        }
コード例 #18
0
ファイル: MainContext.cs プロジェクト: StarkTT/TestTask
	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 );
	}
コード例 #19
0
        //
        // 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));
        }
コード例 #20
0
        //
        // 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));
        }
コード例 #21
0
        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();
        }
コード例 #22
0
        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);
        }
コード例 #23
0
ファイル: MenuService.cs プロジェクト: arturmezhidov/Adikov
        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;
        }
コード例 #25
0
ファイル: MenuPanels.cs プロジェクト: Ryxali/Passpartout
 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;
 }
コード例 #26
0
        //
        // GET: /Admin/Menu/

        public ActionResult Index()
        {
            // Списък на менюта
            List <MenuModel> menus = null;

            using (MenuContext context = new MenuContext())
            {
                menus = context.GetMenus(HttpSession.CurrentSiteID);
            }
            return(View(menus));
        }
コード例 #27
0
 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"
     });
 }
コード例 #28
0
ファイル: MingMenuItemFactory.cs プロジェクト: stevehjohn/Hub
        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;
        }
コード例 #29
0
 private void FolderListView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node.FullPath.Contains("/"))
     {
         currentMenuContext = MenuContext.Directory;
     }
     else
     {
         currentMenuContext = MenuContext.HostName;
     }
     updateMenuSelection();
 }
コード例 #30
0
        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));
                }
            });
        }
コード例 #31
0
 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));
 }
コード例 #32
0
        //
        // 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));
        }
コード例 #33
0
        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();
        }
コード例 #34
0
 public ActionResult Edit(MenuModel menu)
 {
     if (ModelState.IsValid)
     {
         using (MenuContext context = new MenuContext())
         {
             context.SetMenu(menu);
         }
         return(RedirectToAction("Index"));
     }
     return(View(menu));
 }
コード例 #35
0
        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
            });
        }
コード例 #36
0
ファイル: SampleData.cs プロジェクト: Edwelde/Web_HW_4
        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();
            }
        }
コード例 #37
0
        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);
        }
コード例 #38
0
        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);
        }
コード例 #39
0
        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);
        }
コード例 #40
0
        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);
        }
コード例 #41
0
 public void CheckNullNameConstructor()
 {
     this.context = new MenuContext (null, string.Empty, new MenuItemParameter (string.Empty, string.Empty));
     Assert.IsNull (this.context.Name);
 }
コード例 #42
0
 public void CheckNullDescriptionConstructor()
 {
     this.context = new MenuContext (string.Empty, null, new MenuItemParameter (string.Empty, string.Empty));
     Assert.IsNull (this.context.Description);
 }
コード例 #43
0
        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);
        }
コード例 #44
0
        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 ());
        }
コード例 #45
0
        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]);
        }
コード例 #46
0
        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);
        }
コード例 #47
0
 public void Init()
 {
     this.context = new MenuContext (string.Empty, string.Empty);
 }
コード例 #48
0
        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);
        }
コード例 #49
0
        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));
        }
コード例 #50
0
ファイル: MenuRoot.cs プロジェクト: parshutin/YASG
 void Awake()
 {
     context = new MenuContext(this);
 }
コード例 #51
0
        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));
        }
コード例 #52
0
        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;
        }
コード例 #53
0
        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 ());
        }