Exemplo n.º 1
0
        public formUserLists(byte companyID, short userID)
        {
            mCompanyID = companyID;
            mUserID    = userID;

            InitializeComponent();

            SetAppearance();

            // Add the user image to list
            imagelistMain.Images.Add(CSMessenger.Properties.Resources.IMAGE_USER_CHAT_32);

            // Create Companies Controls
            UserListFunctions ListsOfUsers = new UserListFunctions();

            mlistviewFavorites = ListsOfUsers.AddControlsToTabPage("listviewFavorites", ref tabpageFavorites, ref contextmenuFavorites, UserListDoubleClick);
            ListsOfUsers.CreateCompanyControlsAndLoadUsers(mdbContext, mCompanyID, mUserID, ref tabUsers, ref contextmenuMain, UserListDoubleClick);
            ListsOfUsers  = null;
            mCompanyCount = Convert.ToByte(tabUsers.TabPages.Count - 1);

            // Load Favorites Users
            mlistviewFavorites.Sorting = System.Windows.Forms.SortOrder.Ascending;
            //if (UserFavorite.LoadFavoritesToList(ref mlistviewFavorites, mCompanyID, mUserID, mCompanyCount) == false)
            //{
            //    System.Environment.Exit(1);
            //}
        }
Exemplo n.º 2
0
        private bool GetUserInfoFromContextMenuClick(object sender, out byte companyID, out short userID, out string userName)
        {
            // Gets the source ListView of the ContextMenu
            ToolStripItem item = (sender as ToolStripItem);

            if (item != null)
            {
                ContextMenuStrip owner = item.Owner as ContextMenuStrip;
                if (owner != null)
                {
                    ListView listViewSource = owner.SourceControl as ListView;

                    if (UserListFunctions.GetUserInfoFromListViewItem(ref listViewSource, out companyID, out userID, out userName))
                    {
                        return(true);
                    }
                }
            }
            companyID = 0;
            userID    = 0;
            userName  = "";
            return(false);
        }