public void SetMenuItems(IEnumerable <TrayMenuItemViewModel> items) { _notifyIcon.ContextMenu.MenuItems.Clear(); foreach (var item in items) { var menuItem = new MenuItem() { Text = item.Text, }; menuItem.Click += (sender, args) => { OnMenuItemClick?.Invoke(sender, new MenuItemClickEventArgs() { Id = item.Id }); }; _notifyIcon.ContextMenu.MenuItems.Add(menuItem); } }
public void Setup() { //toolbarItems = new ToolbarItem[itemCount]; for (int i = 0; i < toolbarItems.Length; i++) { int index = i; toolbarItems[i].SetSelect(false); toolbarItems[i].GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => OnMenuItemClick?.Invoke(index)); } OnMenuItemClick = SelectIndex; }
protected virtual void OnOnMenuItemClick(MenuItem arg1) { OnMenuItemClick?.Invoke(arg1, EventArgs.Empty); }
public void Setup(CreationLibrarySidebar creationLibrary) { this.creationLibrary = creationLibrary; for (int i = 0; i < ASSET_COUNT; i++) { int index = i; toolbarItems[i].SetSelect(false); toolbarItems[i].GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => OnMenuItemClick?.Invoke(index)); } assetObjectsParent = new GameObject("assetObjects").transform; assetToolbarAssets = new ActorableSearchResult[ASSET_COUNT]; moreButton.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => { if (creationLibrary.IsOpenedOrOpening()) { creationLibrary.RequestClose(); } else { creationLibrary.RequestOpen(); } }); Util.FindIfNotSet(this, ref assetSearch); OnMenuItemClick = SelectIndex; assetToolbarRenderables = new GameObject[ASSET_COUNT]; assetToolbarObjects = new GameObject[ASSET_COUNT]; for (int i = 0; i < assetToolbarObjects.Length; i++) { assetToolbarObjects[i] = new GameObject("new tool item"); assetToolbarObjects[i].transform.SetParent(assetObjectsParent); assetToolbarObjects[i].transform.localPosition = Vector3.zero; assetToolbarObjects[i].transform.localRotation = Quaternion.identity; assetToolbarObjects[i].transform.localScale = new Vector3(1f, 1f, 1f); assetToolbarObjects[i].SetActive(false); } //load the toolbar with goodstuff by hand for now LoadDefaultAssets(); }
/* public void SetOptionsSelect(bool on) * { * optionsItem.SetSelect(on); * } */ public void Setup() { for (int i = 0; i < toolbarItems.Length; i++) { int index = i; toolbarItems[i].SetColors(primaryToolColors[i], secondaryToolColors[i]); toolbarItems[i].SetSelect(false); toolbarItems[i].GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => OnMenuItemClick?.Invoke(index)); } /* optionsItem.SetColors(primaryOptionColor, secondaryOptionColor); * optionsItem.SetSelect(false); * optionsItem.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() => OnOptionsClick?.Invoke()); */ }