示例#1
0
        private void nikotalkieItem_ItemSelected(object sender, EventArgs e)
        {
            NikotalkieItem selectedNikotalkieItem = (NikotalkieItem)sender;

            this.mSelectedMessage      = (NMessage)selectedNikotalkieItem.Tag;
            this.mSelectedMessageIndex = mNikotalkieItems.IndexOf(selectedNikotalkieItem);
            this.RefreshView();
        }
示例#2
0
        void nikotalkieItem_ItemActionPlay(object sender, EventArgs e)
        {
            //TO DO PLAY SELECTED MESSAGE;
            if (mSelectedMessage == null)
            {
                return;
            }
            NikotalkieItem selectedNikotalkieItem = (NikotalkieItem)sender;

            this.mSelectedMessage = (NMessage)selectedNikotalkieItem.Tag;
            this.RefreshView();
            mOwner.StartPlayingMessage(this.mSelectedMessage);
        }
示例#3
0
        public void InitializeItems()
        {
            int itemsPerPage = Items.Height / mItemHeight;

            //only if needed
            if (itemsPerPage == mNikotalkieItems.Count)
            {
                return;
            }

            //add items
            if (itemsPerPage > mNikotalkieItems.Count)
            {
                for (int i = mNikotalkieItems.Count; i < itemsPerPage; i++)
                {
                    NikotalkieItem nikotalkieItem = new NikotalkieItem();
                    nikotalkieItem.ItemSelected   += new EventHandler(nikotalkieItem_ItemSelected);
                    nikotalkieItem.ItemActionPlay += new EventHandler(nikotalkieItem_ItemActionPlay);
                    nikotalkieItem.Height          = mItemHeight;
                    mNikotalkieItems.Add(nikotalkieItem);
                    this.Items.Controls.Add(nikotalkieItem);
                    nikotalkieItem.BringToFront();
                }
            }

            //remove items
            if (itemsPerPage < mNikotalkieItems.Count)
            {
                for (int i = mNikotalkieItems.Count - 1; i > itemsPerPage - 1; i--)
                {
                    try
                    {
                        mNikotalkieItems[i].Dispose();
                        mNikotalkieItems[i] = null;
                        mNikotalkieItems.RemoveAt(i);
                    }
                    catch (Exception)
                    {
#if (DEBUG)
                        throw;
#endif
                    }
                }
            }

            //refresh
            RefreshView();
        }
        public void InitializeItems()
        {
            int itemsPerPage =Items.Height / mItemHeight;
           
            //only if needed 
            if (itemsPerPage  == mNikotalkieItems.Count) return;
            
            //add items
            if (itemsPerPage > mNikotalkieItems.Count)
            {

                for (int i = mNikotalkieItems.Count; i < itemsPerPage; i++)
                {
                    NikotalkieItem nikotalkieItem = new NikotalkieItem();
                    nikotalkieItem.ItemSelected += new EventHandler(nikotalkieItem_ItemSelected);
                    nikotalkieItem.ItemActionPlay += new EventHandler(nikotalkieItem_ItemActionPlay);
                    nikotalkieItem.Height = mItemHeight;
                    mNikotalkieItems.Add(nikotalkieItem);
                    this.Items.Controls.Add(nikotalkieItem);
                    nikotalkieItem.BringToFront();
                }
            }

            //remove items
            if (itemsPerPage < mNikotalkieItems.Count)
            {
                for (int i = mNikotalkieItems.Count-1; i > itemsPerPage-1; i--)
                {
                    try
                    {
                    mNikotalkieItems[i].Dispose();
                    mNikotalkieItems[i]= null;
                    mNikotalkieItems.RemoveAt(i);
                }
                catch (Exception)
                {
#if (DEBUG)
                    throw;
#endif
                }
                }
            }
            
            //refresh
            RefreshView();
        }