//context menu private void ViewerListView_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (ViewerListView.FocusedItem.Bounds.Contains(e.Location) == true) { UserContextMenu.Show(Cursor.Position); } } }
public IEnumerator SetUp() { var prefab = AssetDatabase.LoadAssetAtPath(PREFAB_PATH, (typeof(GameObject))) as GameObject; contextMenu = UnityEngine.Object.Instantiate(prefab).GetComponent <UserContextMenu>(); friendsController = (new GameObject()).AddComponent <FriendsController>(); profileController = (new GameObject()).AddComponent <UserProfileController>(); profileController.AddUserProfileToCatalog(new UserProfileModel() { name = TEST_USER_ID, userId = TEST_USER_ID }); yield break; }
private void MenuCustomAddPoints_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { double amount = Convert.ToDouble(MenuCustomAddPoints.Text); if (amount > 0) { pointSys.addPoints(dbData.FindViewer(ViewerListView.SelectedItems[0].Text), amount); } else { MessageBox.Show("Points must be positive", "Add points Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } MenuCustomAddPoints.Clear(); UserContextMenu.Close(); } }
protected override IEnumerator SetUp() { var canvasgo = new GameObject("canvas"); canvas = canvasgo.AddComponent <Canvas>(); var go = Object.Instantiate(Resources.Load(CONTEXT_MENU_PREFAB_NAME), canvas.transform, false) as GameObject; contextMenu = go.GetComponent <UserContextMenu>(); contextMenu.Initialize(TEST_USER_ID, TEST_USER_NAME, false); Assert.AreEqual(TEST_USER_NAME, contextMenu.userName.text, "The context menu title should coincide with the configured user."); contextMenu.OnShowMenu += ContextMenu_OnShowMenu; contextMenu.OnPassport += ContextMenu_OnPassport; contextMenu.OnReport += ContextMenu_OnReport; contextMenu.OnBlock += ContextMenu_OnBlock; yield break; }